Added option to not show sql queries on the screen
[openemr.git] / interface / soap_functions / soap_patientfullmedication.php
blob04cd44c8343a4a7297df4976b9602f937bd7dd93
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 $sanitize_all_escapes = true; // SANITIZE ALL ESCAPES
30 $fake_register_globals = false; // STOP FAKE REGISTER GLOBALS
32 require_once(__DIR__.'/../globals.php');
33 require_once($GLOBALS['fileroot'].'/interface/eRxGlobals.php');
34 require_once($GLOBALS['fileroot'].'/interface/eRxStore.php');
35 require_once($GLOBALS['srcdir'].'/xmltoarray_parser_htmlfix.php');
36 require_once($GLOBALS['srcdir'].'/lists.inc');
37 require_once($GLOBALS['srcdir'].'/amc.php');
38 require_once($GLOBALS['fileroot'].'/interface/eRxSOAP.php');
39 require_once($GLOBALS['fileroot'].'/interface/eRx_xml.php');
41 set_time_limit(0);
43 $eRxSOAP = new eRxSOAP;
44 $eRxSOAP->setGlobals(new eRxGlobals($GLOBALS))
45 ->setStore(new eRxStore)
46 ->setAuthUserId($_SESSION['authUserID']);
48 if(array_key_exists('patient', $_REQUEST)) {
49 $eRxSOAP->setPatientId($_REQUEST['patient']);
50 } elseif(array_key_exists('pid', $GLOBALS)) {
51 $eRxSOAP->setPatientId($GLOBALS['pid']);
54 if((array_key_exists('refresh', $_REQUEST)
55 && $_REQUEST['refresh'] == 'true')
56 || $eRxSOAP->elapsedTTL(eRxSOAP::ACTION_MEDICATIONS)
57 || $eRxSOAP->checkPatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_PRESS)
58 ) {
59 $insertedRows = $eRxSOAP->insertUpdateMedications();
61 $message = $insertedRows
62 ? xl('Prescription History import successfully completed')
63 : xl('Nothing to import for Prescription');
65 $eRxSOAP->updatePatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_IMPORT)
66 ->updateTTL(eRxSOAP::ACTION_MEDICATIONS);
67 } else {
68 $message = xl('Import deferred for time-to-live');
71 echo text($message);