diff --git a/interface/modules/custom_modules/oe-module-weno/scripts/weno_pharmacy_search.php b/interface/modules/custom_modules/oe-module-weno/scripts/weno_pharmacy_search.php index f549e7052a6..fd316ecc4ee 100644 --- a/interface/modules/custom_modules/oe-module-weno/scripts/weno_pharmacy_search.php +++ b/interface/modules/custom_modules/oe-module-weno/scripts/weno_pharmacy_search.php @@ -56,7 +56,7 @@ $weno_zipcode = $_GET['weno_zipcode'] ?? false ?: ''; $weno_only = $_GET['weno_only'] == 'true' ? 'True' : ''; $full_day = $_GET['full_day'] == 'true' ? 'Yes' : ''; - $weno_test_pharmacies = $_GET['test_pharmacy'] == 'true' ? 'True' : ''; + $weno_test_pharmacies = $_GET['test_pharmacy'] ?? '' == 'true' ? 'True' : ''; // mail order is special case. diff --git a/interface/modules/custom_modules/oe-module-weno/sql/1_0_0-to-2_0_0_upgrade.sql b/interface/modules/custom_modules/oe-module-weno/sql/1_0_0-to-2_0_0_upgrade.sql index 1e76c2d5c22..ffafeacef5c 100644 --- a/interface/modules/custom_modules/oe-module-weno/sql/1_0_0-to-2_0_0_upgrade.sql +++ b/interface/modules/custom_modules/oe-module-weno/sql/1_0_0-to-2_0_0_upgrade.sql @@ -27,7 +27,7 @@ CREATE TABLE `weno_pharmacy` ( `State_Wide_Mail_Order` varchar(15) NOT NULL, `Mail_Order_US_State_Serviced` varchar(255) DEFAULT NULL, `Mail_Order_ US_Territories_Serviced` varchar(255) DEFAULT NULL, - `On_WENO` tinytext DEFAULT NULL, + `On_WENO` varchar(10) DEFAULT NULL, `24HR` varchar(3) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ncpdp` (`NCPDP_safe`) @@ -49,12 +49,12 @@ CREATE TABLE `weno_assigned_pharmacy` ( #IfNotTable weno_download_log CREATE TABLE `weno_download_log` ( - `id` BIGINT(20) NOT NULL AUTO_INCREMENT, - `value` VARCHAR(63) NOT NULL, - `status` VARCHAR(255) NOT NULL, - `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `value` (`value`) + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `value` VARCHAR(63) NOT NULL, + `status` VARCHAR(255) NOT NULL, + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `value` (`value`) ) ENGINE = InnoDB; #EndIf diff --git a/interface/modules/custom_modules/oe-module-weno/src/Services/DownloadWenoPharmacies.php b/interface/modules/custom_modules/oe-module-weno/src/Services/DownloadWenoPharmacies.php index 6f8923d1d5a..a3e5c34cdcc 100644 --- a/interface/modules/custom_modules/oe-module-weno/src/Services/DownloadWenoPharmacies.php +++ b/interface/modules/custom_modules/oe-module-weno/src/Services/DownloadWenoPharmacies.php @@ -42,9 +42,10 @@ public function processWenoPharmacyCsv($filePath, bool $isInsertOnly = true): fa $sql = "TRUNCATE TABLE weno_pharmacy"; sqlStatement($sql); } - - // Database configuration. Create connection. - $connect = new mysqli($GLOBALS["host"], $GLOBALS["login"], $GLOBALS["pass"], $GLOBALS["dbase"]); + // Use existing connection. + // Compared to creating a new connection, this method is slower by 3 seconds. + // Using the sqlStatement() method is even slower by 10 seconds. That's 13 seconds slower overall. + $connect = $GLOBALS['dbh']; if ($connect->connect_error) { $wenoLog->insertWenoLog("pharmacy", "Connection Failed."); error_log("Connection failed: " . $connect->connect_error); @@ -140,7 +141,7 @@ public function processWenoPharmacyCsv($filePath, bool $isInsertOnly = true): fa } $connect->commit(); - $connect->close(); + // $connect->close(); } catch (Exception $e) { $connect->rollback(); error_log(text($e->getMessage())); diff --git a/interface/modules/custom_modules/oe-module-weno/src/Services/TransmitProperties.php b/interface/modules/custom_modules/oe-module-weno/src/Services/TransmitProperties.php index 8124b4471b2..626e98cff46 100644 --- a/interface/modules/custom_modules/oe-module-weno/src/Services/TransmitProperties.php +++ b/interface/modules/custom_modules/oe-module-weno/src/Services/TransmitProperties.php @@ -545,7 +545,6 @@ public function getWenoProviderId($id = null): mixed ON DUPLICATE KEY UPDATE `setting_value` = ?"; sqlQuery($sql, [$provider['weno_prov_id'], $id, $provider['weno_prov_id']]); } - $GLOBALS['weno_provider_uid'] = $GLOBALS['weno_prov_id'] = $provider['weno_prov_id']; // update users $sql = "INSERT INTO `users` (`weno_prov_id`, `id`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `weno_prov_id` = ?"; sqlQuery($sql, [$GLOBALS['weno_provider_uid'], $id, $GLOBALS['weno_provider_uid']]); diff --git a/interface/modules/custom_modules/oe-module-weno/src/Services/WenoValidate.php b/interface/modules/custom_modules/oe-module-weno/src/Services/WenoValidate.php index d0964eb6ef7..1cb1b7088e2 100644 --- a/interface/modules/custom_modules/oe-module-weno/src/Services/WenoValidate.php +++ b/interface/modules/custom_modules/oe-module-weno/src/Services/WenoValidate.php @@ -255,7 +255,6 @@ public function validateAdminCredentials($resetOnInvalid = false, $where = "pres if (!empty($newKey)) { // save new admin production key. $this->setNewEncryptionKey($newKey); - error_log(errorLogEscape("$where Encryption Verify returned Invalid Key. Attempted to reset key.")); $wenoLog = new WenoLogService(); $wenoLog->insertWenoLog(text("$where"), "reset_encryption_key"); } diff --git a/interface/modules/custom_modules/oe-module-weno/table.sql b/interface/modules/custom_modules/oe-module-weno/table.sql index 69f49dc7d68..ae3ccd7ec56 100644 --- a/interface/modules/custom_modules/oe-module-weno/table.sql +++ b/interface/modules/custom_modules/oe-module-weno/table.sql @@ -33,7 +33,7 @@ CREATE TABLE `weno_pharmacy` ( `State_Wide_Mail_Order` varchar(15) NOT NULL, `Mail_Order_US_State_Serviced` varchar(255) DEFAULT NULL, `Mail_Order_ US_Territories_Serviced` varchar(255) DEFAULT NULL, - `On_WENO` tinytext DEFAULT NULL, + `On_WENO` varchar(10) DEFAULT NULL, `24HR` varchar(3) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ncpdp` (`NCPDP_safe`) diff --git a/interface/modules/custom_modules/oe-module-weno/templates/indexrx.php b/interface/modules/custom_modules/oe-module-weno/templates/indexrx.php index 64f2aeac895..8ca1a5b04b8 100644 --- a/interface/modules/custom_modules/oe-module-weno/templates/indexrx.php +++ b/interface/modules/custom_modules/oe-module-weno/templates/indexrx.php @@ -16,6 +16,7 @@ require_once("$srcdir/patient.inc"); use OpenEMR\Common\Acl\AclMain; +use OpenEMR\Common\Crypto\CryptoGen; use OpenEMR\Common\Twig\TwigContainer; use OpenEMR\Core\Header; use OpenEMR\Modules\WenoModule\Services\PharmacyService; @@ -52,6 +53,8 @@ $isKey = $wenoValidate->validateAdminCredentials(true); */ +$cryptoGen = new CryptoGen(); + // set up the dependencies for the page. $pharmacyService = new PharmacyService(); $wenoProperties = new TransmitProperties(); @@ -63,13 +66,15 @@ $provider_name = $wenoProperties->getProviderName(); $patient_name = $wenoProperties->getPatientName(); $facility_name = $wenoProperties->getFacilityInfo(); - //set the url for the iframe $newRxUrl = "https://online.wenoexchange.com/en/NewRx/ComposeRx?useremail="; if ($urlParam == 'error') { //check to make sure there were no errors echo TransmitProperties::styleErrors(xlt("Cipher failure check encryption key")); exit; } + +$urlOut = $newRxUrl . urlencode($provider_info['email']) . "&data=" . urlencode($urlParam); + ?> @@ -107,15 +112,15 @@
- -