AntonLV пре 8 година
родитељ
комит
006421e719

+ 29 - 11
modules/base/payment/classes/BxBaseModPaymentGridOrders.php

@@ -11,13 +11,13 @@
 
 class BxBaseModPaymentGridOrders extends BxTemplGrid
 {
-	protected $MODULE;
-	protected $_oModule;
+    protected $MODULE;
+    protected $_oModule;
 
-	protected $_sOrdersType;
+    protected $_sOrdersType;
 
-	protected $_sLangsPrefix;
-	protected $_sCurrencySign;
+    protected $_sLangsPrefix;
+    protected $_sCurrencySign;
 
     public function __construct ($aOptions, $oTemplate = false)
     {
@@ -82,22 +82,40 @@ class BxBaseModPaymentGridOrders extends BxTemplGrid
         echoJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aAffected) : array('msg' => _t($this->_sLangsPrefix . 'err_cannot_perform')));
     }
 
-	protected function _getCellClientId($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellClientId($mixedValue, $sKey, $aField, $aRow)
     {
-    	return parent::_getCellDefault($this->_oModule->_oTemplate->displayProfileLink($mixedValue), $sKey, $aField, $aRow);
+        return parent::_getCellDefault($this->_oModule->_oTemplate->displayProfileLink($mixedValue), $sKey, $aField, $aRow);
     }
 
-	protected function _getCellSellerId($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellSellerId($mixedValue, $sKey, $aField, $aRow)
     {
-    	return parent::_getCellDefault($this->_oModule->_oTemplate->displayProfileLink($mixedValue), $sKey, $aField, $aRow);
+        return parent::_getCellDefault($this->_oModule->_oTemplate->displayProfileLink($mixedValue), $sKey, $aField, $aRow);
     }
 
-	protected function _getCellAmount($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellItem($mixedValue, $sKey, $aField, $aRow)
+    {
+        $sTxtUnknown = _t('_uknown');
+
+        if(empty($aRow['module_id']) || empty($aRow['item_id']))
+            return $sTxtUnknown;
+
+        $aItemInfo = $this->_oModule->callGetCartItem((int)$aRow['module_id'], array((int)$aRow['item_id']));
+        if(empty($aItemInfo) || !is_array($aItemInfo))
+            return $sTxtUnknown;
+
+        return parent::_getCellDefault($this->_oModule->_oTemplate->displayLink('link', array(
+            'href' => $aItemInfo['url'],
+            'title' => bx_html_attribute($aItemInfo['title']),
+            'content' => $aItemInfo['title']
+    	)), $sKey, $aField, $aRow);
+    }
+
+    protected function _getCellAmount($mixedValue, $sKey, $aField, $aRow)
     {
         return parent::_getCellDefault($this->_sCurrencySign . $mixedValue, $sKey, $aField, $aRow);
     }
 
-	protected function _getCellDate($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellDate($mixedValue, $sKey, $aField, $aRow)
     {
         return parent::_getCellDefault(bx_time_js($mixedValue), $sKey, $aField, $aRow);
     }

+ 3 - 3
modules/boonex/payment/classes/BxPaymentGridCart.php

@@ -50,9 +50,9 @@ class BxPaymentGridCart extends BxBaseModPaymentGridCarts
     protected function _getCellTitle($mixedValue, $sKey, $aField, $aRow)
     {
     	return parent::_getCellDefault($this->_oModule->_oTemplate->displayLink('link', array(
-    		'href' => $aRow['url'],
-    		'title' => $aRow['title'],
-    		'content' => $aRow['title']
+            'href' => $aRow['url'],
+            'title' => bx_html_attribute($aRow['title']),
+            'content' => $aRow['title']
     	)), $sKey, $aField, $aRow);
     }
 

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

@@ -61,7 +61,7 @@ class BxPaymentGridSbsAdministration extends BxBaseModPaymentGridOrders
                 'href' => bx_replace_markers($aInfo['url_browse_order_' . $this->_sManageType], array(
                     'order' => $mixedValue
                 )),
-                'title' => $mixedValue,
+                'title' => bx_html_attribute($mixedValue),
                 'content' => $mixedValue
             ));
 

+ 19 - 8
modules/boonex/payment/classes/BxPaymentTemplate.php

@@ -222,7 +222,7 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
         return $this->displayJsCode($sType) . $oGrid->getCode();
     }
 
-	public function displayOrder($sType, $iId)
+    public function displayOrder($sType, $iId)
     {
         $sMethodName = 'getOrder' . bx_gen_method_name($sType);
         $aOrder = $this->_oDb->$sMethodName(array('type' => 'id', 'id' => $iId));
@@ -231,14 +231,21 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
         $aSeller = $oModule->getVendorInfo((int)$aOrder['seller_id']);
         $aClient = $oModule->getProfileInfo((int)$aOrder['client_id']);
 
+        $aTmplVarsLicense = array();
+        if(in_array($sType, array(BX_PAYMENT_ORDERS_TYPE_PROCESSED, BX_PAYMENT_ORDERS_TYPE_HISTORY)))
+            $aTmplVarsLicense = array(
+                'txt_license' => _t($this->_sLangsPrefix . 'txt_license'),
+                'license' => $aOrder['license']
+            );
+
         $aResult = array(
-        	'txt_client' => _t($this->_sLangsPrefix . 'txt_client'),
-        	'txt_seller' => _t($this->_sLangsPrefix . 'txt_seller'),
-        	'txt_order' => _t($this->_sLangsPrefix . 'txt_order'),
-        	'txt_processed_with' => _t($this->_sLangsPrefix . 'txt_processed_with'),
-        	'txt_message' => _t($this->_sLangsPrefix . 'txt_message'),
-        	'txt_date' => _t($this->_sLangsPrefix . 'txt_date'),
-        	'txt_products' => _t($this->_sLangsPrefix . 'txt_products'),
+            'txt_client' => _t($this->_sLangsPrefix . 'txt_client'),
+            'txt_seller' => _t($this->_sLangsPrefix . 'txt_seller'),
+            'txt_order' => _t($this->_sLangsPrefix . 'txt_order'),
+            'txt_processed_with' => _t($this->_sLangsPrefix . 'txt_processed_with'),
+            'txt_message' => _t($this->_sLangsPrefix . 'txt_message'),
+            'txt_date' => _t($this->_sLangsPrefix . 'txt_date'),
+            'txt_products' => _t($this->_sLangsPrefix . 'txt_products'),
             'client_name' => $aClient['name'],
             'client_url' => $aClient['link'],
             'bx_if:show_link' => array(
@@ -254,6 +261,10 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
                     'seller_name' => $aSeller['name']
                 )
             ),
+            'bx_if:show_license' => array(
+                'condition' => !empty($aTmplVarsLicense),
+                'content' => $aTmplVarsLicense
+            ),
             'order' => $aOrder['order'],
             'provider' => _t('_bx_payment_txt_name_' . $aOrder['provider']),
             'error' => $aOrder['error_msg'],

+ 2 - 0
modules/boonex/payment/install/langs/en.xml

@@ -98,6 +98,7 @@
 	<string name="_bx_payment_grid_column_title_ods_seller_id"><![CDATA[Seller]]></string>
 	<string name="_bx_payment_grid_column_title_ods_transaction"><![CDATA[Transaction]]></string>
 	<string name="_bx_payment_grid_column_title_ods_license"><![CDATA[License]]></string>
+        <string name="_bx_payment_grid_column_title_ods_item"><![CDATA[Product]]></string>
 	<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>
@@ -240,6 +241,7 @@
 	<string name="_bx_payment_txt_checkout_to"><![CDATA[Continue checkouting to {0}]]></string>
 	<string name="_bx_payment_txt_checkout_with"><![CDATA[Checkout with {0}]]></string>
 	<string name="_bx_payment_txt_client"><![CDATA[Client]]></string>
+        <string name="_bx_payment_txt_license"><![CDATA[License]]></string>
 	<string name="_bx_payment_txt_seller"><![CDATA[Seller]]></string>
 	<string name="_bx_payment_txt_order"><![CDATA[Order ID]]></string>
 	<string name="_bx_payment_txt_processed_with"><![CDATA[Processed with]]></string>

+ 3 - 3
modules/boonex/payment/install/sql/install.sql

@@ -235,7 +235,7 @@ INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `fie
 ('bx_payment_grid_sbs_list_all', 'Sql', 'SELECT `ttp`.`id` AS `id`, `ttp`.`client_id` AS `client_id`, `tac`.`email` AS `client_email`, `ttp`.`seller_id` AS `seller_id`, `ts`.`customer_id` AS `customer_id`, `ts`.`subscription_id` AS `subscription_id`, `ttp`.`provider` AS `provider`, `ttp`.`items` AS `items`, `ts`.`paid` AS `paid`, `ts`.`date` AS `date` FROM `bx_payment_subscriptions` AS `ts` LEFT JOIN `bx_payment_transactions_pending` AS `ttp` ON `ts`.`pending_id`=`ttp`.`id` LEFT JOIN `sys_profiles` AS `tpc` ON `ttp`.`client_id`=`tpc`.`id` LEFT JOIN `sys_accounts` AS `tac` ON `tpc`.`account_id`=`tac`.`id` WHERE 1 AND `ttp`.`type`=''recurring'' ', 'bx_payment_subscriptions', 'id', 'date', '', '', 100, NULL, 'start', '', 'tac`.`email,ts`.`customer_id,ts`.`subscription_id,ts`.`date', '', 'auto', '', '', 192, 'BxPaymentGridSbsAdministration', 'modules/boonex/payment/classes/BxPaymentGridSbsAdministration.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_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_history', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`seller_id` AS `seller_id`, `tt`.`module_id` AS `module_id`, `tt`.`item_id` AS `item_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'),
 ('bx_payment_grid_orders_pending', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`client_id` AS `client_id`, `tt`.`seller_id` AS `seller_id`, `tt`.`items` AS `items`, `tt`.`amount` AS `amount`, `tt`.`order` AS `transaction`, `tt`.`error_msg` AS `error_msg`, `tt`.`provider` AS `provider`, `tt`.`date` AS `date` FROM `bx_payment_transactions_pending` AS `tt` WHERE 1 AND (ISNULL(`tt`.`order`) OR (NOT ISNULL(`tt`.`order`) AND `tt`.`error_code`<>''0'')) ', 'bx_payment_transactions_pending', 'id', 'date', '', '', 100, NULL, 'start', '', 'tt`.`order,tt`.`amount,tt`.`date', '', 'auto', '', '', 2147483647, 'BxPaymentGridPending', 'modules/boonex/payment/classes/BxPaymentGridPending.php');
 
@@ -288,7 +288,7 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 
 ('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),
+('bx_payment_grid_orders_history', 'item', '_bx_payment_grid_column_title_ods_item', '22%', 0, '18', '', 3),
 ('bx_payment_grid_orders_history', 'amount', '_bx_payment_grid_column_title_ods_amount', '10%', 1, '10', '', 4),
 ('bx_payment_grid_orders_history', 'date', '_bx_payment_grid_column_title_ods_date', '10%', 0, '10', '', 5),
 ('bx_payment_grid_orders_history', 'actions', '', '12%', 0, '', '', 6),
@@ -296,7 +296,7 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 ('bx_payment_grid_orders_processed', 'checkbox', '', '2%', 0, '', '', 1),
 ('bx_payment_grid_orders_processed', 'client_id', '_bx_payment_grid_column_title_ods_client_id', '22%', 0, '18', '', 2),
 ('bx_payment_grid_orders_processed', 'transaction', '_bx_payment_grid_column_title_ods_transaction', '20%', 0, '18', '', 3),
-('bx_payment_grid_orders_processed', 'license', '_bx_payment_grid_column_title_ods_license', '20%', 0, '18', '', 4),
+('bx_payment_grid_orders_processed', 'item', '_bx_payment_grid_column_title_ods_item', '20%', 0, '18', '', 4),
 ('bx_payment_grid_orders_processed', 'amount', '_bx_payment_grid_column_title_ods_amount', '10%', 1, '10', '', 5),
 ('bx_payment_grid_orders_processed', 'date', '_bx_payment_grid_column_title_ods_date', '10%', 0, '10', '', 6),
 ('bx_payment_grid_orders_processed', 'actions', '', '16%', 0, '', '', 7),

+ 5 - 0
modules/boonex/payment/template/order_history.html

@@ -12,6 +12,11 @@
 		    <div class="bx-payment-vo-row bx-def-padding-thd-topbottom bx-def-border-top bx-clearfix">
 		        <div class="bx-payment-vo-caption bx-def-padding-thd-left bx-def-box-sizing">__txt_order__</div><div class="bx-payment-vo-content">__order__</div>
 		    </div>
+                    <bx_if:show_license>
+                        <div class="bx-payment-vo-row bx-def-padding-thd bx-def-border-top bx-clearfix">
+                            <div class="bx-payment-vo-caption">__txt_license__</div><div class="bx-payment-vo-content">__license__</div>
+                        </div>
+                    </bx_if:show_license>
 		    <div class="bx-payment-vo-row bx-def-padding-thd-topbottom bx-def-border-top bx-clearfix">
 		        <div class="bx-payment-vo-caption bx-def-padding-thd-left bx-def-box-sizing">__txt_date__</div><div class="bx-payment-vo-content">__date__</div>
 		    </div>

+ 5 - 0
modules/boonex/payment/template/order_processed.html

@@ -9,6 +9,11 @@
 			<div class="bx-payment-vo-row bx-def-padding-thd bx-def-border-top bx-clearfix">
 				<div class="bx-payment-vo-caption">__txt_order__</div><div class="bx-payment-vo-content">__order__</div>
 			</div>
+                        <bx_if:show_license>
+                            <div class="bx-payment-vo-row bx-def-padding-thd bx-def-border-top bx-clearfix">
+                                <div class="bx-payment-vo-caption">__txt_license__</div><div class="bx-payment-vo-content">__license__</div>
+                            </div>
+                        </bx_if:show_license>
 			<div class="bx-payment-vo-row bx-def-padding-thd bx-def-border-top bx-clearfix">
 				<div class="bx-payment-vo-caption">__txt_processed_with__</div><div class="bx-payment-vo-content">__provider__</div>
 			</div>

+ 2 - 0
modules/boonex/russian/data/langs/bx_payment/ru.xml

@@ -98,6 +98,7 @@
 	<string name="_bx_payment_grid_column_title_ods_seller_id"><![CDATA[Продавец]]></string>
 	<string name="_bx_payment_grid_column_title_ods_transaction"><![CDATA[Транзакция]]></string>
 	<string name="_bx_payment_grid_column_title_ods_license"><![CDATA[Лицензия]]></string>
+        <string name="_bx_payment_grid_column_title_ods_item"><![CDATA[Продукт]]></string>
 	<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>
@@ -240,6 +241,7 @@
 	<string name="_bx_payment_txt_checkout_to"><![CDATA[Продолжить оплату в пользу {0}]]></string>
 	<string name="_bx_payment_txt_checkout_with"><![CDATA[Заплатить используя {0}]]></string>
 	<string name="_bx_payment_txt_client"><![CDATA[Покупатель]]></string>
+        <string name="_bx_payment_txt_license"><![CDATA[Лицензия]]></string>
 	<string name="_bx_payment_txt_seller"><![CDATA[Продавец]]></string>
 	<string name="_bx_payment_txt_order"><![CDATA[ID заказа]]></string>
 	<string name="_bx_payment_txt_processed_with"><![CDATA[Обработан используя]]></string>