fix: Update patient_tracker.php (#6595)
[openemr.git] / interface / eRxGlobals.php
bloba29b3574d022779f3fddb8d43722004d072fe702
1 <?php
3 /**
4 * interface/eRxGlobals.php Functions for retrieving NewCrop global configurations.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Sam Likins <sam.likins@wsi-services.com>
9 * @copyright Copyright (c) 2015 Sam Likins <sam.likins@wsi-services.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 use OpenEMR\Common\Crypto\CryptoGen;
14 use OpenEMR\Services\VersionService;
16 class eRxGlobals
18 private $configuration;
20 /**
21 * Construct eRxGlobals optionally providing an array of configurations to use
22 * @param array|null &$configuration [optional] Array of configurations to use
24 public function __construct(&$configuration = null)
26 if (is_array($configuration)) {
27 $this->setGlobals($configuration);
31 /**
32 * Set the configuration array for use in eRxGlobals
33 * @param array &$configuration Array of configurations to use
35 public function setGlobals(&$configuration)
37 $this->configuration =& $configuration;
39 return $this;
42 /**
43 * Return the value stored in configurations specified by the key
44 * @param string $key Configuration array key
45 * @return mixed Configuration specified by the key
47 public function getGlobalValue($key)
49 if (array_key_exists($key, $this->configuration)) {
50 return $this->configuration[$key];
54 /**
55 * Return the version of OpenEMR
56 * @return string OpenEMR version
58 public function getOpenEMRVersion()
60 return (new VersionService())->asString();
63 /**
64 * Return the OpenEMR site directory
65 * @return string OpenEMR site directory
67 public function getOpenEMRSiteDirectory()
69 return $this->getGlobalValue('OE_SITE_DIR');
72 /**
73 * Return enable state for NewCrop eRx service
74 * @return boolean NewCrop eRx service enabled state
76 public function getEnabled()
78 return $this->getGlobalValue('erx_enable');
81 /**
82 * Return the NewCrop eRx requests URL
83 * @return string URL for NewCrop eRx requests
85 public function getPath()
87 return $this->getGlobalValue('erx_newcrop_path');
90 /**
91 * Return the NewCrop eRx service URLs
92 * @return array URLs for NewCrop eRx services: index [ 0 = Update, 1 = Patient ]
94 public function getSoapPaths()
96 return explode(';', $this->getGlobalValue('erx_newcrop_path_soap'));
99 /**
100 * Return the NewCrop eRx allergies time-to-live
101 * @return integer Time-to-live in seconds for NewCrop eRx allergies
103 public function getTTLSoapAllergies()
105 return $this->getGlobalValue('erx_soap_ttl_allergies');
109 * Return the NewCrop eRx medications time-to-live
110 * @return integer Time-to-live in seconds for NewCrop eRx medications
112 public function getTTLSoapMedications()
114 return $this->getGlobalValue('erx_soap_ttl_medications');
118 * Return the NewCrop eRx partner name for credentials
119 * @return string Partner name for credentials
121 public function getPartnerName()
123 return $this->getGlobalValue('erx_account_partner_name');
127 * Return the NewCrop eRx account name for credentials
128 * @return string Account name for credentials
130 public function getAccountName()
132 return $this->getGlobalValue('erx_account_name');
136 * Return the NewCrop eRx password for credentials
137 * @return string Password for credentials
139 public function getAccountPassword()
141 $cryptoGen = new CryptoGen();
142 return $cryptoGen->decryptStandard($this->getGlobalValue('erx_account_password'));
146 * Return the NewCrop eRx account Id for credentials
147 * @return string Account Id for credentials
149 public function getAccountId()
151 return $this->getGlobalValue('erx_account_id');
155 * Return enable state for NewCrop eRx only upload prescriptions
156 * @return boolean NewCrop eRx only upload prescriptions enabled state
158 public function getUploadActive()
160 return $this->getGlobalValue('erx_upload_active');
164 * Return enable state for NewCrop eRx import status message
165 * @return boolean NewCrop eRx import status message enabled state
167 public function getImportStatusMessage()
169 return $this->getGlobalValue('erx_import_status_message');
173 * Return enable state for NewCrop eRx display medications uploaded
174 * @return boolean NewCrop eRx display medications uploaded enabled state
176 public function getDisplayMedication()
178 return $this->getGlobalValue('erx_medication_display');
182 * Return enable state for NewCrop eRx display allergies uploaded
183 * @return boolean NewCrop eRx display allergies uploaded enabled state
185 public function getDisplayAllergy()
187 return $this->getGlobalValue('erx_allergy_display');
191 * Return NewCrop eRx default patient country code
192 * @return string NewCrop eRx default patient country code
194 public function getDefaultPatientCountry()
196 return $this->getGlobalValue('erx_default_patient_country');
200 * Return array containing NewCrop eRx credentials
201 * @return array NewCrop eRx credentials: index [ 0 = Partner Name, 1 = Account Name, 2 = Password ]
203 public function getCredentials()
205 return array(
206 $this->getPartnerName(),
207 $this->getAccountName(),
208 $this->getAccountPassword(),
213 * Return Debug NewCrop eRx settings
214 * @return integer Debug settings: flags [ 1 = XML, 2 = RESULT ]
216 public function getDebugSetting()
218 return $this->getGlobalValue('erx_debug_setting');