From 3cee08291da828dd06186b0dc20290a19e704a4b Mon Sep 17 00:00:00 2001
From: AntonLV
Date: Fri, 18 Mar 2022 13:11:03 +0300
Subject: [PATCH] Ticket #3714 - Credits: Add possibility for common users to
Send their credits.
---
.../credits/classes/BxCreditsConfig.php | 6 +-
...rmWithdraw.php => BxCreditsFormCredit.php} | 8 ++-
.../BxCreditsGridHistoryAdministration.php | 39 +++++++------
.../classes/BxCreditsGridHistoryCommon.php | 15 +++--
.../BxCreditsGridOrdersAdministration.php | 18 +++---
.../classes/BxCreditsGridOrdersCommon.php | 6 +-
.../credits/classes/BxCreditsModule.php | 58 +++++++++++++++++--
modules/boonex/credits/install/langs/en.xml | 14 +++++
modules/boonex/credits/install/sql/enable.sql | 16 ++---
.../boonex/credits/install/sql/install.sql | 10 +++-
.../russian/data/langs/bx_credits/ru.xml | 13 +++++
11 files changed, 154 insertions(+), 49 deletions(-)
rename modules/boonex/credits/classes/{BxCreditsFormWithdraw.php => BxCreditsFormCredit.php} (94%)
diff --git a/modules/boonex/credits/classes/BxCreditsConfig.php b/modules/boonex/credits/classes/BxCreditsConfig.php
index eba82ddfaa..d8db2eee6f 100644
--- a/modules/boonex/credits/classes/BxCreditsConfig.php
+++ b/modules/boonex/credits/classes/BxCreditsConfig.php
@@ -69,6 +69,7 @@ function __construct($aModule)
// objects
'OBJECT_FORM_CREDIT' => 'bx_credits_credit',
'OBJECT_FORM_CREDIT_DISPLAY_GRANT' => 'bx_credits_credit_grant',
+ 'OBJECT_FORM_CREDIT_DISPLAY_SEND' => 'bx_credits_credit_send',
'OBJECT_FORM_CREDIT_DISPLAY_WITHDRAW_REQUEST' => 'bx_credits_credit_withdraw_request',
'OBJECT_FORM_CREDIT_DISPLAY_WITHDRAW_CONFIRM' => 'bx_credits_credit_withdraw_confirm',
'OBJECT_FORM_BUNDLE' => 'bx_credits_bundle',
@@ -84,6 +85,7 @@ function __construct($aModule)
// email templates
'ETEMPLATE_GRANTED' => 'bx_credits_granted',
+ 'ETEMPLATE_RECEIVED' => 'bx_credits_received',
'ETEMPLATE_PURCHASED' => 'bx_credits_purchased',
'ETEMPLATE_IN' => 'bx_credits_in',
'ETEMPLATE_OUT' => 'bx_credits_out',
@@ -94,6 +96,7 @@ function __construct($aModule)
'T' => array (
'txt_sample_single' => '_bx_credits_txt_sample_single',
'grant_popup' => '_bx_credits_grid_popup_title_htr_grant',
+ 'send_popup' => '_bx_credits_grid_popup_title_htr_send',
'withdraw_request_popup' => '_bx_credits_grid_popup_title_htr_withdraw_request',
'withdraw_confirm_popup' => '_bx_credits_grid_popup_title_htr_withdraw_confirm',
),
@@ -118,6 +121,7 @@ function __construct($aModule)
'add_bundle_popup' => $sPrefix . '-add-bundle-popup',
'edit_bundle_popup' => $sPrefix . '-edit-bundle-popup',
+ 'send_popup' => $sPrefix . '-send-popup',
'grant_popup' => $sPrefix . '-grant-popup',
'withdraw_request_popup' => $sPrefix . '-withdraw-request-popup',
'withdraw_confirm_popup' => $sPrefix . '-withdraw-confirm-popup',
@@ -224,7 +228,7 @@ public function setCheckoutData($aData)
public function getOrder($iLength = 16)
{
- return genRndPwd($iLength, false);
+ return strtoupper(genRndPwd($iLength, false));
}
/**
diff --git a/modules/boonex/credits/classes/BxCreditsFormWithdraw.php b/modules/boonex/credits/classes/BxCreditsFormCredit.php
similarity index 94%
rename from modules/boonex/credits/classes/BxCreditsFormWithdraw.php
rename to modules/boonex/credits/classes/BxCreditsFormCredit.php
index 7a09541cae..bde3d93109 100644
--- a/modules/boonex/credits/classes/BxCreditsFormWithdraw.php
+++ b/modules/boonex/credits/classes/BxCreditsFormCredit.php
@@ -10,9 +10,9 @@
*/
/**
- * Withdraw form
+ * Credit form
*/
-class BxCreditsFormWithdraw extends BxTemplFormView
+class BxCreditsFormCredit extends BxTemplFormView
{
protected $_sModule;
protected $_oModule;
@@ -37,6 +37,10 @@ public function __construct($aInfo, $oTemplate = false)
$sInfo .= 'g';
break;
+ case $CNF['OBJECT_FORM_CREDIT_DISPLAY_SEND']:
+ $sInfo .= 's';
+ break;
+
case $CNF['OBJECT_FORM_CREDIT_DISPLAY_WITHDRAW_REQUEST']:
$sInfo .= 'wr';
break;
diff --git a/modules/boonex/credits/classes/BxCreditsGridHistoryAdministration.php b/modules/boonex/credits/classes/BxCreditsGridHistoryAdministration.php
index ab6f7a40b6..e5f2adbf79 100644
--- a/modules/boonex/credits/classes/BxCreditsGridHistoryAdministration.php
+++ b/modules/boonex/credits/classes/BxCreditsGridHistoryAdministration.php
@@ -14,6 +14,7 @@ class BxCreditsGridHistoryAdministration extends BxTemplGrid
protected $_sModule;
protected $_oModule;
+ protected $_iUserId;
protected $_bWithdraw;
public function __construct ($aOptions, $oTemplate = false)
@@ -27,9 +28,11 @@ public function __construct ($aOptions, $oTemplate = false)
$this->_sDefaultSortingOrder = 'DESC';
- $iProfileId = bx_get_logged_profile_id();
- if($iProfileId !== false)
- $this->_aQueryAppend['profile_id'] = (int)$iProfileId;
+ $iUserId = bx_get_logged_profile_id();
+ if($iUserId !== false) {
+ $this->_iUserId = (int)$iUserId;
+ $this->_aQueryAppend['user_id'] = $this->_iUserId;
+ }
$this->_bWithdraw = $this->_oModule->_oConfig->isWithdraw();
}
@@ -53,7 +56,7 @@ public function performActionGrant()
public function performActionWithdrawConfirm()
{
if(!$this->_bWithdraw)
- return echoJson(array());
+ return echoJson([]);
$sAction = 'withdraw_confirm';
@@ -70,7 +73,7 @@ protected function _getActionWithdrawConfirm($sType, $sKey, $a, $isSmall = false
protected function _getCellDirection($mixedValue, $sKey, $aField, $aRow)
{
- if(in_array($mixedValue, array(BX_CREDITS_DIRECTION_IN, BX_CREDITS_DIRECTION_OUT)))
+ if(in_array($mixedValue, [BX_CREDITS_DIRECTION_IN, BX_CREDITS_DIRECTION_OUT]))
$mixedValue = _t('_bx_credits_txt_direction_' . $mixedValue);
return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
@@ -110,7 +113,7 @@ protected function _getProfile($mixedValue)
if(!$oProfile)
return $mixedValue;
- return $oProfile->getUnit(0, array('template' => array('name' => 'unit', 'size' => 'icon')));
+ return $oProfile->getUnit(0, ['template' => ['name' => 'unit', 'size' => 'icon']]);
}
protected function _performActionWithProfileAmount($sAction)
@@ -124,28 +127,28 @@ protected function _performActionWithProfileAmount($sAction)
$iProfile = (int)$oForm->getCleanValue('profile');
$fAmount = (float)$oForm->getCleanValue('amount');
$sMessage = $oForm->getCleanValue('message');
- $aResult = $this->_oModule->{'process' . bx_gen_method_name($sAction)}($iProfile, $fAmount, $sMessage);
+ $aResult = $this->_oModule->{'process' . bx_gen_method_name($sAction)}($this->_iUserId, $iProfile, $fAmount, $sMessage);
if((int)$aResult['code'] == 0)
- $aRes = array('msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_msg_action_performed'));
+ $aRes = ['msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_msg_action_performed')];
else
- $aRes = array('msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_err_cannot_perform_action'));
+ $aRes = ['msg' => _t(!empty($aResult['msg']) ? $aResult['msg'] : '_bx_credits_err_cannot_perform_action')];
echoJson($aRes);
}
else {
- $sContent = BxTemplFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds($sAction . '_popup'), _t($CNF['T'][$sAction . '_popup']), $this->_oModule->_oTemplate->parseHtmlByName('credit_form.html', array(
+ $sContent = BxTemplFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds($sAction . '_popup'), _t($CNF['T'][$sAction . '_popup']), $this->_oModule->_oTemplate->parseHtmlByName('credit_form.html', [
'form_id' => $oForm->aFormAttrs['id'],
'form' => $oForm->getCode(true),
'object' => $this->_sObject,
'action' => $sAction
- )));
+ ]));
- echoJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))));
+ echoJson(['popup' => ['html' => $sContent, 'options' => ['closeOnOuterClick' => false]]]);
}
}
- protected function _getFormObject($sAction, $aBundle = array())
+ protected function _getFormObject($sAction)
{
$CNF = &$this->_oModule->_oConfig->CNF;
@@ -158,17 +161,17 @@ protected function _getFormObject($sAction, $aBundle = array())
protected function _addJsCss()
{
parent::_addJsCss();
- $this->_oModule->_oTemplate->addJs(array(
+ $this->_oModule->_oTemplate->addJs([
'jquery.form.min.js',
'withdraw.js'
- ));
+ ]);
- $this->_oModule->_oTemplate->addCss(array(
+ $this->_oModule->_oTemplate->addCss([
'main.css',
'withdraw.css'
- ));
+ ]);
- $oForm = new BxTemplFormView(array());
+ $oForm = new BxTemplFormView([]);
$oForm->addCssJs();
}
}
diff --git a/modules/boonex/credits/classes/BxCreditsGridHistoryCommon.php b/modules/boonex/credits/classes/BxCreditsGridHistoryCommon.php
index ff621085e3..5e38082a1b 100644
--- a/modules/boonex/credits/classes/BxCreditsGridHistoryCommon.php
+++ b/modules/boonex/credits/classes/BxCreditsGridHistoryCommon.php
@@ -18,10 +18,17 @@ public function __construct ($aOptions, $oTemplate = false)
parent::__construct ($aOptions, $oTemplate);
}
+ public function performActionSend()
+ {
+ $sAction = 'send';
+
+ $this->_performActionWithProfileAmount($sAction);
+ }
+
public function performActionWithdrawRequest()
{
if(!$this->_bWithdraw)
- return echoJson(array());
+ return echoJson([]);
$sAction = 'withdraw_request';
@@ -38,10 +45,10 @@ protected function _getActionWithdrawRequest($sType, $sKey, $a, $isSmall = false
protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
{
- if(empty($this->_aQueryAppend['profile_id']))
- return array();
+ if(empty($this->_iUserId))
+ return [];
- $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `first_pid`=?", $this->_aQueryAppend['profile_id']);
+ $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `first_pid`=?", $this->_iUserId);
return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
}
diff --git a/modules/boonex/credits/classes/BxCreditsGridOrdersAdministration.php b/modules/boonex/credits/classes/BxCreditsGridOrdersAdministration.php
index 3055b61d8d..9987f185c9 100644
--- a/modules/boonex/credits/classes/BxCreditsGridOrdersAdministration.php
+++ b/modules/boonex/credits/classes/BxCreditsGridOrdersAdministration.php
@@ -14,6 +14,8 @@ class BxCreditsGridOrdersAdministration extends BxTemplGrid
protected $_sModule;
protected $_oModule;
+ protected $_iUserId;
+
public function __construct ($aOptions, $oTemplate = false)
{
$this->_sModule = 'bx_credits';
@@ -26,9 +28,11 @@ public function __construct ($aOptions, $oTemplate = false)
$this->_sDefaultSortingOrder = 'DESC';
$this->_aQueryReset = array($this->_aOptions['order_get_field'], $this->_aOptions['order_get_dir'], $this->_aOptions['paginate_get_start'], $this->_aOptions['paginate_get_per_page']);
- $iProfileId = bx_get_logged_profile_id();
- if($iProfileId !== false)
- $this->_aQueryAppend['profile_id'] = (int)$iProfileId;
+ $iUserId = bx_get_logged_profile_id();
+ if($iUserId !== false) {
+ $this->_iUserId = (int)$iUserId;
+ $this->_aQueryAppend['user_id'] = $this->_iUserId;
+ }
}
protected function _getCellProfileId($mixedValue, $sKey, $aField, $aRow)
@@ -38,11 +42,11 @@ protected function _getCellProfileId($mixedValue, $sKey, $aField, $aRow)
protected function _getCellBundle($mixedValue, $sKey, $aField, $aRow)
{
- $mixedValue = $this->_oTemplate->parseHtmlByName('bundle_link.html', array(
- 'href' => $this->_oModule->_oConfig->getBundleUrl(array('id' => $aRow['bundle_id'])),
+ $mixedValue = $this->_oTemplate->parseHtmlByName('bundle_link.html', [
+ 'href' => $this->_oModule->_oConfig->getBundleUrl(['id' => $aRow['bundle_id']]),
'title' => bx_html_attribute($mixedValue),
'content' => $mixedValue
- ));
+ ]);
return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
}
@@ -70,7 +74,7 @@ protected function _getProfile($mixedValue)
if(!$oProfile)
return $mixedValue;
- return $oProfile->getUnit(0, array('template' => array('name' => 'unit', 'size' => 'icon')));
+ return $oProfile->getUnit(0, ['template' => ['name' => 'unit', 'size' => 'icon']]);
}
}
diff --git a/modules/boonex/credits/classes/BxCreditsGridOrdersCommon.php b/modules/boonex/credits/classes/BxCreditsGridOrdersCommon.php
index 20265e3b86..9be5cd7675 100644
--- a/modules/boonex/credits/classes/BxCreditsGridOrdersCommon.php
+++ b/modules/boonex/credits/classes/BxCreditsGridOrdersCommon.php
@@ -20,10 +20,10 @@ public function __construct ($aOptions, $oTemplate = false)
protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
{
- if(empty($this->_aQueryAppend['profile_id']))
- return array();
+ if(empty($this->_iUserId))
+ return [];
- $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `to`.`profile_id`=?", $this->_aQueryAppend['profile_id']);
+ $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `to`.`profile_id`=?", $this->_iUserId);
return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
}
diff --git a/modules/boonex/credits/classes/BxCreditsModule.php b/modules/boonex/credits/classes/BxCreditsModule.php
index 33dda609d7..1ec91596b1 100644
--- a/modules/boonex/credits/classes/BxCreditsModule.php
+++ b/modules/boonex/credits/classes/BxCreditsModule.php
@@ -764,17 +764,17 @@ public function updateProfileBalance($iFirstPid, $iSecondPid, $fAmount, $sOrder
return true;
}
- public function processGrant($iProfileId, $fAmount, $sMessage = '')
+ public function processGrant($iUserId, $iProfileId, $fAmount, $sMessage = '')
{
$CNF = &$this->_oConfig->CNF;
$oProfile = BxDolProfile::getInstance($iProfileId);
if(!$oProfile)
- return array('code' => 1, 'msg' => '_bx_credits_err_profile_not_found');
+ return ['code' => 2, 'msg' => '_bx_credits_err_profile_not_found'];
$sInfo = '_bx_credits_txt_history_info_grant';
if(!$this->updateProfileBalance($iProfileId, 0, $fAmount, '', $sInfo))
- return array('code' => 2, 'msg' => '_bx_credits_err_cannot_update_balance');
+ return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];
sendMailTemplate($CNF['ETEMPLATE_GRANTED'], 0, $iProfileId, array(
'amount' => $fAmount,
@@ -789,7 +789,52 @@ public function processGrant($iProfileId, $fAmount, $sMessage = '')
return array('code' => 0);
}
- public function processWithdrawRequest($iProfileId, $fAmount, $sMessage = '')
+ public function processSend($iUserId, $iProfileId, $fAmount, $sMessage = '')
+ {
+ $CNF = &$this->_oConfig->CNF;
+
+ $fAmountAvail = $this->getProfileBalance($iUserId);
+ if($fAmount > $fAmountAvail)
+ return ['code' => 1, 'msg' => '_bx_credits_err_low_balance'];
+
+ $oProfile = BxDolProfile::getInstance($iProfileId);
+ if(!$oProfile)
+ return ['code' => 2, 'msg' => '_bx_credits_err_profile_not_found'];
+
+ $sOrder = $this->_oConfig->getOrder();
+ $sInfo = !empty($sMessage) ? $sMessage : '_bx_credits_txt_history_info_send';
+
+ if(!$this->updateProfileBalance($iUserId, $iProfileId, -$fAmount, $sOrder, $sInfo))
+ return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];
+
+ if(!$this->updateProfileBalance($iProfileId, $iUserId, $fAmount, $sOrder, $sInfo)) {
+ $sInfo = '_bx_credits_txt_history_info_cancellation';
+ $this->updateProfileBalance($iUserId, $iProfileId, $fAmount, $sOrder, $sInfo);
+
+ return ['code' => 3, 'msg' => '_bx_credits_err_cannot_update_balance'];
+ }
+
+ $oUser = BxDolProfile::getInstance($iUserId);
+ sendMailTemplate($CNF['ETEMPLATE_RECEIVED'], 0, $iProfileId, [
+ 'performer_id' => $iUserId,
+ 'performer_name' => $oUser->getDisplayName(),
+ 'performer_link' => $oUser->getUrl(),
+ 'amount' => $fAmount,
+ 'order' => $sOrder,
+ 'message' => $sMessage
+ ]);
+
+ bx_alert($this->getName(), 'sent', 0, $iUserId, [
+ 'performer' => $iUserId,
+ 'profile' => $iProfileId,
+ 'amount' => $fAmount,
+ 'order' => $sOrder,
+ ]);
+
+ return ['code' => 0];
+ }
+
+ public function processWithdrawRequest($iUserId, $iProfileId, $fAmount, $sMessage = '')
{
$CNF = &$this->_oConfig->CNF;
@@ -840,7 +885,7 @@ public function processWithdrawRequest($iProfileId, $fAmount, $sMessage = '')
return array('code' => 0);
}
- public function processWithdrawConfirm($iProfileId, $fAmount, $sMessage = '')
+ public function processWithdrawConfirm($iUserId, $iProfileId, $fAmount, $sMessage = '')
{
$CNF = &$this->_oConfig->CNF;
@@ -861,7 +906,8 @@ public function processWithdrawConfirm($iProfileId, $fAmount, $sMessage = '')
'message' => $sMessage
));
- bx_alert($this->getName(), 'withdraw_sent', 0, false, array(
+ bx_alert($this->getName(), 'withdraw_sent', 0, $iUserId, array(
+ 'performer' => $iUserId,
'profile' => $iProfileId,
'amount' => $fAmount,
));
diff --git a/modules/boonex/credits/install/langs/en.xml b/modules/boonex/credits/install/langs/en.xml
index 6a8afb59fe..716555b2c6 100644
--- a/modules/boonex/credits/install/langs/en.xml
+++ b/modules/boonex/credits/install/langs/en.xml
@@ -39,6 +39,7 @@
+
@@ -52,6 +53,7 @@
+
@@ -140,9 +142,11 @@
+
+
@@ -163,6 +167,13 @@
Hello, {profile_name}.
You're granted {amount} credits.
{message}
+{email_footer}]]>
+
+
+ Hello, {profile_name}.
+You've received {amount} credits from {performer_name}.
The order is {order}.
+{message}
{email_footer}]]>
@@ -211,11 +222,14 @@
{1} if you have any questions or need support.]]>
+
+
+
diff --git a/modules/boonex/credits/install/sql/enable.sql b/modules/boonex/credits/install/sql/enable.sql
index 0432920a8c..403e6b8099 100644
--- a/modules/boonex/credits/install/sql/enable.sql
+++ b/modules/boonex/credits/install/sql/enable.sql
@@ -90,7 +90,7 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
-- MENU: account dashboard
SET @iAccountDashboardMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name`='sys_account_dashboard' LIMIT 1);
INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES
-('sys_account_dashboard', 'bx_credits', 'credits-manage', '_bx_credits_menu_item_title_system_manage', '_bx_credits_menu_item_title_manage', 'page.php?i=credits-orders-common', '', '', 'copyright col-green3', '', '', 2147483646, 1, 0, 1, @iAccountDashboardMenuOrder + 1);
+('sys_account_dashboard', 'bx_credits', 'credits-manage', '_bx_credits_menu_item_title_system_manage', '_bx_credits_menu_item_title_manage', 'page.php?i=credits-history-common', '', '', 'copyright col-green3', '', '', 2147483646, 1, 0, 1, @iAccountDashboardMenuOrder + 1);
-- MENU: module sub-menu
INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
@@ -110,10 +110,10 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
('bx_credits_manage_submenu', 'bx_credits', '_bx_credits_menu_set_title_manage_submenu', 0);
INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES
-('bx_credits_manage_submenu', 'bx_credits', 'credits-orders-administration', '_bx_credits_menu_item_title_system_orders_administration', '_bx_credits_menu_item_title_orders_administration', 'page.php?i=credits-orders-administration', '', '_self', '', '', '', 192, 1, 0, 1, 1),
-('bx_credits_manage_submenu', 'bx_credits', 'credits-orders-common', '_bx_credits_menu_item_title_system_orders_common', '_bx_credits_menu_item_title_orders_common', 'page.php?i=credits-orders-common', '', '_self', '', '', '', 2147483646, 1, 0, 1, 2),
-('bx_credits_manage_submenu', 'bx_credits', 'credits-history-administration', '_bx_credits_menu_item_title_system_history_administration', '_bx_credits_menu_item_title_history_administration', 'page.php?i=credits-history-administration', '', '_self', '', '', '', 192, 1, 0, 1, 3),
-('bx_credits_manage_submenu', 'bx_credits', 'credits-history-common', '_bx_credits_menu_item_title_system_history_common', '_bx_credits_menu_item_title_history_common', 'page.php?i=credits-history-common', '', '_self', '', '', '', 2147483646, 1, 0, 1, 4);
+('bx_credits_manage_submenu', 'bx_credits', 'credits-history-common', '_bx_credits_menu_item_title_system_history_common', '_bx_credits_menu_item_title_history_common', 'page.php?i=credits-history-common', '', '_self', '', '', '', 2147483646, 1, 0, 1, 1)
+('bx_credits_manage_submenu', 'bx_credits', 'credits-history-administration', '_bx_credits_menu_item_title_system_history_administration', '_bx_credits_menu_item_title_history_administration', 'page.php?i=credits-history-administration', '', '_self', '', '', '', 192, 1, 0, 1, 2),
+('bx_credits_manage_submenu', 'bx_credits', 'credits-orders-common', '_bx_credits_menu_item_title_system_orders_common', '_bx_credits_menu_item_title_orders_common', 'page.php?i=credits-orders-common', '', '_self', '', '', '', 2147483646, 1, 0, 1, 3),
+('bx_credits_manage_submenu', 'bx_credits', 'credits-orders-administration', '_bx_credits_menu_item_title_system_orders_administration', '_bx_credits_menu_item_title_orders_administration', 'page.php?i=credits-orders-administration', '', '_self', '', '', '', 192, 1, 0, 1, 4);
-- MENU: dashboard manage tools
SET @iManageMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name`='sys_account_dashboard_manage_tools' LIMIT 1);
@@ -183,9 +183,10 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
('bx_credits_history_administration', 'independent', 'grant', '_bx_credits_grid_action_title_htr_grant', '', 0, 0, 1),
-('bx_credits_history_administration', 'independent', 'withdraw_confirm', '_bx_credits_grid_action_title_htr_withdraw_confirm', '', 0, 0, 1),
+('bx_credits_history_administration', 'independent', 'withdraw_confirm', '_bx_credits_grid_action_title_htr_withdraw_confirm', '', 0, 0, 2),
-('bx_credits_history_common', 'independent', 'withdraw_request', '_bx_credits_grid_action_title_htr_withdraw_request', '', 0, 0, 1);
+('bx_credits_history_common', 'independent', 'send', '_bx_credits_grid_action_title_htr_send', '', 0, 0, 1),
+('bx_credits_history_common', 'independent', 'withdraw_request', '_bx_credits_grid_action_title_htr_withdraw_request', '', 0, 0, 2);
-- ALERTS
@@ -202,6 +203,7 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
-- EMAIL TEMPLATES
INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES
('bx_credits', '_bx_credits_et_txt_name_granted', 'bx_credits_granted', '_bx_credits_et_txt_subject_granted', '_bx_credits_et_txt_body_granted'),
+('bx_credits', '_bx_credits_et_txt_name_received', 'bx_credits_received', '_bx_credits_et_txt_subject_received', '_bx_credits_et_txt_body_received'),
('bx_credits', '_bx_credits_et_txt_name_purchased', 'bx_credits_purchased', '_bx_credits_et_txt_subject_purchased', '_bx_credits_et_txt_body_purchased'),
('bx_credits', '_bx_credits_et_txt_name_in', 'bx_credits_in', '_bx_credits_et_txt_subject_in', '_bx_credits_et_txt_body_in'),
('bx_credits', '_bx_credits_et_txt_name_out', 'bx_credits_out', '_bx_credits_et_txt_subject_out', '_bx_credits_et_txt_body_out'),
diff --git a/modules/boonex/credits/install/sql/install.sql b/modules/boonex/credits/install/sql/install.sql
index a23be85bda..56b15774d6 100644
--- a/modules/boonex/credits/install/sql/install.sql
+++ b/modules/boonex/credits/install/sql/install.sql
@@ -71,9 +71,10 @@ CREATE TABLE IF NOT EXISTS `bx_credits_history` (
-- FORMS: credit
INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
-('bx_credits_credit', 'bx_credits', '_bx_credits_form_credit', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', '', '', '', '', 'a:1:{i:0;s:9:"do_submit";}', '', 0, 1, 'BxCreditsFormWithdraw', 'modules/boonex/credits/classes/BxCreditsFormWithdraw.php');
+('bx_credits_credit', 'bx_credits', '_bx_credits_form_credit', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', '', '', '', '', 'a:1:{i:0;s:9:"do_submit";}', '', 0, 1, 'BxCreditsFormCredit', 'modules/boonex/credits/classes/BxCreditsFormCredit.php');
INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
+('bx_credits_credit', 'bx_credits_credit_send', 'bx_credits', 0, '_bx_credits_form_credit_display_send'),
('bx_credits_credit', 'bx_credits_credit_grant', 'bx_credits', 0, '_bx_credits_form_credit_display_grant'),
('bx_credits_credit', 'bx_credits_credit_withdraw_request', 'bx_credits', 0, '_bx_credits_form_credit_display_withdraw_request'),
('bx_credits_credit', 'bx_credits_credit_withdraw_confirm', 'bx_credits', 0, '_bx_credits_form_credit_display_withdraw_confirm');
@@ -90,6 +91,13 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
('bx_credits_credit', 'bx_credits', 'do_cancel', '_bx_credits_form_credit_input_do_cancel', '', 0, 'button', '_bx_credits_form_credit_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('bx_credits_credit_send', 'profile', 2147483647, 1, 1),
+('bx_credits_credit_send', 'amount', 2147483647, 1, 2),
+('bx_credits_credit_send', 'message', 2147483647, 1, 3),
+('bx_credits_credit_send', 'controls', 2147483647, 1, 4),
+('bx_credits_credit_send', 'do_submit', 2147483647, 1, 5),
+('bx_credits_credit_send', 'do_cancel', 2147483647, 1, 6),
+
('bx_credits_credit_grant', 'profile', 2147483647, 1, 1),
('bx_credits_credit_grant', 'amount', 2147483647, 1, 2),
('bx_credits_credit_grant', 'message', 2147483647, 1, 3),
diff --git a/modules/boonex/russian/data/langs/bx_credits/ru.xml b/modules/boonex/russian/data/langs/bx_credits/ru.xml
index f92cb4cf0a..271c0a9fb0 100644
--- a/modules/boonex/russian/data/langs/bx_credits/ru.xml
+++ b/modules/boonex/russian/data/langs/bx_credits/ru.xml
@@ -39,6 +39,7 @@
+
@@ -52,6 +53,7 @@
+
@@ -140,9 +142,11 @@
+
+
@@ -163,6 +167,13 @@
Здравствуйте, {profile_name}.
Вам подарили {amount} кредитов.
{message}
+{email_footer}]]>
+
+
+ Здравствуйте, {profile_name}.
+Вы получили {amount} кредитов от {performer_name}.
Ордер: {order}.
+{message}
{email_footer}]]>
@@ -211,11 +222,13 @@
{1}, если у вас есть какие-либо вопросы или вам нужна поддержка.]]>
+
+