16 Loader::includeModule(
'currency');
20 $request = Context::getCurrent()->getRequest();
25 'TAB' => Loc::getMessage(
'CURRENCY_SETTINGS'),
26 'ICON' =>
'currency_settings',
27 'TITLE' => Loc::getMessage(
'CURRENCY_SETTINGS_TITLE'),
31 'TAB' => Loc::getMessage(
'CO_TAB_RIGHTS'),
32 'ICON' =>
'currency_settings',
33 'TITLE' => Loc::getMessage(
'CO_TAB_RIGHTS_TITLE'),
40 'DIV' =>
'proc_edit0',
41 'TAB' => Loc::getMessage(
'CURRENCY_BASE_RATE'),
43 'TITLE' => Loc::getMessage(
'CURRENCY_BASE_RATE_TITLE'),
46 'DIV' =>
'proc_edit1',
47 'TAB' => Loc::getMessage(
'CURRENCY_AGENTS'),
49 'TITLE' => Loc::getMessage(
'CURRENCY_AGENTS_TITLE'),
55 $request->getRequestMethod() ===
'GET'
56 &&
$request->get(
'RestoreDefaults') !==
null
61 Option::delete(
'currency');
74 $userGroupIds[] = (int)$row[
'ID'];
77 if (!empty($userGroupIds))
92 if (
$request->getPost(
'Update') ===
'Y')
94 $newBaseCurrency =
$request->getPost(
'BASE_CURRENCY');
95 if (!is_string($newBaseCurrency))
97 $newBaseCurrency =
null;
99 $newBaseCurrency = trim((
string)$newBaseCurrency);
100 if ($newBaseCurrency !==
'')
106 require_once
$_SERVER[
'DOCUMENT_ROOT'] .
'/bitrix/modules/main/admin/group_rights.php';
111 if (
$request->getPost(
'procedures') ===
'Y' &&
$request->getPost(
'action') ===
'recalc')
113 Currency\CurrencyManager::updateBaseRates();
116 if (
$request->getPost(
'agents') ===
'Y' && !empty($_POST[
'action']))
130 $agentIterator = CAgent::GetList(
133 'MODULE_ID' =>
'currency',
134 '=NAME' =>
'\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
137 $currencyAgent = $agentIterator->Fetch();
138 unset($agentIterator);
139 if (!empty($currencyAgent))
141 $active = (
$action ===
'activate' ?
'Y' :
'N');
143 $currencyAgent[
'ID'],
151 $checkDate = DateTime::createFromTimestamp(strtotime(
'tomorrow 00:01:00'));
153 '\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
159 $checkDate->toString(),
171 $baseCurrency = Currency\CurrencyManager::getBaseCurrency();
175 <form method=
"POST" action=
"<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name=
"currency_settings">
180 <td
style=
"width: 40%;"><?= HtmlFilter::encode(Loc::getMessage(
'BASE_CURRENCY')); ?></td>
181 <td><
select name=
"BASE_CURRENCY"><?php
182 $currencyList = Currency\CurrencyManager::getCurrencyList();
183 if (!empty($currencyList))
187 ?><option value=
"<?= HtmlFilter::encode($currency); ?>"<?= (
$currency === $baseCurrency ?
' selected' :
''); ?>><?php
188 echo HtmlFilter::encode(
$title);
193 unset($currencyList);
199 require_once
$_SERVER[
'DOCUMENT_ROOT'] .
'/bitrix/modules/main/admin/group_rights.php';
203function RestoreDefaults()
205 if (confirm(
'<?= CUtil::JSEscape(Loc::getMessage("CUR_OPTIONS_BTN_HINT_RESTORE_DEFAULT_WARNING")); ?>'))
207 window.location =
"<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>&RestoreDefaults=Y&<?= bitrix_sessid_get()?>";
215 value=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_SAVE')); ?>"
216 title=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_SAVE_TITLE')); ?>"
218 <input type=
"hidden" name=
"Update" value=
"Y">
222 value=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESET')); ?>"
223 title=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESET_TITLE')); ?>"
227 value=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESTORE_DEFAULT')); ?>"
228 title=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_HINT_RESTORE_DEFAULT')); ?>"
229 onclick=
"RestoreDefaults();"
234 ?><h2><?= Loc::getMessage(
'CURRENCY_PROCEDURES'); ?></h2><?php
237 ?><form method=
"POST" action=
"<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name=
"currency_procedures"><?php
240 <input type=
"hidden" name=
"action" value=
"recalc">
242 type=
"submit"<?= (
$moduleAccessLevel <
"W" || $baseCurrency ===
'' ?
' disabled' :
''); ?>
244 value=
"<?= HtmlFilter::encode(Loc::getMessage('CUR_PROCEDURES_BTN_RECALC')); ?>"
246 <input type=
"hidden" name=
"procedures" value=
"Y">
249 ?><form method=
"POST" action=
"<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name=
"currency_agents"><?php
251 ?><h4><?= Loc::getMessage(
'CURRENCY_BASE_RATE_AGENT'); ?></h4><?php
252 $currencyAgent =
false;
253 $agentIterator = CAgent::GetList(
256 'MODULE_ID' =>
'currency',
257 '=NAME' =>
'\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
262 $currencyAgent = $agentIterator->Fetch();
264 if (!empty($currencyAgent))
266 $currencyAgent[
'LAST_EXEC'] = (string)$currencyAgent[
'LAST_EXEC'];
267 $currencyAgent[
'NEXT_EXEC'] = (string)$currencyAgent[
'NEXT_EXEC'];
268 ?><b><?= Loc::getMessage(
'CURRENCY_BASE_RATE_AGENT_ACTIVE'); ?>:</b>&
nbsp;<?= (
269 $currencyAgent[
'ACTIVE'] ===
'Y'
270 ? Loc::getMessage(
'CURRENCY_AGENTS_ACTIVE_YES')
271 : Loc::getMessage(
'CURRENCY_AGENTS_ACTIVE_NO')
273 if ($currencyAgent[
'LAST_EXEC'])
275 ?><b><?= Loc::getMessage(
'CURRENCY_AGENTS_LAST_EXEC'); ?>:</b>&
nbsp;<?= $currencyAgent[
'LAST_EXEC']; ?><br><?php
276 if ($currencyAgent[
'ACTIVE'] ===
'Y')
278 ?><b><?= Loc::getMessage(
'CURRENCY_AGENTS_NEXT_EXEC');?>:</b>&
nbsp;<?= $currencyAgent[
'NEXT_EXEC']; ?><br><?php
281 elseif ($currencyAgent[
'ACTIVE'] ===
'Y')
283 ?><b><?= Loc::getMessage(
'CURRENCY_AGENTS_PLANNED_NEXT_EXEC') ?>:</b>&
nbsp;<?= $currencyAgent[
'NEXT_EXEC']; ?><br><?php
285 if ($currencyAgent[
'ACTIVE'] !==
'Y')
287 ?><br><input type=
"hidden" name=
"action" value=
"activate">
288 <input type=
"submit" name=
"activate" value=
"<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_ACTIVATE')); ?>"><?php
292 ?><br><input type=
"hidden" name=
"action" value=
"deactivate">
293 <input type=
"submit" name=
"deactivate" value=
"<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_DEACTIVATE')); ?>"><?php
298 ?><b><?= Loc::getMessage(
'CURRENCY_BASE_RATE_AGENT_ABSENT'); ?></b><br><br>
299 <input type=
"hidden" name=
"action" value=
"create">
300 <input type=
"submit" name=
"startagent" value=
"<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_CREATE_AGENT')); ?>">
304 ?><input type=
"hidden" name=
"agents" value=
"Y">
if($canUseYandexMarket) if(! $useSaleDiscountOnly||$catalogCount > 0) if($strUseStoreControl==='N' && $catalogCount > 0 $systemTabControl)
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static SetBaseCurrency($currency)
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
$_SERVER["DOCUMENT_ROOT"]
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
check_bitrix_sessid($varname='sessid')
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
<? endif;?> window document title
if($showbasketDiscountConvert) $systemTabs[]