feat: show collection balance in billing widget (#7454)
[openemr.git] / interface / soap_functions / soap_allergy.php
blobb396db78d3b7708b82514b84fc4499d0c867a062
1 <?php
3 /**
4 * interface/soap_functions/soap_allergy.php Check current patients Allergy TTL
5 * status and perform a SOAP call to NewCrop if elapsed.
7 * Copyright (C) 2011 ZMG LLC <sam@zhservices.com>
9 * LICENSE: This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 3 of the License, or (at your option) any
12 * later version. This program is distributed in the hope that it will be
13 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 * Public License for more details. You should have received a copy of the GNU
16 * General Public License along with this program.
17 * If not, see <http://opensource.org/licenses/gpl-license.php>.
19 * @package OpenEMR
20 * @subpackage NewCrop
21 * @author Eldho Chacko <eldho@zhservices.com>
22 * @author Vinish K <vinish@zhservices.com>
23 * @author Sam Likins <sam.likins@wsi-services.com>
24 * @link http://www.open-emr.org
27 require_once(__DIR__ . '/../globals.php');
28 require_once($GLOBALS['fileroot'] . '/interface/eRxGlobals.php');
29 require_once($GLOBALS['fileroot'] . '/interface/eRxStore.php');
30 require_once($GLOBALS['srcdir'] . '/xmltoarray_parser_htmlfix.php');
31 require_once($GLOBALS['srcdir'] . '/lists.inc.php');
32 require_once($GLOBALS['srcdir'] . '/amc.php');
33 require_once($GLOBALS['fileroot'] . '/interface/eRxSOAP.php');
34 require_once($GLOBALS['fileroot'] . '/interface/eRx_xml.php');
36 set_time_limit(0);
38 $eRxSOAP = new eRxSOAP();
39 $GLOBALS_REF = $GLOBALS;
40 $eRxSOAP->setGlobals(new eRxGlobals($GLOBALS_REF))
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 (
51 (array_key_exists('refresh', $_REQUEST)
52 && $_REQUEST['refresh'] == 'true')
53 || $eRxSOAP->elapsedTTL(eRxSOAP::ACTION_ALLERGIES)
54 || $eRxSOAP->checkPatientImportStatus(eRxSOAP::FLAG_ALLERGY_PRESS)
55 ) {
56 $eRxSOAP->insertUpdateAllergies();
58 $message = $eRxSOAP->updateUploadedErx()
59 ? xl('Allergy import successfully completed')
60 : xl('Nothing to import for Allergy');
62 $eRxSOAP->updatePatientImportStatus(eRxSOAP::FLAG_ALLERGY_IMPORT)
63 ->updateTTL(eRxSOAP::ACTION_ALLERGIES);
64 } else {
65 $message = xl('Import deferred for time-to-live');
68 echo text($message);