From ce09dbebdccf8f47630b564a32f6bd5e12ed9664 Mon Sep 17 00:00:00 2001 From: Marina Zozirova Date: Wed, 15 Jan 2025 08:28:21 +0000 Subject: [PATCH] =?utf8?q?ERP-274=20=D0=92=D0=B2=D0=B5=D1=81=D1=82=D0=B8?= =?utf8?q?=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=BE=D0=BD=D0=BD=D0=BE=D1=81?= =?utf8?q?=D1=82=D1=8C=20js=20=D0=B8=20css=20=D1=84=D0=B0=D0=B9=D0=BB?= =?utf8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/assets/CommonAsset.php | 6 ++++++ erp24/assets/FileVersionService.php | 19 +++++++++++++++++++ erp24/assets/timetable/StartAsset.php | 12 ++++++++++++ erp24/assets/timetable/TimetableAsset.php | 12 ++++++++++++ erp24/forms/timetable/TabelSearchForm.php | 7 +++++-- 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 erp24/assets/FileVersionService.php diff --git a/erp24/assets/CommonAsset.php b/erp24/assets/CommonAsset.php index 0ec2b8f1..d0f4e0d1 100755 --- a/erp24/assets/CommonAsset.php +++ b/erp24/assets/CommonAsset.php @@ -23,6 +23,12 @@ class CommonAsset extends AssetBundle public function init() { + foreach (['js', 'css'] as $type) { + foreach ($this->$type as &$file) { + $file = FileVersionService::versionFile($file); + } + } + $u = file_get_contents(__DIR__ . '/../inc/compress_timestamp.php'); if (preg_match('/=\s*(?P\d+);/', $u, $matches)) { array_unshift($this->css, '/min/css_' . $matches['stamp'] . '.css'); diff --git a/erp24/assets/FileVersionService.php b/erp24/assets/FileVersionService.php new file mode 100644 index 00000000..e1619f64 --- /dev/null +++ b/erp24/assets/FileVersionService.php @@ -0,0 +1,19 @@ + true]; + + public function init() + { + parent::init(); + + foreach (['js', 'css'] as $type) { + foreach ($this->$type as &$file) { + $file = FileVersionService::versionFile($file); + } + } + } } diff --git a/erp24/assets/timetable/TimetableAsset.php b/erp24/assets/timetable/TimetableAsset.php index d6a99a9d..972b4abb 100755 --- a/erp24/assets/timetable/TimetableAsset.php +++ b/erp24/assets/timetable/TimetableAsset.php @@ -2,6 +2,7 @@ namespace yii_app\assets\timetable; +use app\assets\FileVersionService; use yii\web\AssetBundle; class TimetableAsset extends AssetBundle @@ -17,4 +18,15 @@ class TimetableAsset extends AssetBundle '/css/print.css', ]; public $jsOptions = ['defer' => true]; + + public function init() + { + parent::init(); + + foreach (['js', 'css'] as $type) { + foreach ($this->$type as &$file) { + $file = FileVersionService::versionFile($file); + } + } + } } diff --git a/erp24/forms/timetable/TabelSearchForm.php b/erp24/forms/timetable/TabelSearchForm.php index ebbd6a24..ad0b7f3f 100755 --- a/erp24/forms/timetable/TabelSearchForm.php +++ b/erp24/forms/timetable/TabelSearchForm.php @@ -3,6 +3,7 @@ declare(strict_types = 1); namespace yii_app\forms\timetable; +use yii_app\records\AdminStores; use yii_app\records\TimetableFactModel; use yii\base\Model; use yii\db\ActiveQuery; @@ -51,10 +52,12 @@ class TabelSearchForm extends Model { $stores = CityStore::find() ->select(['name', 'id']) - ->andWhere(['id' => $_SESSION["store_arr_dostup"]]) + ->andWhere(['id' => AdminStores::find() + ->andWhere(['admin_id' => \Yii::$app->user->id]) + ->select('store_id') + ->column()]) ->andWhere(['visible' => '1']) ->indexBy('id') - ->cache(3600) ->column(); natsort($stores); return $stores; -- 2.39.5