{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/110646123","pull_request_review_id":31832209,"id":110646123,"diff_hunk":"@@ -217,18 +217,17 @@ define([\n                 }\n \n                 return $q.all(promiseContractNew);\n-              }, function(reason) {\n-                CRM.alert(reason, 'Error', 'error');\n-                $modalInstance.dismiss();\n-                return $q.reject();\n               }).then(function() {\n                 $scope.$broadcast('hrjc-loader-hide');\n                 $modalInstance.close(contract);\n \n                 pubSub.publish('contract:created', settings.contactId);\n                 pubSub.publish('contract-refresh');\n+              }, function (reason) {\n+                CRM.alert(reason, 'Error', 'error');\n+                ContractService.delete(contractId);","path":"hrjobcontract/js/src/job-contract/controllers/modal/modal-contract-new.js","position":16,"original_position":16,"commit_id":"09147fd31e9be721dcccda419361820cdbf6762f","original_commit_id":"09147fd31e9be721dcccda419361820cdbf6762f","user":{"login":"dhavalsharma","id":89973,"avatar_url":"https://avatars1.githubusercontent.com/u/89973?v=3","gravatar_id":"","url":"https://api.github.com/users/dhavalsharma","html_url":"https://github.com/dhavalsharma","followers_url":"https://api.github.com/users/dhavalsharma/followers","following_url":"https://api.github.com/users/dhavalsharma/following{/other_user}","gists_url":"https://api.github.com/users/dhavalsharma/gists{/gist_id}","starred_url":"https://api.github.com/users/dhavalsharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhavalsharma/subscriptions","organizations_url":"https://api.github.com/users/dhavalsharma/orgs","repos_url":"https://api.github.com/users/dhavalsharma/repos","events_url":"https://api.github.com/users/dhavalsharma/events{/privacy}","received_events_url":"https://api.github.com/users/dhavalsharma/received_events","type":"User","site_admin":false},"body":"is delete sync call? ","created_at":"2017-04-10T12:53:05Z","updated_at":"2017-04-10T12:58:04Z","html_url":"https://github.com/civicrm/civihr/pull/1631#discussion_r110646123","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/1631","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/110646123"},"html":{"href":"https://github.com/civicrm/civihr/pull/1631#discussion_r110646123"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1631"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/1631","id":110809926,"html_url":"https://github.com/civicrm/civihr/pull/1631","diff_url":"https://github.com/civicrm/civihr/pull/1631.diff","patch_url":"https://github.com/civicrm/civihr/pull/1631.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/1631","number":1631,"state":"open","locked":false,"title":"PCHR-1861: Handle exception on contract create and update","user":{"login":"bmnepali","id":6307362,"avatar_url":"https://avatars1.githubusercontent.com/u/6307362?v=3","gravatar_id":"","url":"https://api.github.com/users/bmnepali","html_url":"https://github.com/bmnepali","followers_url":"https://api.github.com/users/bmnepali/followers","following_url":"https://api.github.com/users/bmnepali/following{/other_user}","gists_url":"https://api.github.com/users/bmnepali/gists{/gist_id}","starred_url":"https://api.github.com/users/bmnepali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmnepali/subscriptions","organizations_url":"https://api.github.com/users/bmnepali/orgs","repos_url":"https://api.github.com/users/bmnepali/repos","events_url":"https://api.github.com/users/bmnepali/events{/privacy}","received_events_url":"https://api.github.com/users/bmnepali/received_events","type":"User","site_admin":false},"body":"### Issue:\r\nThe exception while creating is captured but not handled properly in ` hrjobcontract/js/src/job-contract/controllers/modal/modal-contract-new.js` and  `hrjobcontract/js/src/job-contract/controllers/modal/modal-contract.js` in `save()` and `contractEdit()` functions respectively.\r\n\r\n### Solution:\r\n1. Add code to display the exception properly in `hrjobcontract/js/src/job-contract/controllers/modal/modal-contract-new.js` in save() functions as below:\r\n```\r\n  function (reason) {\r\n      CRM.alert(reason, 'Error', 'error');\r\n      ContractService.delete(contractId);\r\n      $scope.$broadcast('hrjc-loader-hide');\r\n  } \r\n```\r\n1.1 This will also delete the contract just created if the exception happens in the middle of saving contract data.\r\n\r\n1.2 Hide the spinner, allowing user to edit the changes in the contract modal.\r\n\r\n2. Remove `$modalInstance.dismiss();` from error cache block, which dismisses the modal in contractEdit() function form `hrjobcontract/js/src/job-contract/controllers/modal/modal-contract.js` in `contractEdit()` function, allowing user to edit the changes in the contract modal.\r\n\r\n### Screenshots: (gif)\r\n1. Displays error appropriately on creating contract:\r\n![add contract-iloveimg-compressed](https://cloud.githubusercontent.com/assets/6307362/23943693/66d6cb30-0998-11e7-86b0-38fb38bacaff.gif)\r\n\r\n2. Displays error appropriately on saving  contract after editing it:\r\n![edit contract-iloveimg-compressed](https://cloud.githubusercontent.com/assets/6307362/23943140/848193ba-0996-11e7-9cd0-4c7cf5cf6ad4.gif)\r\n","created_at":"2017-03-15T10:15:11Z","updated_at":"2017-04-10T12:58:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7302c0784a15a6cdc34a08faa20c708131652c97","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/1631/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/1631/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/1631/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/09147fd31e9be721dcccda419361820cdbf6762f","head":{"label":"civicrm:PCHR-1861-handle-exception-on-contract-create-and-update","ref":"PCHR-1861-handle-exception-on-contract-create-and-update","sha":"09147fd31e9be721dcccda419361820cdbf6762f","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars1.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars1.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2017-03-27T04:47:29Z","pushed_at":"2017-04-10T12:40:52Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":44301,"stargazers_count":10,"watchers_count":10,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":24,"forks":31,"open_issues":24,"watchers":10,"default_branch":"staging"}},"base":{"label":"civicrm:staging","ref":"staging","sha":"9ec539fc3efca08b4ad9fcb8e11b6804107625fa","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars1.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars1.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2017-03-27T04:47:29Z","pushed_at":"2017-04-10T12:40:52Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":44301,"stargazers_count":10,"watchers_count":10,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":24,"forks":31,"open_issues":24,"watchers":10,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1631"},"html":{"href":"https://github.com/civicrm/civihr/pull/1631"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1631"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1631/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1631/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1631/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/09147fd31e9be721dcccda419361820cdbf6762f"}}}}
{"actor":{"display_login":"dhavalsharma"}}