AntonLV %!s(int64=9) %!d(string=hai) anos
pai
achega
042d20904e

+ 1 - 0
modules/base/payment/classes/BxBaseModPaymentConfig.php

@@ -61,6 +61,7 @@ class BxBaseModPaymentConfig extends BxBaseModGeneralConfig
 			'grid_cart' => $this->_sName . '_grid_cart',
 			'grid_sbs_list' => $this->_sName . '_grid_sbs_list',
 			'grid_sbs_history' => $this->_sName . '_grid_sbs_history',
+		    'grid_sbs_administration' => $this->_sName . '_grid_sbs_administration',
 		));
 
 		$this->_aPerPage = array();

+ 1 - 0
modules/boonex/payment/classes/BxPaymentConfig.php

@@ -24,6 +24,7 @@ class BxPaymentConfig extends BxBaseModPaymentConfig
         	'URL_CART_CHECKOUT' => $sBaseUrl . 'initialize_checkout/' . BX_PAYMENT_TYPE_SINGLE . '/',
         	'URL_SUBSCRIBE' => $sBaseUrl . 'subscribe/',
         	'URL_SUBSCRIPTIONS' => 'page.php?i=payment-sbs-list',
+        	'URL_SUBSCRIPTIONS_ADM' => 'page.php?i=payment-sbs-administration',
         	'URL_HISTORY' => 'page.php?i=payment-history',
         	'URL_ORDERS' => 'page.php?i=payment-orders',
         	'URL_DETAILS' => 'page.php?i=payment-details',

+ 30 - 0
modules/boonex/payment/classes/BxPaymentGridSbsAdministration.php

@@ -0,0 +1,30 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Payment Payment
+ * @ingroup     UnaModules
+ * 
+ * @{
+ */
+
+
+class BxPaymentGridSbsAdministration extends BxBaseModPaymentGridOrders
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+    	$this->MODULE = 'bx_payment';
+
+        parent::__construct ($aOptions, $oTemplate);
+
+        $this->_sOrdersType = BX_PAYMENT_ORDERS_TYPE_SUBSCRIPTION;
+    }
+
+    protected function _getCellProvider($mixedValue, $sKey, $aField, $aRow)
+    {
+        return parent::_getCellDefault(_t('_bx_payment_txt_name_' . $mixedValue), $sKey, $aField, $aRow);
+    }
+}
+
+/** @} */

+ 2 - 10
modules/boonex/payment/classes/BxPaymentGridSbsList.php

@@ -9,21 +9,13 @@
  * @{
  */
 
+require_once('BxPaymentGridSbsAdministration.php');
 
-class BxPaymentGridSbsList extends BxBaseModPaymentGridOrders
+class BxPaymentGridSbsList extends BxPaymentGridSbsAdministration
 {
     public function __construct ($aOptions, $oTemplate = false)
     {
-    	$this->MODULE = 'bx_payment';
-
         parent::__construct ($aOptions, $oTemplate);
-
-        $this->_sOrdersType = BX_PAYMENT_ORDERS_TYPE_SUBSCRIPTION;
-    }
-
-    protected function _getCellProvider($mixedValue, $sKey, $aField, $aRow)
-    {
-        return parent::_getCellDefault(_t('_bx_payment_txt_name_' . $mixedValue), $sKey, $aField, $aRow);
     }
 
     protected function _getActionActions ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())

+ 39 - 4
modules/boonex/payment/classes/BxPaymentSubscriptions.php

@@ -23,14 +23,25 @@ class BxPaymentSubscriptions extends BxBaseModPaymentSubscriptions
      */
     public function serviceGetBlockList()
     {
-        return $this->_getBlock('list');
+        $this->_oModule->setSiteSubmenu('menu_sbs_submenu', 'sbs-list');
+
+        return $this->_getBlockSubscriptions('list');
     }
 
     public function serviceGetBlockHistory()
     {
+        $this->_oModule->setSiteSubmenu('menu_sbs_submenu', 'sbs-history');
+
         return $this->_getBlock('history');
     }
 
+    public function serviceGetBlockAdministration()
+    {
+        $this->_oModule->setSiteSubmenu('menu_sbs_submenu', 'sbs-list');
+
+        return $this->_getBlockSubscriptions('administration');
+    }
+
 	public function serviceSubscribe($iSellerId, $sSellerProvider, $iModuleId, $iItemId, $iItemCount)
     {
     	$CNF = &$this->_oModule->_oConfig->CNF;
@@ -74,13 +85,37 @@ class BxPaymentSubscriptions extends BxBaseModPaymentSubscriptions
         if(empty($iUserId))
             return MsgBox(_t($CNF['T']['ERR_REQUIRED_LOGIN']));
 
-        $this->_oModule->setSiteSubmenu('menu_sbs_submenu', 'sbs-' . $sType);
-        
-
         return array(
         	'content' => $this->_oModule->_oTemplate->$sMethod($iUserId)
         );
     }
+
+    protected function _getBlockSubscriptions($sType)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $aResult = $this->_getBlock($sType);
+        if(!is_array($aResult))
+            return $aResult;
+
+        $sMenu = '';
+		if(BxDolAcl::getInstance()->isMemberLevelInSet(192)) {
+			$oPermalink = BxDolPermalinks::getInstance();
+
+            $oMenu = new BxTemplMenu(array(
+            	'template' => 'menu_vertical.html', 
+            	'menu_items' => array(
+    			    array('id' => 'sbs-list', 'name' => 'sbs-list', 'class' => '', 'link' => $oPermalink->permalink($CNF['URL_SUBSCRIPTIONS']), 'target' => '_self', 'title' => _t('_bx_payment_menu_item_title_sbs_list_my'), 'active' => 1),
+    			    array('id' => 'sbs-administration', 'name' => 'sbs-administration', 'class' => '', 'link' => $oPermalink->permalink($CNF['URL_SUBSCRIPTIONS_ADM']), 'target' => '_self', 'title' => _t('_bx_payment_menu_item_title_sbs_list_administration'), 'active' => 1)
+    			)
+            ), $this->_oModule->_oTemplate);
+            $oMenu->setSelected($this->_oModule->getName(), 'sbs-' . $sType);
+
+            $aResult['menu'] = $oMenu->getCode();
+		}
+
+		return $aResult;
+    }
 }
 
 /** @} */

