Skip to content

Commit

Permalink
Weno bug fixes (openemr#7198)
Browse files Browse the repository at this point in the history
* Weno bug fixes
- rename class file because of case difference. windows doesn't care but linux does

* -Weno Management download fixes.
- wrong global.php path
- using short codes is a no no
- add a confirm warning to pharmacy download.

* - Fix demographic Coices pharmacy search
- somecode cleanup
  • Loading branch information
sjpadgett authored Jan 31, 2024
1 parent 501cfa7 commit 5a7dfb8
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Disable PHP timeout
@ini_set('max_execution_time', '0');

require_once dirname(__DIR__, 5) . "/globals.php";
require_once dirname(__DIR__, 4) . "/globals.php";

use OpenEMR\Common\Logging\EventAuditLogger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
$sql = "SELECT Business_Name, state, ncpdp, city, address_line_1 " .
"FROM weno_pharmacy WHERE Business_Name LIKE ?";

$weno_coverage = $_GET['coverage'] ? $_GET['coverage'] : '';
$weno_state = $_GET['weno_state'] ? $_GET['weno_state'] : '';
$weno_city = $_GET['weno_city'] ? $_GET['weno_city'] : '';
$weno_coverage = $_GET['coverage'] ?: '';
$weno_state = $_GET['weno_state'] ?: '';
$weno_city = $_GET['weno_city'] ?: '';
$full_day = $_GET['full_day'] ? 'Yes' : '';
$weno_only = $_GET['weno_only'] ? 'True' : '';
$weno_zipcode = $_GET['weno_zipcode'] ? $_GET['weno_zipcode'] : '';
$weno_zipcode = $_GET['weno_zipcode'] ?: '';
$weno_test_pharmacies = $_GET['test_pharmacy'] ? 'True' : '';


Expand Down Expand Up @@ -103,24 +103,24 @@
}

if (isset($_GET['searchFor']) && $_GET['searchFor'] == 'weno_drop') {
$term = filter_input(INPUT_GET, "term");
$val = '%' . $term . '%';
$params[] = $val;

$sql = "SELECT Business_Name, state, ncpdp, city, address_line_1 " .
"FROM weno_pharmacy WHERE";
"FROM weno_pharmacy WHERE 1=1";

$weno_coverage = $_GET['coverage'] ? $_GET['coverage'] : '';
$weno_state = $_GET['weno_state'] ? $_GET['weno_state'] : '';
$weno_city = $_GET['weno_city'] ? $_GET['weno_city'] : '';
$weno_coverage = $_GET['coverage'] ?: '';
$weno_state = $_GET['weno_state'] ?: '';
$weno_city = $_GET['weno_city'] ?: '';
$full_day = $_GET['full_day'] ? 'Yes' : '';
$weno_zipcode = $_GET['weno_zipcode'] ? $_GET['weno_zipcode'] : '';
$weno_test_pharmacies = $_GET['test_pharmacy'] ? 'True' : '';
$weno_zipcode = $_GET['weno_zipcode'] ?: '';
$weno_test_pharmacies = $_GET['test_pharmacy'] == 'true' ? 'True' : '';

if (!empty($weno_state)) {
$sql .= " state = ?";
$sql .= " AND state = ?";
$params[] = $weno_state;
}
if (!empty($weno_zipcode)) {
$sql .= " AND ZipCode = ?";
$params[] = $weno_zipcode;
}
if (!empty($weno_coverage)) {
$sql .= " AND state_wide_mail_order = ?";
$params[] = $weno_coverage;
Expand All @@ -133,10 +133,6 @@
$sql .= " AND 24HR = ?";
$params[] = $full_day;
}
if (!empty($weno_zipcode)) {
$sql .= " AND ZipCode = ?";
$params[] = $weno_zipcode;
}
if (!empty($weno_test_pharmacies)) {
$sql .= " AND test_pharmacy = ?";
$params[] = $weno_test_pharmacies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ public function __construct()

public function getUserIdByWenoId($external_provider_id)
{
// This is important so a user is set in prescription table.
$provider = sqlQuery("SELECT id FROM users WHERE weno_prov_id = ? ", array($external_provider_id));
if ($provider) {
return $provider['id'];
} else {
return null;
// logged in user is auth weno user so let's ensure a user is set.
return $_SESSION["authUserID"] ?? null;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function insertPharmacies($insertdata)
$insertdata['pharmacy_phone'],
$insertdata['on_weno'],
$insertdata['test_pharmacy'],
$insertdata['state_wide_mail'],
$insertdata['state_wide_mail'] ?? '',
$insertdata['fullDay'],
]);
} catch (Exception $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public function __construct()
{
}

/**
* @param $csvFile
* @param $files
* @return string|void
*/
public function importPharmacy($csvFile, $files)
{
$insertPharmacy = new PharmacyService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ function activateFacility(){
}

function downloadPharmacies(){
if (!window.confirm(jsText("This download may take several minutes. Do you want to continue?"))) {
return false;
}
$('#notch-pharm').removeClass("hide");
$('#pharm-btn').attr("disabled", true);
$.ajax({
url: "<? echo $GLOBALS['webroot']; ?>" + "/interface/modules/custom_modules/oe-module-weno/scripts/file_download.php",
url: "<?php echo $GLOBALS['webroot']; ?>" + "/interface/modules/custom_modules/oe-module-weno/scripts/file_download.php",
type: "GET",
success: function (data) {
$('#notch-pharm').addClass("hide");
Expand All @@ -96,7 +99,7 @@ function downloadPresLog(){
$('#notch-presc').removeClass("hide");
$('#presc-btn').attr("disabled", true);
$.ajax({
url: "<? echo $GLOBALS['webroot']; ?>" + "/interface/modules/custom_modules/oe-module-weno/templates/synch.php",
url: "<?php echo $GLOBALS['webroot']; ?>" + "/interface/modules/custom_modules/oe-module-weno/templates/synch.php",
type: "GET",
data: {key:'downloadLog'},
success: function (data) {
Expand Down
Loading

0 comments on commit 5a7dfb8

Please sign in to comment.