From: Marina Zozirova Date: Wed, 15 Jan 2025 08:28:21 +0000 (+0000) Subject: ERP-274 Ввести версионность js и css файлов X-Git-Tag: 1.7~77^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=ce09dbebdccf8f47630b564a32f6bd5e12ed9664;p=erp24_rep%2Fyii-erp24%2F.git ERP-274 Ввести версионность js и css файлов --- 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;