4 * interface/soap_functions/soap_patientfullmedication.php Check current
5 * patients Medications TTL status and perform a SOAP call to NewCrop if
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>.
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');
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']);
52 (array_key_exists('refresh', $_REQUEST)
53 && $_REQUEST['refresh'] == 'true')
54 ||
$eRxSOAP->elapsedTTL(eRxSOAP
::ACTION_MEDICATIONS
)
55 ||
$eRxSOAP->checkPatientImportStatus(eRxSOAP
::FLAG_PRESCRIPTION_PRESS
)
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
);
66 $message = xl('Import deferred for time-to-live');