From 89808b94c6e566be9c790aecede8aa0926206b39 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 5 Sep 2020 15:37:17 +1000 Subject: [PATCH] [REF] Hide eway extension in UI and only install it if the original eway payment processor is still being used --- CRM/Upgrade/Incremental/php/FiveThirtyOne.php | 6 +++++- ext/ewaysingle/info.xml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Upgrade/Incremental/php/FiveThirtyOne.php b/CRM/Upgrade/Incremental/php/FiveThirtyOne.php index efc87e6e14..8cecc02d43 100644 --- a/CRM/Upgrade/Incremental/php/FiveThirtyOne.php +++ b/CRM/Upgrade/Incremental/php/FiveThirtyOne.php @@ -77,7 +77,8 @@ class CRM_Upgrade_Incremental_php_FiveThirtyOne extends CRM_Upgrade_Incremental_ public static function enableEwaySingleExtension(CRM_Queue_TaskContext $ctx) { $eWAYPaymentProcessorType = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_payment_processor_type WHERE class_name = 'Payment_eWAY'"); - if ($eWAYPaymentProcessorType) { + $ewayPaymentProcessorCount = CRM_Core_DAO::singleValueQuery("SELECT count(id) FROM civicrm_payment_processor WHERE payment_processor_type_id = %1", [1 => [$eWAYPaymentProcessorType, 'Positive']]); + if ($ewayPaymentProcessorCount) { $insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([ 'type' => 'module', 'full_name' => 'ewaysingle', @@ -97,6 +98,9 @@ class CRM_Upgrade_Incremental_php_FiveThirtyOne extends CRM_Upgrade_Incremental_ ]); CRM_Core_DAO::executeQuery($managedEntity->usingReplace()->toSQL()); } + else { + CRM_Core_DAO::executeQuery("DELETE FROM civicrm_payment_processor_type WHERE id = %1", [1 => [$eWAYPaymentProcessorType, 'Positive']]); + } return TRUE; } diff --git a/ext/ewaysingle/info.xml b/ext/ewaysingle/info.xml index d69c7cd362..7e9daa1dd5 100644 --- a/ext/ewaysingle/info.xml +++ b/ext/ewaysingle/info.xml @@ -16,6 +16,9 @@ 2020-10-07 1.0 + + mgmt:hidden + stable 5.31 -- 2.25.1