Skip to content

Commit

Permalink
Weno fixes and validations (openemr#7209)
Browse files Browse the repository at this point in the history
* Weno fixes and validations
- numerous warnings

* - remove Config weno setup.
- new service class.
- add new Weno Module setup
- add logic to prevent module event listeners unless admin credentials are set up.
- add logic to show unregister and config icons if not credentials.
- add Module Manager call to listener class on pre action events using pre prefix to action i.e. preeneble
- using mod_ui_active flag from modules table to qualify some ui actions in module manager
- many translations and warnings

* - add encrypt and decrypt to globals

* - added new manager feature that allows a flag `mod_ui_active` that when set indicates custom styles for buttons.
- added a refresh if action listener return an error after alert is closed.
- Restyled buttons with font awesome.
- Fixed module config container to be responsive and follow themes.
- table install fixes
- more general code clean up.

* - fix sync alert
- refactor some BootService methods to static
- more general code cleanup.

* - change widget title
- clean up widget action buttons

* - Added an error panel to widget
- validations refactors
- code cleanup

* - new validations for warnings in widget to notify but error level still allows work to proceed.
- much error formatting

* - Simplfy and refactor checkErrors() method.
- Refactor errorWithDie() to echoError() method

* - add icon and button to open dialog to render form to fix error item
- more restylaes

* - add help to setup
- fix and restyle Weno Management.

* - fix some missteps for url compose for errors
- fix vitals eval
- refactor cipher
- prep to remove Container class

* - fix lots of warnings
- setup downloads logging
- add weno prov id to user settings for back up
- restyle choices pharmacy seletions and fix seach for zip
- group city looku in UI to be unique
- factored away Container class! deleted

* - revamped pharmacy search to simplify
- fix style color to themes

* - add pharmacy download status in widget and choices
- test download for fail status the reset anf reattemp
- varius warnings

* - rename the ModuleManagerAfterActionListener since it now listens for other events othe than after actions.

* - add new alerts to widget
- replace encounter with auth user to track user to prescription round trip
- new age and phone format methods

* - send responsible party if under 19 yo

* - conditional wrong for guardian

* - restyles and minor bug fixes

* - add a return to demographics to weno eRx frame.

* - add a secondary backup weno admin

* - scrape return html errors within downloaded zip and csv files!

* - add alerts from scraping weno download files since they don't send say a 401 or 403 status with response holding error. always a 200 regardless.

* - move manage modules tab to admins tab  currently opens to patient tab which is needed to be in view for editing.

* - put back weno enable in globals Config

* - logging changes
- ensure we have a user id for prescriptions.
  • Loading branch information
sjpadgett authored Feb 22, 2024
1 parent dfd3a22 commit e670aa3
Show file tree
Hide file tree
Showing 39 changed files with 1,869 additions and 1,208 deletions.
2 changes: 1 addition & 1 deletion interface/main/tabs/menu/menus/standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
{
"label": "Manage Modules",
"menu_id": "adm0",
"target": "pat",
"target": "adm",
"url": "/interface/modules/zend_modules/public/Installer",
"children": [],
"requirement": 0,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$classLoader->registerNamespaceIfNotExists("OpenEMR\\Modules\\FaxSMS\\", __DIR__ . DIRECTORY_SEPARATOR . 'src');
*/

class ModuleManagerAfterActionListener extends AbstractModuleActionListener
class ModuleManagerListener extends AbstractModuleActionListener
{
public $service;
private $authUser;
Expand Down Expand Up @@ -75,9 +75,9 @@ public static function getModuleNamespace(): string
* Required method to return this class object,
* so it is instantiated in Laminas Manager.
*
* @return ModuleManagerAfterActionListener
* @return ModuleManagerListener
*/
public static function initListenerSelf(): ModuleManagerAfterActionListener
public static function initListenerSelf(): ModuleManagerListener
{
return new self();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
*/

use OpenEMR\Core\AbstractModuleActionListener;
use OpenEMR\Modules\WenoModule\Services\ModuleService;

/* Allows maintenance of background tasks depending on Module Manager action. */

class ModuleManagerAfterActionListener extends AbstractModuleActionListener
class ModuleManagerListener extends AbstractModuleActionListener
{
public function __construct()
{
Expand Down Expand Up @@ -73,9 +74,9 @@ public static function getModuleNamespace(): string
* Required method to return this class object,
* so it is instantiated in Laminas Manager.
*
* @return ModuleManagerAfterActionListener
* @return ModuleManagerListener
*/
public static function initListenerSelf(): ModuleManagerAfterActionListener
public static function initListenerSelf(): ModuleManagerListener
{
return new self();
}
Expand All @@ -95,20 +96,41 @@ private function install($modId, $currentActionStatus): mixed
* @param $currentActionStatus
* @return mixed
*/
private function enable($modId, $currentActionStatus): mixed
private function preenable($modId, $currentActionStatus): mixed
{
$rtn = $this->setTaskState('1');
$modService = new ModuleService();
if ($modService->isWenoConfigured()) {
$modService::setModuleState($modId, '0', '0');
return $currentActionStatus;
}
$modService::setModuleState($modId, '0', '1');
return $currentActionStatus;
}

/**
* @param $modId
* @param $currentActionStatus
* @return mixed
*/
private function enable($modId, $currentActionStatus): mixed
{
$modService = new ModuleService();
if ($modService->isWenoConfigured()) {
$modService::setModuleState($modId, '1', '0');
return $currentActionStatus;
}
$modService::setModuleState($modId, '1', '1');
return xlt("Weno eRx Service is not configured. Please configure Weno eRx Service in the Weno Module Setup.");
}

/**
* @param $modId
* @param $currentActionStatus
* @return mixed
*/
private function disable($modId, $currentActionStatus): mixed
{
$rtn = $this->setTaskState('0');
ModuleService::setModuleState($modId, '0', '0');
return $currentActionStatus;
}

Expand Down Expand Up @@ -162,14 +184,4 @@ function getModuleRegistry($modId, $col = '*'): array

return $registry;
}

/**
* @param $flag
* @return mixed
*/
private function setTaskState($flag): mixed
{
$sql_next = "UPDATE `background_services` SET `active` = ? WHERE `name` = ? OR `name` = ?";
return sqlQuery($sql_next, array($flag, 'WenoExchange', 'WenoExchangePharmacies'));
}
}
2 changes: 1 addition & 1 deletion interface/modules/custom_modules/oe-module-weno/info.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Weno EZ Integration Module
Weno EZ Integration eRx Module v1.2.0
17 changes: 11 additions & 6 deletions interface/modules/custom_modules/oe-module-weno/moduleConfig.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<?php

/**
* Config Module.
* Call the module setup page if present.
* Included in all modules and called by Module Manager.
*
* package OpenEMR
* link http://www.open-emr.org
* author Sherwin Gaddis <[email protected]>
* copyright Copyright (c )2021. Sherwin Gaddis <[email protected]>
* license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*
* @package OpenEMR Module
* @link http://www.open-emr.org
* @author Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2023-24 Jerry Padgett <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

require_once dirname(__FILE__, 4) . '/globals.php';

$module_config = 1;
?>

<iframe src="templates/weno_setup.php?module_config=1" style="border:none;height:100vh;width:100%;"></iframe>
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
* @global EventDispatcher $eventDispatcher Injected by the OpenEMR module loader;
*/

$bootstrap = new Bootstrap($eventDispatcher, $GLOBALS['kernel']);
$bootstrap = new Bootstrap($eventDispatcher);
$bootstrap->subscribeToEvents();
Loading

0 comments on commit e670aa3

Please sign in to comment.