fix: Update patient_tracker.php (#6595)
[openemr.git] / interface / soap_functions / soap_patientfullmedication.php
blob4fc028b6262d1e01431e1dd9c219cdc937dce1f9
1 <?php
3 /**
4 * interface/soap_functions/soap_patientfullmedication.php Check current
5 * patients Medications TTL status and perform a SOAP call to NewCrop if
6 * elapsed.
8 * Copyright (C) 2011 ZMG LLC <sam@zhservices.com>
10 * LICENSE: This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 3 of the License, or (at your option) any
13 * later version. This program is distributed in the hope that it will be
14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details. You should have received a copy of the GNU
17 * General Public License along with this program.
18 * If not, see <http://opensource.org/licenses/gpl-license.php>.
20 * @package OpenEMR
21 * @subpackage NewCrop
22 * @author Eldho Chacko <eldho@zhservices.com>
23 * @author Vinish K <vinish@zhservices.com>
24 * @author Sam Likins <sam.likins@wsi-services.com>
25 * @link http://www.open-emr.org
28 require_once(__DIR__ . '/../globals.php');
29 require_once($GLOBALS['fileroot'] . '/interface/eRxGlobals.php');
30 require_once($GLOBALS['fileroot'] . '/interface/eRxStore.php');
31 require_once($GLOBALS['srcdir'] . '/xmltoarray_parser_htmlfix.php');
32 require_once($GLOBALS['srcdir'] . '/lists.inc.php');
33 require_once($GLOBALS['srcdir'] . '/amc.php');
34 require_once($GLOBALS['fileroot'] . '/interface/eRxSOAP.php');
35 require_once($GLOBALS['fileroot'] . '/interface/eRx_xml.php');
37 set_time_limit(0);
39 $eRxSOAP = new eRxSOAP();
40 $GLOBALS_REF = $GLOBALS;
41 $eRxSOAP->setGlobals(new eRxGlobals($GLOBALS_REF))
42 ->setStore(new eRxStore())
43 ->setAuthUserId($_SESSION['authUserID']);
45 if (array_key_exists('patient', $_REQUEST)) {
46 $eRxSOAP->setPatientId($_REQUEST['patient']);
47 } elseif (array_key_exists('pid', $GLOBALS)) {
48 $eRxSOAP->setPatientId($GLOBALS['pid']);
51 if (
52 (array_key_exists('refresh', $_REQUEST)
53 && $_REQUEST['refresh'] == 'true')
54 || $eRxSOAP->elapsedTTL(eRxSOAP::ACTION_MEDICATIONS)
55 || $eRxSOAP->checkPatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_PRESS)
56 ) {
57 $insertedRows = $eRxSOAP->insertUpdateMedications();
59 $message = $insertedRows
60 ? xl('Prescription History import successfully completed')
61 : xl('Nothing to import for Prescription');
63 $eRxSOAP->updatePatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_IMPORT)
64 ->updateTTL(eRxSOAP::ACTION_MEDICATIONS);
65 } else {
66 $message = xl('Import deferred for time-to-live');
69 echo text($message);