From 8d71c342b458b4021abc1c6fc79c61ad8f23ea51 Mon Sep 17 00:00:00 2001 From: juggernautsei Date: Thu, 23 May 2024 14:35:40 -0400 Subject: [PATCH] as requested --- .../ModuleManagerListener.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/interface/modules/custom_modules/oe-module-claimrev-connect/ModuleManagerListener.php b/interface/modules/custom_modules/oe-module-claimrev-connect/ModuleManagerListener.php index c4b586cc6df..4b2d663f4ed 100644 --- a/interface/modules/custom_modules/oe-module-claimrev-connect/ModuleManagerListener.php +++ b/interface/modules/custom_modules/oe-module-claimrev-connect/ModuleManagerListener.php @@ -52,7 +52,7 @@ public function moduleManagerAction($methodName, $modId, string $currentActionSt if (method_exists(self::class, $methodName)) { return self::$methodName($modId, $currentActionStatus); } else { - // no reason to report action method is missing. + // no reason to report, action method is missing. return $currentActionStatus; } } @@ -103,6 +103,12 @@ private function help_requested($modId, $currentActionStatus): mixed */ private function enable($modId, $currentActionStatus): mixed { + $logMessage = 'Claimrev Background tasks have been enabled'; + // Register background services + $sql = "UPDATE `background_services` SET `active` = '1' WHERE `name` = ? OR `name` = ? OR `name` = ?"; + $status = sqlQuery($sql, array('ClaimRev_Send', 'ClaimRev_Receive', 'ClaimRev_Elig_Send_Receive')); + error_log($logMessage . ' ' . text($status)); + // Return the current action status from Module Manager in case of error from its action. return $currentActionStatus; } @@ -113,7 +119,11 @@ private function enable($modId, $currentActionStatus): mixed */ private function disable($modId, $currentActionStatus): mixed { - // allow config button to show before enable. + $logMessage = 'Claimrev Background tasks have been disabled'; + // Unregister background services + $sql = "UPDATE `background_services` SET `active` = '0' WHERE `name` = ? OR `name` = ? OR `name` = ?"; + $status = sqlQuery($sql, array('ClaimRev_Send', 'ClaimRev_Receive', 'ClaimRev_Elig_Send_Receive')); + error_log($logMessage . ' ' . text($status)); return $currentActionStatus; } @@ -122,12 +132,12 @@ private function disable($modId, $currentActionStatus): mixed * @param $currentActionStatus * @return mixed */ - private function unregister($currentActionStatus): mixed + private function unregister($modId, $currentActionStatus) { - $logMessage = ''; // Initialize an empty string to store log messages + $logMessage = 'Claimrev Background tasks have been removed'; // Initialize an empty string to store log messages $sql = "DELETE FROM `background_services` WHERE `name` = ? OR `name` = ? OR `name` = ?"; - sqlQuery($sql, array('ClaimRev_Send', 'ClaimRev_Receive', 'ClaimRev_Elig_Send_Receive')); - error_log(text($logMessage)); + $status = sqlQuery($sql, array('ClaimRev_Send', 'ClaimRev_Receive', 'ClaimRev_Elig_Send_Receive')); + error_log($logMessage . ' ' . text($status)); return $currentActionStatus; } }