Просмотр исходного кода

Ticket #5106 - Payments: Subscribe popup shouldn't show deactivated providers.

AntonLV 1 год назад
Родитель
Сommit
780c25d33d

+ 2 - 0
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -1163,6 +1163,8 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
         if(!$oGrid)
             return $this->_bIsApi ? [] : '';
 
+        $oGrid->setProfileId($iProfileId);
+
         if($this->_bIsApi){
             return [
                 bx_api_get_block('grid', $oGrid->getCodeAPI())

+ 16 - 4
modules/boonex/payment/classes/BxPaymentDb.php

@@ -78,6 +78,8 @@ class BxPaymentDb extends BxBaseModPaymentDb
                     $aMethod['params'][1] = 'name';
 
                     $sWhereClause = " AND `tp`.`for_single`='1'";
+                    if(!empty($aParams['active'])) 
+                        $sWhereClause .= " AND `tp`.`active`='1'";
 
                     if(isset($aParams['order']) && $aParams['order'] === true)
                         $sOrderClause = "`tp`.`order` ASC";
@@ -88,6 +90,8 @@ class BxPaymentDb extends BxBaseModPaymentDb
                     $aMethod['params'][1] = 'name';
 
                     $sWhereClause = " AND `tp`.`for_recurring`='1'";
+                    if(!empty($aParams['active'])) 
+                        $sWhereClause .= " AND `tp`.`active`='1'";
 
                     if(isset($aParams['order']) && $aParams['order'] === true)
                         $sOrderClause = "`tp`.`order` ASC";
@@ -261,14 +265,22 @@ class BxPaymentDb extends BxBaseModPaymentDb
         ));
     }
 
-	public function getVendorInfoProvidersSingle($iVendorId)
+    public function getVendorInfoProvidersSingle($iVendorId, $bActiveOnly = false)
     {
-    	return $this->getVendorInfoProviders($iVendorId, array('type' => 'for_single', 'order' => true));
+        $aParams = ['type' => 'for_single', 'order' => true];
+        if($bActiveOnly)
+            $aParams['active'] = true;
+        
+    	return $this->getVendorInfoProviders($iVendorId, $aParams);
     }
 
-	public function getVendorInfoProvidersRecurring($iVendorId)
+    public function getVendorInfoProvidersRecurring($iVendorId, $bActiveOnly = false)
     {
-    	return $this->getVendorInfoProviders($iVendorId, array('type' => 'for_recurring', 'order' => true));
+        $aParams = ['type' => 'for_recurring', 'order' => true];
+        if($bActiveOnly)
+            $aParams['active'] = true;
+        
+    	return $this->getVendorInfoProviders($iVendorId, $aParams);
     }
 
     public function getVendorInfoProviders($iVendorId, $aParams = [])

+ 1 - 1
modules/boonex/payment/classes/BxPaymentSubscriptions.php

@@ -232,7 +232,7 @@ class BxPaymentSubscriptions extends BxBaseModPaymentSubscriptions
     	if($mixedResult !== true)
             return $mixedResult;
 
-        $aSellerProviders = $this->_oModule->_oDb->getVendorInfoProvidersRecurring($iSellerId);
+        $aSellerProviders = $this->_oModule->_oDb->getVendorInfoProvidersRecurring($iSellerId, true);
         if(empty($aSellerProviders))
             return array('code' => 5, 'message' => _t($CNF['T']['ERR_NOT_ACCEPT_PAYMENTS']));