{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/comments/225216484","pull_request_review_id":164769820,"id":225216484,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTIxNjQ4NA==","diff_hunk":"@@ -95,48 +107,58 @@ export class AddForm extends React.Component {\n       drugInstructions,\n     } = this.state.fields;\n \n-    this.setState({\n-      draftOrder: {\n-        drugName: this.props.drugName,\n-        action: this.state.action,\n-        dose,\n-        dosingUnit,\n-        frequency,\n-        route,\n-        duration,\n-        durationUnit,\n-        dispensingUnit,\n-        dispensingQuantity,\n-        reason,\n-        previousOrder: this.state.previousOrder,\n-        drugInstructions,\n-        careSetting: this.props.careSetting.uuid,\n-        drug: this.props.drugUuid,\n-        orderer: this.props.session.currentProvider.uuid,\n-        dosingType: this.state.formType === 'Standard Dosage' ?\n-          'org.openmrs.SimpleDosingInstructions' :\n-          'org.openmrs.FreeTextDosingInstructions',\n-        type: \"drugorder\",\n-        orderNumber: (this.state.action === 'NEW') ? this.props.draftOrders.length :\n-          this.props.orderNumber,\n-      },\n-    }, () => {\n-      this.props.addDraftOrder(this.state.draftOrder);\n-      if (this.state.draftOrder.action === 'NEW') {\n-        this.props.setOrderAction('DRAFT', this.state.orderNumber);\n-      } else {\n-        this.props.setOrderAction('DRAFT_EDIT', this.props.orderNumber);\n-      }\n-    });\n-    this.props.selectDrugSuccess('');\n-    this.clearDrugForms();\n-    this.props.clearSearchField();\n-    if (this.props.activity === 'DRAFT_ORDER_EDIT') {\n-      this.props.setSelectedOrder({\n-        currentOrderType: this.props.currentOrderType,\n-        selectedOrder: null,\n-        activity: null,\n+    if (!this.checkIfDrugExist(this.props.drugName)) {\n+      const {\n+        previousOrder, formType, action, draftOrder,\n+      } = this.state;\n+      const {\n+        careSetting, drugUuid, session, draftOrders, orderNumber, currentOrderType,\n+      } = this.props;\n+      this.setState({\n+        draftOrder: {\n+          drugName: this.props.drugName,","path":"app/js/components/drugOrderEntry/addForm/AddForm.jsx","position":87,"original_position":87,"commit_id":"496157ef8b7e87c7d224a1be4b48c551b918ed6c","original_commit_id":"ad07674699513ed5f0de41e583b8dfc55c9e72bd","user":{"login":"dessHub","id":19705477,"node_id":"MDQ6VXNlcjE5NzA1NDc3","avatar_url":"https://avatars0.githubusercontent.com/u/19705477?v=4","gravatar_id":"","url":"https://api.github.com/users/dessHub","html_url":"https://github.com/dessHub","followers_url":"https://api.github.com/users/dessHub/followers","following_url":"https://api.github.com/users/dessHub/following{/other_user}","gists_url":"https://api.github.com/users/dessHub/gists{/gist_id}","starred_url":"https://api.github.com/users/dessHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dessHub/subscriptions","organizations_url":"https://api.github.com/users/dessHub/orgs","repos_url":"https://api.github.com/users/dessHub/repos","events_url":"https://api.github.com/users/dessHub/events{/privacy}","received_events_url":"https://api.github.com/users/dessHub/received_events","type":"User","site_admin":false},"body":"This ticket will take care of this.","created_at":"2018-10-15T15:43:14Z","updated_at":"2018-10-15T15:43:14Z","html_url":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199#discussion_r225216484","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/comments/225216484"},"html":{"href":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199#discussion_r225216484"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199"}},"in_reply_to_id":225143109},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199","id":222681186,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNjgxMTg2","html_url":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199","diff_url":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199.diff","patch_url":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/199","number":199,"state":"open","locked":false,"title":"OEUI-285: Validate if drug order is active","user":{"login":"dessHub","id":19705477,"node_id":"MDQ6VXNlcjE5NzA1NDc3","avatar_url":"https://avatars0.githubusercontent.com/u/19705477?v=4","gravatar_id":"","url":"https://api.github.com/users/dessHub","html_url":"https://github.com/dessHub","followers_url":"https://api.github.com/users/dessHub/followers","following_url":"https://api.github.com/users/dessHub/following{/other_user}","gists_url":"https://api.github.com/users/dessHub/gists{/gist_id}","starred_url":"https://api.github.com/users/dessHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dessHub/subscriptions","organizations_url":"https://api.github.com/users/dessHub/orgs","repos_url":"https://api.github.com/users/dessHub/repos","events_url":"https://api.github.com/users/dessHub/events{/privacy}","received_events_url":"https://api.github.com/users/dessHub/received_events","type":"User","site_admin":false},"body":"### **JIRA TICKET NAME**\r\n[OEUI-285: Validate if drug order is active](https://issues.openmrs.org/browse/OEUI-285) \r\n\r\n### **Summary**\r\n- I wrote a function to check if there is an active drug order before adding the drug order in the draft list. \r\n\r\n## I have checked that on this Pull request\r\n\r\n- [X] I can sucessfully create Drug orders\r\n- [X] I can sucessfully create Lab orders\r\n- [X] I can sucessfully search for drug orders\r\n","created_at":"2018-10-13T22:51:35Z","updated_at":"2018-10-15T15:43:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97c44dcffd06943b509d5501da1d997e87791217","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/199/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/statuses/496157ef8b7e87c7d224a1be4b48c551b918ed6c","head":{"label":"dessHub:OEUI-285","ref":"OEUI-285","sha":"496157ef8b7e87c7d224a1be4b48c551b918ed6c","user":{"login":"dessHub","id":19705477,"node_id":"MDQ6VXNlcjE5NzA1NDc3","avatar_url":"https://avatars0.githubusercontent.com/u/19705477?v=4","gravatar_id":"","url":"https://api.github.com/users/dessHub","html_url":"https://github.com/dessHub","followers_url":"https://api.github.com/users/dessHub/followers","following_url":"https://api.github.com/users/dessHub/following{/other_user}","gists_url":"https://api.github.com/users/dessHub/gists{/gist_id}","starred_url":"https://api.github.com/users/dessHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dessHub/subscriptions","organizations_url":"https://api.github.com/users/dessHub/orgs","repos_url":"https://api.github.com/users/dessHub/repos","events_url":"https://api.github.com/users/dessHub/events{/privacy}","received_events_url":"https://api.github.com/users/dessHub/received_events","type":"User","site_admin":false},"repo":{"id":151276548,"node_id":"MDEwOlJlcG9zaXRvcnkxNTEyNzY1NDg=","name":"openmrs-owa-orderentry","full_name":"dessHub/openmrs-owa-orderentry","private":false,"owner":{"login":"dessHub","id":19705477,"node_id":"MDQ6VXNlcjE5NzA1NDc3","avatar_url":"https://avatars0.githubusercontent.com/u/19705477?v=4","gravatar_id":"","url":"https://api.github.com/users/dessHub","html_url":"https://github.com/dessHub","followers_url":"https://api.github.com/users/dessHub/followers","following_url":"https://api.github.com/users/dessHub/following{/other_user}","gists_url":"https://api.github.com/users/dessHub/gists{/gist_id}","starred_url":"https://api.github.com/users/dessHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dessHub/subscriptions","organizations_url":"https://api.github.com/users/dessHub/orgs","repos_url":"https://api.github.com/users/dessHub/repos","events_url":"https://api.github.com/users/dessHub/events{/privacy}","received_events_url":"https://api.github.com/users/dessHub/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dessHub/openmrs-owa-orderentry","description":"Open Web Application for Order Entry","fork":true,"url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry","forks_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/forks","keys_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/teams","hooks_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/hooks","issue_events_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/issues/events{/number}","events_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/events","assignees_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/assignees{/user}","branches_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/branches{/branch}","tags_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/tags","blobs_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/statuses/{sha}","languages_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/languages","stargazers_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/stargazers","contributors_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/contributors","subscribers_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/subscribers","subscription_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/subscription","commits_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/contents/{+path}","compare_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/merges","archive_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/downloads","issues_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/issues{/number}","pulls_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/pulls{/number}","milestones_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/milestones{/number}","notifications_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/labels{/name}","releases_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/releases{/id}","deployments_url":"https://api.github.com/repos/dessHub/openmrs-owa-orderentry/deployments","created_at":"2018-10-02T15:19:36Z","updated_at":"2018-10-02T15:19:38Z","pushed_at":"2018-10-15T12:28:59Z","git_url":"git://github.com/dessHub/openmrs-owa-orderentry.git","ssh_url":"git@github.com:dessHub/openmrs-owa-orderentry.git","clone_url":"https://github.com/dessHub/openmrs-owa-orderentry.git","svn_url":"https://github.com/dessHub/openmrs-owa-orderentry","homepage":null,"size":1046,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openmrs:master","ref":"master","sha":"95ab30e38db877291b655517d794ac58ac43e3f5","user":{"login":"openmrs","id":860776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MDc3Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/860776?v=4","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":124887271,"node_id":"MDEwOlJlcG9zaXRvcnkxMjQ4ODcyNzE=","name":"openmrs-owa-orderentry","full_name":"openmrs/openmrs-owa-orderentry","private":false,"owner":{"login":"openmrs","id":860776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MDc3Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/860776?v=4","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openmrs/openmrs-owa-orderentry","description":"Open Web Application for Order Entry","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry","forks_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/deployments","created_at":"2018-03-12T12:41:06Z","updated_at":"2018-10-09T11:53:50Z","pushed_at":"2018-10-15T12:29:00Z","git_url":"git://github.com/openmrs/openmrs-owa-orderentry.git","ssh_url":"git@github.com:openmrs/openmrs-owa-orderentry.git","clone_url":"https://github.com/openmrs/openmrs-owa-orderentry.git","svn_url":"https://github.com/openmrs/openmrs-owa-orderentry","homepage":null,"size":1047,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":15,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199"},"html":{"href":"https://github.com/openmrs/openmrs-owa-orderentry/pull/199"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/199"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/issues/199/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/pulls/199/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-owa-orderentry/statuses/496157ef8b7e87c7d224a1be4b48c551b918ed6c"}},"author_association":"NONE"}}
{"actor":{"display_login":"dessHub"}}