Compact css tweak
[openemr.git] / interface / soap_functions / soap_patientfullmedication.php
blobc884a21bcb9e75a3930281c0918e31a8d619130d
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');
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 $eRxSOAP->setGlobals(new eRxGlobals($GLOBALS))
41 ->setStore(new eRxStore)
42 ->setAuthUserId($_SESSION['authUserID']);
44 if (array_key_exists('patient', $_REQUEST)) {
45 $eRxSOAP->setPatientId($_REQUEST['patient']);
46 } elseif (array_key_exists('pid', $GLOBALS)) {
47 $eRxSOAP->setPatientId($GLOBALS['pid']);
50 if ((array_key_exists('refresh', $_REQUEST)
51 && $_REQUEST['refresh'] == 'true')
52 || $eRxSOAP->elapsedTTL(eRxSOAP::ACTION_MEDICATIONS)
53 || $eRxSOAP->checkPatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_PRESS)
54 ) {
55 $insertedRows = $eRxSOAP->insertUpdateMedications();
57 $message = $insertedRows
58 ? xl('Prescription History import successfully completed')
59 : xl('Nothing to import for Prescription');
61 $eRxSOAP->updatePatientImportStatus(eRxSOAP::FLAG_PRESCRIPTION_IMPORT)
62 ->updateTTL(eRxSOAP::ACTION_MEDICATIONS);
63 } else {
64 $message = xl('Import deferred for time-to-live');
67 echo text($message);