<?php
 namespace Modules\Admin\CurrencyExchange\HistoryRates; class Controller extends \App\Mvc\Controller\Form\PopupAbstract { protected function initialize() { parent::initialize(); $this->actionsCfg['index'] = [ 'checkSection' => 'Modules/Admin/CurrencyExchange', 'checkOption' => false ]; } protected function getDefaultFormData($R) { $formData = $R; $formData['currencyExchDate'] = TODAY_ISO; return $formData; } protected function processFormData(array $R, \App\MessagesCollector $msgs) { } protected function preRenderOperations($view, $formData) { $formData = $view->getInput('formData'); $rates = \App\CurrencyExchange\Date::getInstance($formData['currencyExchDate']); $lastDefinedDate = $rates->getLastDefinedDate(); if ($formData['currencyExchDate'] != $lastDefinedDate) { $view->getMessagesCollector()->addWarning(sprintf($this->lang['index']['currFromPreviousDate'], \Engine\DateTime::createFromIsoDate($lastDefinedDate)->formatDateStd(), \Engine\DateTime::createFromIsoDate($formData['currencyExchDate'])->formatDateStd())); } } }