+ 10 - 0
modules/boonex/payment/classes/BxPaymentTemplate.php

@@ -189,6 +189,16 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
         return $this->_displayBlockHistory('grid_sbs_history', $iClientId);
     }
 
+    public function displayBlockSbsAdministration()
+    {
+        $oGrid = BxDolGrid::getObjectInstance($this->_oConfig->getObject('grid_sbs_administration'), $this->getModule()->_oTemplate);
+        if(!$oGrid)
+            return MsgBox(_t($this->_sLangsPrefix . 'msg_no_results'));
+
+		$this->addJsCssSubscriptions();
+        return $this->displayJsCode(BX_PAYMENT_ORDERS_TYPE_SUBSCRIPTION) . $oGrid->getCode();
+    }
+
     public function displayBlockSbsDetails($iClientId)
     {
         return 'Details would be here';

+ 8 - 1
modules/boonex/payment/install/langs/en.xml

@@ -27,6 +27,10 @@
     <string name="_bx_payment_page_title_sbs_history"><![CDATA[Payment History]]></string>
     <string name="_bx_payment_page_block_title_sbs_history"><![CDATA[Payment History]]></string>
 
+    <string name="_bx_payment_page_title_sys_sbs_administration"><![CDATA[Subscriptions Administration]]></string>
+    <string name="_bx_payment_page_title_sbs_administration"><![CDATA[Subscriptions]]></string>
+    <string name="_bx_payment_page_block_title_sbs_administration"><![CDATA[Subscriptions]]></string>
+
 	<string name="_bx_payment_page_title_sys_history"><![CDATA[Shopping History]]></string>
 	<string name="_bx_payment_page_title_history"><![CDATA[Shopping History]]></string>
 	<string name="_bx_payment_page_block_title_history"><![CDATA[Shopping History]]></string>
@@ -70,6 +74,8 @@
     <string name="_bx_payment_menu_set_title_sbs_submenu"><![CDATA[Subscriptions Submenu]]></string>
     <string name="_bx_payment_menu_item_title_system_sbs_list"><![CDATA[Subscriptions List]]></string>
     <string name="_bx_payment_menu_item_title_sbs_list"><![CDATA[Subscriptions]]></string>
+    <string name="_bx_payment_menu_item_title_sbs_list_my"><![CDATA[My Subscriptions]]></string>
+    <string name="_bx_payment_menu_item_title_sbs_list_administration"><![CDATA[All Subscriptions]]></string>
     <string name="_bx_payment_menu_item_title_system_sbs_history"><![CDATA[Subscriptions History]]></string>
     <string name="_bx_payment_menu_item_title_sbs_history"><![CDATA[Payments]]></string>
 
@@ -86,7 +92,8 @@
 	<string name="_bx_payment_grid_column_title_ods_amount"><![CDATA[Amount]]></string>
 	<string name="_bx_payment_grid_column_title_ods_date"><![CDATA[Date]]></string>
 	<string name="_bx_payment_grid_column_title_sbs_seller_id"><![CDATA[Seller]]></string>
-	<string name="_bx_payment_grid_column_title_sbs_customer_id"><![CDATA[Customer]]></string>
+	<string name="_bx_payment_grid_column_title_sbs_client_id"><![CDATA[Client]]></string>
+	<string name="_bx_payment_grid_column_title_sbs_customer_id"><![CDATA[Customer ID]]></string>
 	<string name="_bx_payment_grid_column_title_sbs_subscription_id"><![CDATA[Subscription]]></string>
     <string name="_bx_payment_grid_column_title_sbs_transaction"><![CDATA[Transaction]]></string>
     <string name="_bx_payment_grid_column_title_sbs_license"><![CDATA[License]]></string>

+ 2 - 0
modules/boonex/payment/install/sql/enable.sql

@@ -27,6 +27,7 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 
 ('bx_payment_sbs_list', '_bx_payment_page_title_sys_sbs_list', '_bx_payment_page_title_sbs_list', @sName, 5, 2147483647, 1, 'payment-sbs-list', 'page.php?i=payment-sbs-list', '', '', '', 0, 1, 0, 'BxPaymentPageSubscriptions', 'modules/boonex/payment/classes/BxPaymentPageSubscriptions.php'),
 ('bx_payment_sbs_history', '_bx_payment_page_title_sys_sbs_history', '_bx_payment_page_title_sbs_history', @sName, 5, 2147483647, 1, 'payment-sbs-history', 'page.php?i=payment-sbs-history', '', '', '', 0, 1, 0, 'BxPaymentPageSubscriptions', 'modules/boonex/payment/classes/BxPaymentPageSubscriptions.php'),
+('bx_payment_sbs_administration', '_bx_payment_page_title_sys_sbs_administration', '_bx_payment_page_title_sbs_administration', @sName, 5, 192, 1, 'payment-sbs-administration', 'page.php?i=payment-sbs-administration', '', '', '', 0, 1, 0, 'BxPaymentPageSubscriptions', 'modules/boonex/payment/classes/BxPaymentPageSubscriptions.php'),
 
 ('bx_payment_orders', '_bx_payment_page_title_sys_orders', '_bx_payment_page_title_orders', @sName, 5, 2147483647, 1, 'payment-orders', 'page.php?i=payment-orders', '', '', '', 0, 1, 0, 'BxPaymentPageOrders', 'modules/boonex/payment/classes/BxPaymentPageOrders.php'),
 ('bx_payment_details', '_bx_payment_page_title_sys_details', '_bx_payment_page_title_details', @sName, 5, 2147483647, 1, 'payment-details', 'page.php?i=payment-details', '', '', '', 0, 1, 0, 'BxPaymentPageDetails', 'modules/boonex/payment/classes/BxPaymentPageDetails.php');
@@ -41,6 +42,7 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 
 ('bx_payment_sbs_list', 1, @sName, '_bx_payment_page_block_title_sbs_list', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:14:"get_block_list";s:6:"params";a:0:{}s:5:"class";s:13:"Subscriptions";}', 0, 0, 1),
 ('bx_payment_sbs_history', 1, @sName, '_bx_payment_page_block_title_sbs_history', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:17:"get_block_history";s:6:"params";a:0:{}s:5:"class";s:13:"Subscriptions";}', 0, 0, 1),
+('bx_payment_sbs_administration', 1, @sName, '_bx_payment_page_block_title_sbs_administration', 11, 192, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:24:"get_block_administration";s:6:"params";a:0:{}s:5:"class";s:13:"Subscriptions";}', 0, 0, 1),
 
 ('bx_payment_orders', 1, @sName, '_bx_payment_page_block_title_orders', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:16:"get_block_orders";s:6:"params";a:0:{}s:5:"class";s:6:"Orders";}', 0, 0, 1),
 ('bx_payment_details', 1, @sName, '_bx_payment_page_block_title_details', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:17:"get_block_details";s:6:"params";a:0:{}s:5:"class";s:7:"Details";}', 0, 0, 1);

+ 11 - 0
modules/boonex/payment/install/sql/install.sql

@@ -190,6 +190,7 @@ INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `fie
 
 ('bx_payment_grid_sbs_list', 'Sql', 'SELECT `ttp`.`id` AS `id`, `ttp`.`seller_id` AS `seller_id`, `ts`.`customer_id` AS `customer_id`, `ts`.`subscription_id` AS `subscription_id`, `ttp`.`provider` AS `provider`, `ts`.`date` AS `date` FROM `bx_payment_subscriptions` AS `ts` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `ts`.`pending_id`=`ttp`.`id` WHERE 1 AND `ttp`.`type`=''recurring'' ', 'bx_payment_subscriptions', 'id', 'date', '', '', 100, NULL, 'start', '', 'ts`.`customer_id,ts`.`subscription_id,ts`.`date', '', 'auto', '', '', 2147483647, 'BxPaymentGridSbsList', 'modules/boonex/payment/classes/BxPaymentGridSbsList.php'),
 ('bx_payment_grid_sbs_history', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`seller_id` AS `seller_id`, `ttp`.`order` AS `transaction`, `tt`.`license` AS `license`, `tt`.`amount` AS `amount`, `tt`.`date` AS `date` FROM `bx_payment_transactions` AS `tt` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `tt`.`pending_id`=`ttp`.`id` WHERE 1 AND `ttp`.`type`=''recurring'' ', 'bx_payment_transactions', 'id', 'date', '', '', 100, NULL, 'start', '', 'ttp`.`order,tt`.`license,tt`.`amount,tt`.`date', '', 'auto', '', '', 2147483647, 'BxPaymentGridSbsHistory', 'modules/boonex/payment/classes/BxPaymentGridSbsHistory.php'),
+('bx_payment_grid_sbs_administration', 'Sql', 'SELECT `ttp`.`id` AS `id`, `ttp`.`client_id` AS `client_id`, `ttp`.`seller_id` AS `seller_id`, `ts`.`customer_id` AS `customer_id`, `ts`.`subscription_id` AS `subscription_id`, `ttp`.`provider` AS `provider`, `ts`.`date` AS `date` FROM `bx_payment_subscriptions` AS `ts` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `ts`.`pending_id`=`ttp`.`id` WHERE 1 AND `ttp`.`type`=''recurring'' ', 'bx_payment_subscriptions', 'id', 'date', '', '', 100, NULL, 'start', '', 'ts`.`customer_id,ts`.`subscription_id,ts`.`date', '', 'auto', '', '', 192, 'BxPaymentGridSbsAdministration', 'modules/boonex/payment/classes/BxPaymentGridSbsAdministration.php'),
 
 ('bx_payment_grid_orders_history', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`seller_id` AS `seller_id`, `ttp`.`order` AS `transaction`, `tt`.`license` AS `license`, `tt`.`amount` AS `amount`, `tt`.`date` AS `date` FROM `bx_payment_transactions` AS `tt` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `tt`.`pending_id`=`ttp`.`id` WHERE 1 AND `ttp`.`type`=''single'' ', 'bx_payment_transactions', 'id', 'date', '', '', 100, NULL, 'start', '', 'ttp`.`order,tt`.`license,tt`.`amount,tt`.`date', '', 'auto', '', '', 2147483647, 'BxPaymentGridHistory', 'modules/boonex/payment/classes/BxPaymentGridHistory.php'),
 ('bx_payment_grid_orders_processed', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`client_id` AS `client_id`, `tt`.`seller_id` AS `seller_id`, `tt`.`module_id` AS `module_id`, `tt`.`item_id` AS `item_id`, `tt`.`item_count` AS `item_count`, `ttp`.`order` AS `transaction`, `ttp`.`error_msg` AS `error_msg`, `ttp`.`provider` AS `provider`, `tt`.`license` AS `license`, `tt`.`amount` AS `amount`, `tt`.`date` AS `date` FROM `bx_payment_transactions` AS `tt` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `tt`.`pending_id`=`ttp`.`id` WHERE 1 ', 'bx_payment_transactions', 'id', 'date', '', '', 100, NULL, 'start', '', 'ttp`.`order,tt`.`license,tt`.`amount,tt`.`date', '', 'auto', '', '', 2147483647, 'BxPaymentGridProcessed', 'modules/boonex/payment/classes/BxPaymentGridProcessed.php'),
@@ -224,6 +225,14 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 ('bx_payment_grid_sbs_history', 'date', '_bx_payment_grid_column_title_sbs_date', '10%', 0, '10', '', 5),
 ('bx_payment_grid_sbs_history', 'actions', '', '12%', 0, '', '', 6),
 
+('bx_payment_grid_sbs_administration', 'seller_id', '_bx_payment_grid_column_title_sbs_seller_id', '15%', 0, '24', '', 1),
+('bx_payment_grid_sbs_administration', 'client_id', '_bx_payment_grid_column_title_sbs_client_id', '15%', 0, '24', '', 2),
+('bx_payment_grid_sbs_administration', 'customer_id', '_bx_payment_grid_column_title_sbs_customer_id', '20%', 0, '24', '', 3),
+('bx_payment_grid_sbs_administration', 'subscription_id', '_bx_payment_grid_column_title_sbs_subscription_id', '20%', 0, '24', '', 4),
+('bx_payment_grid_sbs_administration', 'provider', '_bx_payment_grid_column_title_sbs_provider', '10%', 0, '16', '', 5),
+('bx_payment_grid_sbs_administration', 'date', '_bx_payment_grid_column_title_sbs_date', '10%', 0, '10', '', 6),
+('bx_payment_grid_sbs_administration', 'actions', '', '10%', 0, '', '', 7),
+
 ('bx_payment_grid_orders_history', 'seller_id', '_bx_payment_grid_column_title_ods_seller_id', '24%', 0, '20', '', 1),
 ('bx_payment_grid_orders_history', 'transaction', '_bx_payment_grid_column_title_ods_transaction', '22%', 0, '18', '', 2),
 ('bx_payment_grid_orders_history', 'license', '_bx_payment_grid_column_title_ods_license', '22%', 0, '18', '', 3),
@@ -259,6 +268,8 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 
 ('bx_payment_grid_sbs_history', 'single', 'view_order', '_bx_payment_grid_action_title_sbs_view_order', 'ellipsis-h', 1, 0, 1),
 
+('bx_payment_grid_sbs_administration', 'single', 'view_order', '_bx_payment_grid_action_title_sbs_view_order', 'ellipsis-h', 1, 0, 1),
+
 ('bx_payment_grid_orders_history', 'single', 'view_order', '_bx_payment_grid_action_title_ods_view_order', 'ellipsis-h', 1, 0, 1),
 
 ('bx_payment_grid_orders_processed', 'independent', 'add', '_bx_payment_grid_action_title_ods_add', '', 0, 0, 1),

+ 8 - 1
modules/boonex/russian/data/langs/bx_payment/ru.xml

@@ -27,6 +27,10 @@
     <string name="_bx_payment_page_title_sbs_history"><![CDATA[История выплат]]></string>
     <string name="_bx_payment_page_block_title_sbs_history"><![CDATA[История выплат]]></string>
 
+    <string name="_bx_payment_page_title_sys_sbs_administration"><![CDATA[Управление подписками]]></string>
+    <string name="_bx_payment_page_title_sbs_administration"><![CDATA[Подписки]]></string>
+    <string name="_bx_payment_page_block_title_sbs_administration"><![CDATA[Подписки]]></string>
+
 	<string name="_bx_payment_page_title_sys_history"><![CDATA[История покупок]]></string>
 	<string name="_bx_payment_page_title_history"><![CDATA[История покупок]]></string>
 	<string name="_bx_payment_page_block_title_history"><![CDATA[История покупок]]></string>
@@ -70,6 +74,8 @@
     <string name="_bx_payment_menu_set_title_sbs_submenu"><![CDATA[Подменю подписок]]></string>
     <string name="_bx_payment_menu_item_title_system_sbs_list"><![CDATA[Лист подписок]]></string>
     <string name="_bx_payment_menu_item_title_sbs_list"><![CDATA[Подписки]]></string>
+    <string name="_bx_payment_menu_item_title_sbs_list_my"><![CDATA[Мои подписки]]></string>
+    <string name="_bx_payment_menu_item_title_sbs_list_administration"><![CDATA[Все подписки]]></string>
     <string name="_bx_payment_menu_item_title_system_sbs_history"><![CDATA[История подписок]]></string>
     <string name="_bx_payment_menu_item_title_sbs_history"><![CDATA[История выплат]]></string>
 
@@ -86,7 +92,8 @@
 	<string name="_bx_payment_grid_column_title_ods_amount"><![CDATA[Сумма]]></string>
 	<string name="_bx_payment_grid_column_title_ods_date"><![CDATA[Дата]]></string>
 	<string name="_bx_payment_grid_column_title_sbs_seller_id"><![CDATA[Продавец]]></string>
-	<string name="_bx_payment_grid_column_title_sbs_customer_id"><![CDATA[Покупатель]]></string>
+	<string name="_bx_payment_grid_column_title_sbs_client_id"><![CDATA[Покупатель]]></string>
+	<string name="_bx_payment_grid_column_title_sbs_customer_id"><![CDATA[ID Покупателя]]></string>
     <string name="_bx_payment_grid_column_title_sbs_subscription_id"><![CDATA[Подписка]]></string>
     <string name="_bx_payment_grid_column_title_sbs_transaction"><![CDATA[Транзакция]]></string>
     <string name="_bx_payment_grid_column_title_sbs_license"><![CDATA[Лицензия]]></string>