From: Vladimir Fomichev Date: Thu, 21 Aug 2025 09:00:43 +0000 (+0300) Subject: Меняем фильтр на промежутки X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=4988830ccc04611119b8f623976a158998ef48a5;p=erp24_rep%2Fyii-erp24%2F.git Меняем фильтр на промежутки --- diff --git a/erp24/controllers/Products1cNomenclatureActualityController.php b/erp24/controllers/Products1cNomenclatureActualityController.php index 641c335a..3003c2b7 100644 --- a/erp24/controllers/Products1cNomenclatureActualityController.php +++ b/erp24/controllers/Products1cNomenclatureActualityController.php @@ -154,13 +154,15 @@ class Products1cNomenclatureActualityController extends Controller ->where('a.guid = n.id'); if ($hasDf && !$hasDt) { - $dateExists->andWhere(['a.date_from' => $df]); + $dateExists//->andWhere(['a.date_from' => $df]) + ->andWhere(['>=', 'a.date_to', $df]);; } elseif (!$hasDf && $hasDt) { - $dateExists->andWhere(['a.date_to' => $dt]); + $dateExists//->andWhere(['a.date_to' => $dt]) + ->andWhere(['<=', 'a.date_from', $dt]); } else { $dateExists - ->andWhere(['>=', 'a.date_from', $df]) - ->andWhere(['<=', 'a.date_to', $dt]); + ->andWhere(['>=', 'a.date_to', $df]) + ->andWhere(['<=', 'a.date_from', $dt]); } if (!empty($filter->onlyInactive)) { @@ -171,12 +173,14 @@ class Products1cNomenclatureActualityController extends Controller $query->with(['actualities' => function ($q) use ($hasDf, $hasDt, $df, $dt) { if ($hasDf && !$hasDt) { - $q->andWhere(['date_from' => $df]); + $q//->andWhere(['date_from' => $df]) + ->andWhere(['>=', 'date_to', $df]); } elseif (!$hasDf && $hasDt) { - $q->andWhere(['date_to' => $dt]); + $q//->andWhere(['date_to' => $dt]) + ->andWhere(['<=', 'date_from', $dt]); } else { - $q->andWhere(['>=', 'date_from', $df]) - ->andWhere(['<=', 'date_to', $dt]); + $q->andWhere(['>=', 'date_to', $df]) + ->andWhere(['<=', 'date_from', $dt]); } $q->orderBy(['date_from' => SORT_ASC]); }]); diff --git a/erp24/views/products1c-nomenclature-actuality/index.php b/erp24/views/products1c-nomenclature-actuality/index.php index fba62078..6aa70cef 100644 --- a/erp24/views/products1c-nomenclature-actuality/index.php +++ b/erp24/views/products1c-nomenclature-actuality/index.php @@ -25,7 +25,7 @@ $this->registerJsFile('/js/products1cNomenclatureActuality/index.js', ['position function monthList() { $list = []; - $start = new DateTime('2021-01'); + $start = new DateTime('2025-01'); $end = new DateTime('2026-12'); while ($start <= $end) { $key = $start->format('Y-m');