diff --git a/RELEASE b/RELEASE index 12210c86d..9d2f7fac4 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.4.9 rev 9214 +1.4.9 rev 9215 diff --git a/api/libs/api.ddt.php b/api/libs/api.ddt.php index 6b2772501..14dc32314 100644 --- a/api/libs/api.ddt.php +++ b/api/libs/api.ddt.php @@ -146,6 +146,11 @@ class DoomsDayTariffs { */ const URL_HIST = '?module=ddt&history=true'; + /** + * Forced charges history URL + */ + const URL_CH_HIST = '&mode=fch'; + /** * Default user profile link URL */ @@ -167,6 +172,7 @@ class DoomsDayTariffs { const TABLE_USERREG = 'userreg'; const ROUTE_CH_DELETE = 'deletechargeruleid'; + const ROUTE_CH_HISTAJX = 'forcedchargehistoryajax'; const PROUTE_CH_CREATE = 'newchargetariffcreation'; const PROUTE_CH_TARIFF = 'newchargetariff'; const PROUTE_CH_UDAY = 'newchargeuntilday'; @@ -652,6 +658,7 @@ public function runProcessing() { $nativeTariffData = $this->allTariffs[$currentUserTariff]; $nativeTariffFee = $nativeTariffData['Fee']; $nativeTariffPeriod = (isset($nativeTariffData['period'])) ? $nativeTariffData['period'] : 'month'; + log_register('DDT FEE CHARGE (' . $eachUserLogin . ') TARIFF `' . $currentUserTariff . '` ON -' . $nativeTariffFee); zb_CashAdd($eachUserLogin, '-' . $nativeTariffFee, 'correct', 1, 'DDT: ' . $currentUserTariff); //setting credit if required @@ -703,7 +710,9 @@ public function renderControls() { if (cfr('DDTCONF')) { $result .= wf_Link(self::URL_ME, web_icon_extended() . ' ' . __('Configuration'), false, 'ubButton'); } - $result .= wf_Link(self::URL_HIST, wf_img('skins/icon_calendar.gif') . ' ' . __('History'), false, 'ubButton'); + $result .= wf_Link(self::URL_HIST, wf_img('skins/icon_calendar.gif') . ' ' . __('Doomsday tariffs history'), false, 'ubButton'); + $result .= wf_Link(self::URL_HIST . self::URL_CH_HIST, wf_img('skins/icon_dollar_16.gif') . ' ' . __('Forced charges history'), false, 'ubButton'); + return ($result); } @@ -1035,7 +1044,7 @@ public function runChargeRules() { } //charging from user - log_register('DDT CHARGE (' . $eachUserLogin . ') TARIFF `' . $currentUserTariff . '` ON -' . $chargeFeeAmount); + log_register('DDT FORCED CHARGE (' . $eachUserLogin . ') TARIFF `' . $currentUserTariff . '` ON -' . $chargeFeeAmount); $chargeComment = 'DDT: ' . $currentUserTariff; zb_CashAdd($eachUserLogin, '-' . $chargeFeeAmount, 'correct', 1, $chargeComment); $this->logCharge($eachUserLogin, $currentDate, $currentUserTariff, $chargeFeeAmount); @@ -1048,4 +1057,47 @@ public function runChargeRules() { } } } + + /** + * Renders forced charges history report container + * + * @return string + */ + public function renderChargesHistoryContainer() { + $result = ''; + if (!empty($this->allDDTUsers)) { + $opts = '"order": [[ 1, "desc" ]]'; + $ajaxUrl = self::URL_ME . '&' . self::ROUTE_CH_HISTAJX . '=true'; + + $columns = array('User', 'Date', 'Tariff', 'Sum'); + $result .= wf_JqDtLoader($columns, $ajaxUrl, false, __('Users'), 100, $opts); + } else { + $result .= $this->messages->getStyledMessage(__('There is nothing to watch'), 'warning'); + } + return ($result); + } + + /** + * Renders DDT history report json data + * + * @return void + */ + public function getChargesHistoryAjax() { + $json = new wf_JqDtHelper(); + $allChargesHistory = $this->chargeHistDb->getAll(); + + if (!empty($allChargesHistory)) { + $userFullData = zb_UserGetAllDataCache(); + foreach ($allChargesHistory as $io => $each) { + $userLink = isset($userFullData[$each['login']]) ? wf_Link(self::URL_PROFILE . $each['login'], web_profile_icon() . ' ' . $userFullData[$each['login']]['fulladress']) : $each['login']; + $data[] = $userLink; + $data[] = $each['chargedate']; + $data[] = $each['tariff']; + $data[] = $each['summ']; + $json->addRow($data); + unset($data); + } + } + $json->getJson(); + } } diff --git a/languages/russian/ddt.php b/languages/russian/ddt.php index 49acebd07..c515a30c1 100644 --- a/languages/russian/ddt.php +++ b/languages/russian/ddt.php @@ -37,5 +37,7 @@ $lang['def']['Additional amount'] = 'Дополнительная сума'; $lang['def']['Credit days'] = 'Дней кредита'; $lang['def']['rule for'] = 'правило для'; +$lang['def']['Doomsday tariffs history'] = 'История тарифов судного дня'; +$lang['def']['Forced charges history'] = 'История принудительных начислений'; diff --git a/languages/ukrainian/ddt.php b/languages/ukrainian/ddt.php index 594e7b0c9..b8caf3918 100644 --- a/languages/ukrainian/ddt.php +++ b/languages/ukrainian/ddt.php @@ -37,3 +37,5 @@ $lang['def']['Additional amount'] = 'Додаткова сума'; $lang['def']['Credit days'] = 'Днів кредиту'; $lang['def']['rule for'] = 'правило для'; +$lang['def']['Doomsday tariffs history'] = 'Історія тарифів судного дня'; +$lang['def']['Forced charges history'] = 'Історія примусових нарахувань'; diff --git a/modules/general/ddt/index.php b/modules/general/ddt/index.php index 1ab8c93c6..f3ecf0509 100644 --- a/modules/general/ddt/index.php +++ b/modules/general/ddt/index.php @@ -51,23 +51,35 @@ } } + if (ubRouting::checkGet($ddt::ROUTE_CH_HISTAJX)) { + $ddt->getChargesHistoryAjax(); + } + $avidity_m = $avidity['M']['ASAKO']; show_window('', $ddt->$avidity_m()); if (!ubRouting::checkGet($avidity['Y']['TWELVE'])) { - // $avidity_m = $avidity['M']['JB']; - // show_window(__($avidity['L']['REM']), $ddt->$avidity_m()); $avidity_m = $avidity['M']['MEGUMIN']; show_window(__($avidity['L']['RAM']), $ddt->$avidity_m()); show_window(__('Forced tariffs charge'), $ddt->renderChargeOpsList()); } else { - if (ubRouting::checkGet($avidity['V']['SAD'])) { - $avidity_m = $avidity['M']['BUTTRUE']; - $ddt->$avidity_m(); - } + if (!ubRouting::checkGet('mode')) { + if (ubRouting::checkGet($avidity['V']['SAD'])) { + $avidity_m = $avidity['M']['BUTTRUE']; + $ddt->$avidity_m(); + } - $avidity_m = $avidity['M']['SUBARU']; - show_window(__($avidity['L']['LYAK']), $ddt->$avidity_m(ubRouting::get($avidity['V']['ZHEKA']))); + $avidity_m = $avidity['M']['SUBARU']; + show_window(__($avidity['L']['LYAK']), $ddt->$avidity_m(ubRouting::get($avidity['V']['ZHEKA']))); + } else { + $hMode=ubRouting::get('mode','gigasafe'); + switch ($hMode) { + case 'fch': + show_window(__('Forced charges history'),$ddt->renderChargesHistoryContainer()); + break; + } + + } } zb_BillingStats(true); } else {