[REF] Hide eway extension in UI and only install it if the original eway payment...
authorSeamus Lee <seamuslee001@gmail.com>
Sat, 5 Sep 2020 05:37:17 +0000 (15:37 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 5 Sep 2020 09:56:01 +0000 (19:56 +1000)
CRM/Upgrade/Incremental/php/FiveThirtyOne.php
ext/ewaysingle/info.xml

index efc87e6e14e0162b2111c6b2c0c64f626265fb01..8cecc02d43cbbe7c1eeaba9ef2b6112be0d0f7d5 100644 (file)
@@ -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;
   }
 
index d69c7cd3627d969a255800d6cca7f05c923a2696..7e9daa1dd5bad7a9bb2beae521981ee5d4bbdd07 100644 (file)
@@ -16,6 +16,9 @@
   </urls>
   <releaseDate>2020-10-07</releaseDate>
   <version>1.0</version>
+  <tags>
+    <tag>mgmt:hidden</tag>
+  </tags>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.31</ver>