{"action":"created","comment":{"url":"https://api.github.com/repos/ctsit/send_rx/pulls/comments/129392917","pull_request_review_id":52161419,"id":129392917,"diff_hunk":"@@ -373,3 +373,49 @@ function send_rx_get_user_pharmacies($project_id, $username = USERID, $project_t\n \n     return $pharmacies;\n }\n+\n+function send_rx_get_pharmacy_users($project_id, $pharmacy_id, $role = null, $project_type = 'patient') {\n+    if($project_type == 'patient'){\n+        if(!$config = send_rx_get_project_config($project_id, $project_type)) {\n+            return false;\n+        }\n+\n+        // Gets pharmacy project from the patient project.\n+        $project_id = $config->targetProjectId;\n+        $project_type = 'pharmacy';\n+    }\n+\n+    // Checking if pharmacy project is ok.\n+    if (!send_rx_get_project_config($project_id, $project_type)) {\n+        return false;\n+    }\n+\n+    $users = array();\n+\n+    // ToDo: Get 'send_rx_person_role' field for each user.\n+    $data = REDCap::getData($project_id, 'array', null, null);\n+    foreach ($data as $pharmacy_id => $pharmacy_info){\n+        if (empty($pharmacy_info['repeat_instances'])) {\n+            continue;\n+        }\n+\n+        $event_id = key($pharmacy_info['repeat_instances']);\n+        if (empty($pharmacy_info['repeat_instances'][$event_id]['prescribers'])) {\n+            continue;\n+        }\n+\n+        if(!empty($role)){\n+            foreach ($pharmacy_info['repeat_instances'][$event_id]['prescribers'] as $prescriber_info) {\n+                if($prescriber_info['send_rx_person_role'] == $role){\n+                    $users[] = $prescriber_info;\n+                }\n+            }\n+            return $users;\n+        }\n+\n+        $users[] = $pharmacy_info['repeat_instances'][$event_id]['prescribers'];","path":"send_rx_functions.php","position":44,"original_position":44,"commit_id":"f9ddc76c4c92993c7fb4aa6da6d662d169af52ca","original_commit_id":"f9ddc76c4c92993c7fb4aa6da6d662d169af52ca","user":{"login":"prasadlan","id":24977749,"avatar_url":"https://avatars2.githubusercontent.com/u/24977749?v=4","gravatar_id":"","url":"https://api.github.com/users/prasadlan","html_url":"https://github.com/prasadlan","followers_url":"https://api.github.com/users/prasadlan/followers","following_url":"https://api.github.com/users/prasadlan/following{/other_user}","gists_url":"https://api.github.com/users/prasadlan/gists{/gist_id}","starred_url":"https://api.github.com/users/prasadlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasadlan/subscriptions","organizations_url":"https://api.github.com/users/prasadlan/orgs","repos_url":"https://api.github.com/users/prasadlan/repos","events_url":"https://api.github.com/users/prasadlan/events{/privacy}","received_events_url":"https://api.github.com/users/prasadlan/received_events","type":"User","site_admin":false},"body":"Replaced hardcoding. Leaving prescriber_id as is for now. We'll change all 'prescriber_id' fields once the final name is finalized. Eg: user_id, person_id ?","created_at":"2017-07-25T18:50:10Z","updated_at":"2017-07-25T18:50:10Z","html_url":"https://github.com/ctsit/send_rx/pull/30#discussion_r129392917","pull_request_url":"https://api.github.com/repos/ctsit/send_rx/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/comments/129392917"},"html":{"href":"https://github.com/ctsit/send_rx/pull/30#discussion_r129392917"},"pull_request":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/ctsit/send_rx/pulls/30","id":132338612,"html_url":"https://github.com/ctsit/send_rx/pull/30","diff_url":"https://github.com/ctsit/send_rx/pull/30.diff","patch_url":"https://github.com/ctsit/send_rx/pull/30.patch","issue_url":"https://api.github.com/repos/ctsit/send_rx/issues/30","number":30,"state":"open","locked":false,"title":"Develop","user":{"login":"prasadlan","id":24977749,"avatar_url":"https://avatars2.githubusercontent.com/u/24977749?v=4","gravatar_id":"","url":"https://api.github.com/users/prasadlan","html_url":"https://github.com/prasadlan","followers_url":"https://api.github.com/users/prasadlan/followers","following_url":"https://api.github.com/users/prasadlan/following{/other_user}","gists_url":"https://api.github.com/users/prasadlan/gists{/gist_id}","starred_url":"https://api.github.com/users/prasadlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasadlan/subscriptions","organizations_url":"https://api.github.com/users/prasadlan/orgs","repos_url":"https://api.github.com/users/prasadlan/repos","events_url":"https://api.github.com/users/prasadlan/events{/privacy}","received_events_url":"https://api.github.com/users/prasadlan/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-25T17:37:19Z","updated_at":"2017-07-25T18:50:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6badc3eb863a202993bc8428ba9d13d46ab8dea9","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ctsit/send_rx/pulls/30/commits","review_comments_url":"https://api.github.com/repos/ctsit/send_rx/pulls/30/comments","review_comment_url":"https://api.github.com/repos/ctsit/send_rx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ctsit/send_rx/issues/30/comments","statuses_url":"https://api.github.com/repos/ctsit/send_rx/statuses/f9ddc76c4c92993c7fb4aa6da6d662d169af52ca","head":{"label":"prasadlan:develop","ref":"develop","sha":"f9ddc76c4c92993c7fb4aa6da6d662d169af52ca","user":{"login":"prasadlan","id":24977749,"avatar_url":"https://avatars2.githubusercontent.com/u/24977749?v=4","gravatar_id":"","url":"https://api.github.com/users/prasadlan","html_url":"https://github.com/prasadlan","followers_url":"https://api.github.com/users/prasadlan/followers","following_url":"https://api.github.com/users/prasadlan/following{/other_user}","gists_url":"https://api.github.com/users/prasadlan/gists{/gist_id}","starred_url":"https://api.github.com/users/prasadlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasadlan/subscriptions","organizations_url":"https://api.github.com/users/prasadlan/orgs","repos_url":"https://api.github.com/users/prasadlan/repos","events_url":"https://api.github.com/users/prasadlan/events{/privacy}","received_events_url":"https://api.github.com/users/prasadlan/received_events","type":"User","site_admin":false},"repo":{"id":97514868,"name":"send_rx","full_name":"prasadlan/send_rx","owner":{"login":"prasadlan","id":24977749,"avatar_url":"https://avatars2.githubusercontent.com/u/24977749?v=4","gravatar_id":"","url":"https://api.github.com/users/prasadlan","html_url":"https://github.com/prasadlan","followers_url":"https://api.github.com/users/prasadlan/followers","following_url":"https://api.github.com/users/prasadlan/following{/other_user}","gists_url":"https://api.github.com/users/prasadlan/gists{/gist_id}","starred_url":"https://api.github.com/users/prasadlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasadlan/subscriptions","organizations_url":"https://api.github.com/users/prasadlan/orgs","repos_url":"https://api.github.com/users/prasadlan/repos","events_url":"https://api.github.com/users/prasadlan/events{/privacy}","received_events_url":"https://api.github.com/users/prasadlan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prasadlan/send_rx","description":"REDCap extension to create and send prescriptions","fork":true,"url":"https://api.github.com/repos/prasadlan/send_rx","forks_url":"https://api.github.com/repos/prasadlan/send_rx/forks","keys_url":"https://api.github.com/repos/prasadlan/send_rx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prasadlan/send_rx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prasadlan/send_rx/teams","hooks_url":"https://api.github.com/repos/prasadlan/send_rx/hooks","issue_events_url":"https://api.github.com/repos/prasadlan/send_rx/issues/events{/number}","events_url":"https://api.github.com/repos/prasadlan/send_rx/events","assignees_url":"https://api.github.com/repos/prasadlan/send_rx/assignees{/user}","branches_url":"https://api.github.com/repos/prasadlan/send_rx/branches{/branch}","tags_url":"https://api.github.com/repos/prasadlan/send_rx/tags","blobs_url":"https://api.github.com/repos/prasadlan/send_rx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prasadlan/send_rx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prasadlan/send_rx/git/refs{/sha}","trees_url":"https://api.github.com/repos/prasadlan/send_rx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prasadlan/send_rx/statuses/{sha}","languages_url":"https://api.github.com/repos/prasadlan/send_rx/languages","stargazers_url":"https://api.github.com/repos/prasadlan/send_rx/stargazers","contributors_url":"https://api.github.com/repos/prasadlan/send_rx/contributors","subscribers_url":"https://api.github.com/repos/prasadlan/send_rx/subscribers","subscription_url":"https://api.github.com/repos/prasadlan/send_rx/subscription","commits_url":"https://api.github.com/repos/prasadlan/send_rx/commits{/sha}","git_commits_url":"https://api.github.com/repos/prasadlan/send_rx/git/commits{/sha}","comments_url":"https://api.github.com/repos/prasadlan/send_rx/comments{/number}","issue_comment_url":"https://api.github.com/repos/prasadlan/send_rx/issues/comments{/number}","contents_url":"https://api.github.com/repos/prasadlan/send_rx/contents/{+path}","compare_url":"https://api.github.com/repos/prasadlan/send_rx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prasadlan/send_rx/merges","archive_url":"https://api.github.com/repos/prasadlan/send_rx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prasadlan/send_rx/downloads","issues_url":"https://api.github.com/repos/prasadlan/send_rx/issues{/number}","pulls_url":"https://api.github.com/repos/prasadlan/send_rx/pulls{/number}","milestones_url":"https://api.github.com/repos/prasadlan/send_rx/milestones{/number}","notifications_url":"https://api.github.com/repos/prasadlan/send_rx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prasadlan/send_rx/labels{/name}","releases_url":"https://api.github.com/repos/prasadlan/send_rx/releases{/id}","deployments_url":"https://api.github.com/repos/prasadlan/send_rx/deployments","created_at":"2017-07-17T19:35:21Z","updated_at":"2017-07-05T20:15:01Z","pushed_at":"2017-07-25T17:41:15Z","git_url":"git://github.com/prasadlan/send_rx.git","ssh_url":"git@github.com:prasadlan/send_rx.git","clone_url":"https://github.com/prasadlan/send_rx.git","svn_url":"https://github.com/prasadlan/send_rx","homepage":null,"size":53425,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"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":"ctsit:develop","ref":"develop","sha":"41bf661a69ee414061d6085f26c9949369b0a915","user":{"login":"ctsit","id":6988716,"avatar_url":"https://avatars0.githubusercontent.com/u/6988716?v=4","gravatar_id":"","url":"https://api.github.com/users/ctsit","html_url":"https://github.com/ctsit","followers_url":"https://api.github.com/users/ctsit/followers","following_url":"https://api.github.com/users/ctsit/following{/other_user}","gists_url":"https://api.github.com/users/ctsit/gists{/gist_id}","starred_url":"https://api.github.com/users/ctsit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctsit/subscriptions","organizations_url":"https://api.github.com/users/ctsit/orgs","repos_url":"https://api.github.com/users/ctsit/repos","events_url":"https://api.github.com/users/ctsit/events{/privacy}","received_events_url":"https://api.github.com/users/ctsit/received_events","type":"Organization","site_admin":false},"repo":{"id":96357620,"name":"send_rx","full_name":"ctsit/send_rx","owner":{"login":"ctsit","id":6988716,"avatar_url":"https://avatars0.githubusercontent.com/u/6988716?v=4","gravatar_id":"","url":"https://api.github.com/users/ctsit","html_url":"https://github.com/ctsit","followers_url":"https://api.github.com/users/ctsit/followers","following_url":"https://api.github.com/users/ctsit/following{/other_user}","gists_url":"https://api.github.com/users/ctsit/gists{/gist_id}","starred_url":"https://api.github.com/users/ctsit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctsit/subscriptions","organizations_url":"https://api.github.com/users/ctsit/orgs","repos_url":"https://api.github.com/users/ctsit/repos","events_url":"https://api.github.com/users/ctsit/events{/privacy}","received_events_url":"https://api.github.com/users/ctsit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ctsit/send_rx","description":"REDCap extension to create and send prescriptions","fork":false,"url":"https://api.github.com/repos/ctsit/send_rx","forks_url":"https://api.github.com/repos/ctsit/send_rx/forks","keys_url":"https://api.github.com/repos/ctsit/send_rx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctsit/send_rx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctsit/send_rx/teams","hooks_url":"https://api.github.com/repos/ctsit/send_rx/hooks","issue_events_url":"https://api.github.com/repos/ctsit/send_rx/issues/events{/number}","events_url":"https://api.github.com/repos/ctsit/send_rx/events","assignees_url":"https://api.github.com/repos/ctsit/send_rx/assignees{/user}","branches_url":"https://api.github.com/repos/ctsit/send_rx/branches{/branch}","tags_url":"https://api.github.com/repos/ctsit/send_rx/tags","blobs_url":"https://api.github.com/repos/ctsit/send_rx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctsit/send_rx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctsit/send_rx/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctsit/send_rx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctsit/send_rx/statuses/{sha}","languages_url":"https://api.github.com/repos/ctsit/send_rx/languages","stargazers_url":"https://api.github.com/repos/ctsit/send_rx/stargazers","contributors_url":"https://api.github.com/repos/ctsit/send_rx/contributors","subscribers_url":"https://api.github.com/repos/ctsit/send_rx/subscribers","subscription_url":"https://api.github.com/repos/ctsit/send_rx/subscription","commits_url":"https://api.github.com/repos/ctsit/send_rx/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctsit/send_rx/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctsit/send_rx/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctsit/send_rx/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctsit/send_rx/contents/{+path}","compare_url":"https://api.github.com/repos/ctsit/send_rx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctsit/send_rx/merges","archive_url":"https://api.github.com/repos/ctsit/send_rx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctsit/send_rx/downloads","issues_url":"https://api.github.com/repos/ctsit/send_rx/issues{/number}","pulls_url":"https://api.github.com/repos/ctsit/send_rx/pulls{/number}","milestones_url":"https://api.github.com/repos/ctsit/send_rx/milestones{/number}","notifications_url":"https://api.github.com/repos/ctsit/send_rx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctsit/send_rx/labels{/name}","releases_url":"https://api.github.com/repos/ctsit/send_rx/releases{/id}","deployments_url":"https://api.github.com/repos/ctsit/send_rx/deployments","created_at":"2017-07-05T20:15:01Z","updated_at":"2017-07-05T20:15:01Z","pushed_at":"2017-07-25T18:20:10Z","git_url":"git://github.com/ctsit/send_rx.git","ssh_url":"git@github.com:ctsit/send_rx.git","clone_url":"https://github.com/ctsit/send_rx.git","svn_url":"https://github.com/ctsit/send_rx","homepage":null,"size":53435,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/30"},"html":{"href":"https://github.com/ctsit/send_rx/pull/30"},"issue":{"href":"https://api.github.com/repos/ctsit/send_rx/issues/30"},"comments":{"href":"https://api.github.com/repos/ctsit/send_rx/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ctsit/send_rx/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/ctsit/send_rx/statuses/f9ddc76c4c92993c7fb4aa6da6d662d169af52ca"}}}}
{"actor":{"display_login":"prasadlan"}}