]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Меняем фильтр на промежутки feature_fomichev_erp-20250729_nomenclature_actual
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 21 Aug 2025 09:00:43 +0000 (12:00 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 21 Aug 2025 09:00:43 +0000 (12:00 +0300)
erp24/controllers/Products1cNomenclatureActualityController.php
erp24/views/products1c-nomenclature-actuality/index.php

index 641c335a3ee0c41e9d2ddde6b112635699d7b9e3..3003c2b7e595e625302ab83596c4d4fc1a6cd8f5 100644 (file)
@@ -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]);
                 }]);
index fba62078045f186907aa49de1c6c2c6bb27698de..6aa70cef4add5628d462e61ea1c37b9cd54a95e1 100644 (file)
@@ -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');