{"action":"created","comment":{"url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/comments/28154787","id":28154787,"diff_hunk":"@@ -724,6 +728,50 @@ static function sendMail($contactID, &$values) {\n     return $sent ? TRUE : FALSE;\n   }\n   \n+  static function AdjustIndiviualTarget($teamPcpId, $goalAmount, $pcpId = NULL) {\n+    if(empty($teamPcpId)) {\n+      return NULL;\n+    }\n+    // from join team member custom field\n+    if ($teamPcpId && $pcpId && CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'goal_amount') == 0) {\n+          $params = array(\n+            'version'     => 3,\n+            'id'          => $pcpId,\n+            'goal_amount' => $goalAmount,\n+          );\n+          $result = civicrm_api('pcpteams', 'create', $params);\n+    }\n+    $pcpType  = CRM_Pcpteams_Utils::checkPcpType($teamPcpId);\n+    if ($pcpType == CRM_Pcpteams_Constant::C_CONTACT_SUB_TYPE) {\n+      $teamMemberInfo = civicrm_api( 'pcpteams', 'getTeamMembersInfo', array(\n+        'version'  => 3, \n+        'pcp_id'   => $teamPcpId,\n+      )\n+      );\n+      foreach ($teamMemberInfo['values'] as $teamMember) {\n+        if($teamMember['goal_amount'] == 0) {\n+          $params = array(\n+            'version'     => 3,\n+            'id'          => $teamMember['pcp_id'],\n+            'goal_amount' => $goalAmount,\n+          );\n+          $result = civicrm_api('pcpteams', 'create', $params);\n+        }\n+      }\n+    }\n+  }\n+  \n+  static function checkPcpType($pcpId) {\n+    if(empty($pcpId)) {\n+      return NULL;\n+    }\n+    $aContactTypes   = CRM_Contact_BAO_Contact::getContactTypes(CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'contact_id'));\n+    $isIndividualPcp = in_array('Individual', $aContactTypes) ? TRUE : FALSE;","path":"CRM/Pcpteams/Utils.php","position":55,"original_position":55,"commit_id":"c827bd5d122d7674304ed89a6830dbdbc6111260","original_commit_id":"c827bd5d122d7674304ed89a6830dbdbc6111260","user":{"login":"deepak-srivastava","id":3448551,"avatar_url":"https://avatars.githubusercontent.com/u/3448551?v=3","gravatar_id":"","url":"https://api.github.com/users/deepak-srivastava","html_url":"https://github.com/deepak-srivastava","followers_url":"https://api.github.com/users/deepak-srivastava/followers","following_url":"https://api.github.com/users/deepak-srivastava/following{/other_user}","gists_url":"https://api.github.com/users/deepak-srivastava/gists{/gist_id}","starred_url":"https://api.github.com/users/deepak-srivastava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepak-srivastava/subscriptions","organizations_url":"https://api.github.com/users/deepak-srivastava/orgs","repos_url":"https://api.github.com/users/deepak-srivastava/repos","events_url":"https://api.github.com/users/deepak-srivastava/events{/privacy}","received_events_url":"https://api.github.com/users/deepak-srivastava/received_events","type":"User","site_admin":false},"body":"might not need this one","created_at":"2015-04-10T15:35:56Z","updated_at":"2015-04-10T15:35:56Z","html_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166#discussion_r28154787","pull_request_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166","_links":{"self":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/comments/28154787"},"html":{"href":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166#discussion_r28154787"},"pull_request":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166"}}},"pull_request":{"url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166","id":33047158,"html_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166","diff_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166.diff","patch_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166.patch","issue_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/166","number":166,"state":"open","locked":false,"title":"Members goal amount fix if it were 0 and assigned to team ga on edit and manage page","user":{"login":"Kajakaran","id":7429798,"avatar_url":"https://avatars.githubusercontent.com/u/7429798?v=3","gravatar_id":"","url":"https://api.github.com/users/Kajakaran","html_url":"https://github.com/Kajakaran","followers_url":"https://api.github.com/users/Kajakaran/followers","following_url":"https://api.github.com/users/Kajakaran/following{/other_user}","gists_url":"https://api.github.com/users/Kajakaran/gists{/gist_id}","starred_url":"https://api.github.com/users/Kajakaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kajakaran/subscriptions","organizations_url":"https://api.github.com/users/Kajakaran/orgs","repos_url":"https://api.github.com/users/Kajakaran/repos","events_url":"https://api.github.com/users/Kajakaran/events{/privacy}","received_events_url":"https://api.github.com/users/Kajakaran/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-10T13:38:04Z","updated_at":"2015-04-10T15:35:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ff3e357cebc9a6789cbdb36aa03d3ed9039fb55","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166/commits","review_comments_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166/comments","review_comment_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/comments{/number}","comments_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/166/comments","statuses_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/statuses/c827bd5d122d7674304ed89a6830dbdbc6111260","head":{"label":"Kajakaran:dashboard-fixes","ref":"dashboard-fixes","sha":"c827bd5d122d7674304ed89a6830dbdbc6111260","user":{"login":"Kajakaran","id":7429798,"avatar_url":"https://avatars.githubusercontent.com/u/7429798?v=3","gravatar_id":"","url":"https://api.github.com/users/Kajakaran","html_url":"https://github.com/Kajakaran","followers_url":"https://api.github.com/users/Kajakaran/followers","following_url":"https://api.github.com/users/Kajakaran/following{/other_user}","gists_url":"https://api.github.com/users/Kajakaran/gists{/gist_id}","starred_url":"https://api.github.com/users/Kajakaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kajakaran/subscriptions","organizations_url":"https://api.github.com/users/Kajakaran/orgs","repos_url":"https://api.github.com/users/Kajakaran/repos","events_url":"https://api.github.com/users/Kajakaran/events{/privacy}","received_events_url":"https://api.github.com/users/Kajakaran/received_events","type":"User","site_admin":false},"repo":{"id":31668764,"name":"uk.co.vedaconsulting.pcpteams","full_name":"Kajakaran/uk.co.vedaconsulting.pcpteams","owner":{"login":"Kajakaran","id":7429798,"avatar_url":"https://avatars.githubusercontent.com/u/7429798?v=3","gravatar_id":"","url":"https://api.github.com/users/Kajakaran","html_url":"https://github.com/Kajakaran","followers_url":"https://api.github.com/users/Kajakaran/followers","following_url":"https://api.github.com/users/Kajakaran/following{/other_user}","gists_url":"https://api.github.com/users/Kajakaran/gists{/gist_id}","starred_url":"https://api.github.com/users/Kajakaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kajakaran/subscriptions","organizations_url":"https://api.github.com/users/Kajakaran/orgs","repos_url":"https://api.github.com/users/Kajakaran/repos","events_url":"https://api.github.com/users/Kajakaran/events{/privacy}","received_events_url":"https://api.github.com/users/Kajakaran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kajakaran/uk.co.vedaconsulting.pcpteams","description":"","fork":true,"url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams","forks_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/forks","keys_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/teams","hooks_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/hooks","issue_events_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/issues/events{/number}","events_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/events","assignees_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/assignees{/user}","branches_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/branches{/branch}","tags_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/tags","blobs_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/statuses/{sha}","languages_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/languages","stargazers_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/stargazers","contributors_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/contributors","subscribers_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/subscribers","subscription_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/subscription","commits_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/contents/{+path}","compare_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/merges","archive_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/downloads","issues_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/issues{/number}","pulls_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/pulls{/number}","milestones_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/milestones{/number}","notifications_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/labels{/name}","releases_url":"https://api.github.com/repos/Kajakaran/uk.co.vedaconsulting.pcpteams/releases{/id}","created_at":"2015-03-04T17:02:50Z","updated_at":"2015-03-04T17:02:50Z","pushed_at":"2015-04-10T15:28:30Z","git_url":"git://github.com/Kajakaran/uk.co.vedaconsulting.pcpteams.git","ssh_url":"git@github.com:Kajakaran/uk.co.vedaconsulting.pcpteams.git","clone_url":"https://github.com/Kajakaran/uk.co.vedaconsulting.pcpteams.git","svn_url":"https://github.com/Kajakaran/uk.co.vedaconsulting.pcpteams","homepage":null,"size":1180,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"veda-consulting:master","ref":"master","sha":"f2c38133c4a873697c11fe4256bed98d4c0fa403","user":{"login":"veda-consulting","id":2448382,"avatar_url":"https://avatars.githubusercontent.com/u/2448382?v=3","gravatar_id":"","url":"https://api.github.com/users/veda-consulting","html_url":"https://github.com/veda-consulting","followers_url":"https://api.github.com/users/veda-consulting/followers","following_url":"https://api.github.com/users/veda-consulting/following{/other_user}","gists_url":"https://api.github.com/users/veda-consulting/gists{/gist_id}","starred_url":"https://api.github.com/users/veda-consulting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veda-consulting/subscriptions","organizations_url":"https://api.github.com/users/veda-consulting/orgs","repos_url":"https://api.github.com/users/veda-consulting/repos","events_url":"https://api.github.com/users/veda-consulting/events{/privacy}","received_events_url":"https://api.github.com/users/veda-consulting/received_events","type":"User","site_admin":false},"repo":{"id":31593753,"name":"uk.co.vedaconsulting.pcpteams","full_name":"veda-consulting/uk.co.vedaconsulting.pcpteams","owner":{"login":"veda-consulting","id":2448382,"avatar_url":"https://avatars.githubusercontent.com/u/2448382?v=3","gravatar_id":"","url":"https://api.github.com/users/veda-consulting","html_url":"https://github.com/veda-consulting","followers_url":"https://api.github.com/users/veda-consulting/followers","following_url":"https://api.github.com/users/veda-consulting/following{/other_user}","gists_url":"https://api.github.com/users/veda-consulting/gists{/gist_id}","starred_url":"https://api.github.com/users/veda-consulting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veda-consulting/subscriptions","organizations_url":"https://api.github.com/users/veda-consulting/orgs","repos_url":"https://api.github.com/users/veda-consulting/repos","events_url":"https://api.github.com/users/veda-consulting/events{/privacy}","received_events_url":"https://api.github.com/users/veda-consulting/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams","description":"","fork":false,"url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams","forks_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/forks","keys_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/teams","hooks_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/hooks","issue_events_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/events{/number}","events_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/events","assignees_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/assignees{/user}","branches_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/branches{/branch}","tags_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/tags","blobs_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/git/refs{/sha}","trees_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/statuses/{sha}","languages_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/languages","stargazers_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/stargazers","contributors_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/contributors","subscribers_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/subscribers","subscription_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/subscription","commits_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/commits{/sha}","git_commits_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/git/commits{/sha}","comments_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/comments{/number}","issue_comment_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/comments{/number}","contents_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/contents/{+path}","compare_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/merges","archive_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/downloads","issues_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues{/number}","pulls_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls{/number}","milestones_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/milestones{/number}","notifications_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/labels{/name}","releases_url":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/releases{/id}","created_at":"2015-03-03T10:54:40Z","updated_at":"2015-04-10T15:28:48Z","pushed_at":"2015-04-10T15:28:47Z","git_url":"git://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams.git","ssh_url":"git@github.com:veda-consulting/uk.co.vedaconsulting.pcpteams.git","clone_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams.git","svn_url":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams","homepage":null,"size":2804,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166"},"html":{"href":"https://github.com/veda-consulting/uk.co.vedaconsulting.pcpteams/pull/166"},"issue":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/166"},"comments":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/issues/166/comments"},"review_comments":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166/comments"},"review_comment":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/pulls/166/commits"},"statuses":{"href":"https://api.github.com/repos/veda-consulting/uk.co.vedaconsulting.pcpteams/statuses/c827bd5d122d7674304ed89a6830dbdbc6111260"}}}}