{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/53312326","id":53312326,"diff_hunk":"@@ -312,6 +310,40 @@ define([\n                         }\n                     }\n                 }\n+\n+                if(form_id == 'end_date' && !$scope.edit_data[role_id].end_date){\n+                    $scope.edit_data[role_id].end_date = null;\n+                }\n+\n+                if ($scope.edit_data[role_id].job_contract_id\n+                    && $scope.edit_data[role_id].start_date\n+                    && typeof $scope.edit_data[role_id].end_date != 'undefined'\n+                    && (form_id == 'start_date' || form_id == 'job_contract_id' || form_id == 'end_date')) {\n+\n+                    $scope.updateRolesWithContractData(role_id);\n+                }\n+            };\n+\n+            $scope.updateRolesWithContractData = function (role_id) {\n+                var contract_id = $scope.edit_data[role_id].job_contract_id;","path":"com.civicrm.hrjobroles/js/src/job-roles/controllers/hr-job-roles-controller.js","position":122,"original_position":122,"commit_id":"f4b6f47cde04cbf6aaee66994aeb9cb304b07d5d","original_commit_id":"f4b6f47cde04cbf6aaee66994aeb9cb304b07d5d","user":{"login":"AkA84","id":6400898,"avatar_url":"https://avatars.githubusercontent.com/u/6400898?v=3","gravatar_id":"","url":"https://api.github.com/users/AkA84","html_url":"https://github.com/AkA84","followers_url":"https://api.github.com/users/AkA84/followers","following_url":"https://api.github.com/users/AkA84/following{/other_user}","gists_url":"https://api.github.com/users/AkA84/gists{/gist_id}","starred_url":"https://api.github.com/users/AkA84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AkA84/subscriptions","organizations_url":"https://api.github.com/users/AkA84/orgs","repos_url":"https://api.github.com/users/AkA84/repos","events_url":"https://api.github.com/users/AkA84/events{/privacy}","received_events_url":"https://api.github.com/users/AkA84/received_events","type":"User","site_admin":false},"body":"Please use camelCase (`contractId`) instead of snake_case (`contract_id`) when possible. Some of the property names come directly from the backend so they're stuck with the snake_case, but other than those the standard is the camelCase","created_at":"2016-02-18T13:23:12Z","updated_at":"2016-02-18T13:23:12Z","html_url":"https://github.com/civicrm/civihr/pull/862#discussion_r53312326","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/862","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/53312326"},"html":{"href":"https://github.com/civicrm/civihr/pull/862#discussion_r53312326"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/862"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/862","id":59760892,"html_url":"https://github.com/civicrm/civihr/pull/862","diff_url":"https://github.com/civicrm/civihr/pull/862.diff","patch_url":"https://github.com/civicrm/civihr/pull/862.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/862","number":862,"state":"open","locked":false,"title":"PCHR-505 Job Roles dates bugs","user":{"login":"kkalamarski","id":5514826,"avatar_url":"https://avatars.githubusercontent.com/u/5514826?v=3","gravatar_id":"","url":"https://api.github.com/users/kkalamarski","html_url":"https://github.com/kkalamarski","followers_url":"https://api.github.com/users/kkalamarski/followers","following_url":"https://api.github.com/users/kkalamarski/following{/other_user}","gists_url":"https://api.github.com/users/kkalamarski/gists{/gist_id}","starred_url":"https://api.github.com/users/kkalamarski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkalamarski/subscriptions","organizations_url":"https://api.github.com/users/kkalamarski/orgs","repos_url":"https://api.github.com/users/kkalamarski/repos","events_url":"https://api.github.com/users/kkalamarski/events{/privacy}","received_events_url":"https://api.github.com/users/kkalamarski/received_events","type":"User","site_admin":false},"body":"# Bugfixes\r\n## Bug:\r\n**While creating a JobRole using Contract with only start date, end date gets set to current date (todays date).** \r\nExpected - End Date should be empty.\r\n## Solution:\r\nNot using `new Date()`. When param was in wrong format `new Date()` pointed to today.\r\n![empty_end_date](https://cloud.githubusercontent.com/assets/5514826/13142451/cac0a198-d645-11e5-8497-92b941395d98.gif)\r\n\r\n## Bug: \r\n**Job role dates do not change on modifying job contract dates.**\r\nExpected: Job role dates should get updated on changing job contract dates\r\n## Solution\r\nOn JobRoles load check if current dates are other than ones in contract and if they're the same as dates from recent revision. If yes, update JobRole with new contract dates.\r\n![update contract](https://cloud.githubusercontent.com/assets/5514826/13142757/0550590a-d648-11e5-862b-175510eb2ffe.gif)\r\n\r\n## Bug:\r\n**Edit existing job role -> modify the start/end dates -> and save: dates get reset**\r\nExpected - Should be able to save successfully\r\n## Solution\r\nUsing `moment()` instead of `new Date()`. Fixed formatting in `$scope.parseDate()` method.\r\n![edit](https://cloud.githubusercontent.com/assets/5514826/13142908/f78f8e16-d648-11e5-9809-e2bfd4158549.gif)\r\n\r\n## Bug:\r\n**Edit existing job role -> modify the contract to use another one: The dates do not get updated with the new contract.**\r\nExpected: Dates should get updated with new contract dates and be able to save successfully.\r\n## Solution\r\nFix onContractEdited() method.\r\n![edit_contract](https://cloud.githubusercontent.com/assets/5514826/13142988/923f2a02-d649-11e5-8e77-ebd0c0a196c5.gif)\r\n\r\n# Refactor\r\nMoved `DateValidationService` service from angular-date to HRJobRoles, as it's extension specific validator and renamed it into `DateValidation`.\r\nNow we're using `moment()` rather than `new Date();`\r\nCreated promise chain instead of randomly creating async calls to API.\r\n","created_at":"2016-02-18T07:33:17Z","updated_at":"2016-02-18T13:23:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5b2428884b8fbfe067a166a01e5a2d64c196739","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/862/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/862/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/862/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/f4b6f47cde04cbf6aaee66994aeb9cb304b07d5d","head":{"label":"civicrm:PCHR-505-JobRoles-Dates-Bugs","ref":"PCHR-505-JobRoles-Dates-Bugs","sha":"f4b6f47cde04cbf6aaee66994aeb9cb304b07d5d","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.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://avatars.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":"2016-02-17T12:41:09Z","pushed_at":"2016-02-18T12:49:56Z","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":18650,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":4,"forks":21,"open_issues":4,"watchers":2,"default_branch":"develop"}},"base":{"label":"civicrm:integration","ref":"integration","sha":"5d25cad2676037637efa5f9254e78486ec5262ba","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.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://avatars.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":"2016-02-17T12:41:09Z","pushed_at":"2016-02-18T12:49:56Z","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":18650,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":4,"forks":21,"open_issues":4,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/862"},"html":{"href":"https://github.com/civicrm/civihr/pull/862"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/862"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/862/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/862/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/862/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/f4b6f47cde04cbf6aaee66994aeb9cb304b07d5d"}}}}