From 44e256255eb67b828ff5123c11ec2c50b49f1ca0 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 5 Aug 2025 17:37:32 +0300 Subject: [PATCH] =?utf8?q?=D0=9C=D0=B5=D0=BD=D1=8F=D0=B5=D0=BC=20=D0=BF?= =?utf8?q?=D0=BE=D0=BB=D0=B5=20date=5Fend=20=D0=BD=D0=B0=20date=5Fto?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../Products1cNomenclatureActualityController.php | 12 ++++++------ ...eate_products_1c_nomenclature_actuality_table.php | 2 +- erp24/records/Products1cNomenclatureActuality.php | 8 ++++---- .../Products1cNomenclatureActualitySearch.php | 4 ++-- erp24/services/StorePlanService.php | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/erp24/controllers/Products1cNomenclatureActualityController.php b/erp24/controllers/Products1cNomenclatureActualityController.php index f82d25a7..f78c62dc 100644 --- a/erp24/controllers/Products1cNomenclatureActualityController.php +++ b/erp24/controllers/Products1cNomenclatureActualityController.php @@ -107,13 +107,13 @@ class Products1cNomenclatureActualityController extends Controller $dtObj->modify('last day of this month')->setTime(23,59,59); $query->andWhere(['<=', 'a.date_from', $dtObj->format('Y-m-d H:i:s')]) - ->andWhere(['>=', 'a.date_end', $dfObj->format('Y-m-d H:i:s')]); + ->andWhere(['>=', 'a.date_to', $dfObj->format('Y-m-d H:i:s')]); } elseif ($filter->date_from) { $df = \DateTime::createFromFormat('Y-m', $filter->date_from) ->format('Y-m-01 00:00:00'); - $query->andWhere(['>=', 'a.date_end', $df]); + $query->andWhere(['>=', 'a.date_to', $df]); } elseif ($filter->date_to) { @@ -262,7 +262,7 @@ class Products1cNomenclatureActualityController extends Controller $rows[] = [ 'guid' => $pid, 'date_from' => $from, - 'date_end' => $to, + 'date_to' => $to, 'active' => 1, 'created_at' => $createdAt, 'created_by' => $userId, @@ -272,7 +272,7 @@ class Products1cNomenclatureActualityController extends Controller Yii::$app->db->createCommand() ->batchInsert( Products1cNomenclatureActuality::tableName(), - ['guid','date_from','date_end','active','created_at','created_by'], + ['guid','date_from','date_to','active','created_at','created_by'], $rows ) ->execute(); @@ -327,7 +327,7 @@ class Products1cNomenclatureActualityController extends Controller ->one(); if ($old) { - if ($old->date_from === $newFrom && $old->date_end === $newTo) { + if ($old->date_from === $newFrom && $old->date_to === $newTo) { continue; } @@ -346,7 +346,7 @@ class Products1cNomenclatureActualityController extends Controller $new = new Products1cNomenclatureActuality([ 'guid' => $row['guid'], 'date_from' => $newFrom, - 'date_end' => $newTo, + 'date_to' => $newTo, 'active' => 1, 'created_at' => $now, 'created_by' => $userId, diff --git a/erp24/migrations/m250729_101715_create_products_1c_nomenclature_actuality_table.php b/erp24/migrations/m250729_101715_create_products_1c_nomenclature_actuality_table.php index bb74e8c7..a0cfdcdc 100644 --- a/erp24/migrations/m250729_101715_create_products_1c_nomenclature_actuality_table.php +++ b/erp24/migrations/m250729_101715_create_products_1c_nomenclature_actuality_table.php @@ -20,7 +20,7 @@ class m250729_101715_create_products_1c_nomenclature_actuality_table extends Mig 'id' => $this->primaryKey(), 'guid' => $this->string()->notNull(), 'date_from' => $this->dateTime()->notNull()->comment('Дата и время начала активности'), - 'date_end' => $this->dateTime()->null()->comment('Дата и время окончания активности'), + 'date_to' => $this->dateTime()->null()->comment('Дата и время окончания активности'), 'active' => $this->tinyInteger()->notNull()->defaultValue(1)->comment('Активность записи'), 'created_at' => $this->dateTime()->notNull()->comment('Дата создания'), 'updated_at' => $this->dateTime()->null()->comment('Дата обновления'), diff --git a/erp24/records/Products1cNomenclatureActuality.php b/erp24/records/Products1cNomenclatureActuality.php index cce087ed..e1ad21d6 100644 --- a/erp24/records/Products1cNomenclatureActuality.php +++ b/erp24/records/Products1cNomenclatureActuality.php @@ -10,7 +10,7 @@ use Yii; * @property int $id * @property string $guid * @property string $date_from Дата и время начала активности - * @property string|null $date_end Дата и время окончания активности + * @property string|null $date_to Дата и время окончания активности * @property int $active Активность записи * @property string $created_at Дата создания * @property string|null $updated_at Дата обновления @@ -35,10 +35,10 @@ class Products1cNomenclatureActuality extends \yii\db\ActiveRecord public function rules() { return [ - [['date_end', 'updated_at', 'updated_by'], 'default', 'value' => null], + [['date_to', 'updated_at', 'updated_by'], 'default', 'value' => null], [['active'], 'default', 'value' => 1], [['guid', 'date_from', 'created_at', 'created_by'], 'required'], - [['date_from', 'date_end', 'created_at', 'updated_at'], 'safe'], + [['date_from', 'date_to', 'created_at', 'updated_at'], 'safe'], [['active', 'created_by', 'updated_by'], 'default', 'value' => null], [['active', 'created_by', 'updated_by'], 'integer'], [['guid'], 'string', 'max' => 255], @@ -54,7 +54,7 @@ class Products1cNomenclatureActuality extends \yii\db\ActiveRecord 'id' => 'ID', 'guid' => 'Guid', 'date_from' => 'Date From', - 'date_end' => 'Date End', + 'date_to' => 'Date End', 'active' => 'Active', 'created_at' => 'Created At', 'updated_at' => 'Updated At', diff --git a/erp24/records/Products1cNomenclatureActualitySearch.php b/erp24/records/Products1cNomenclatureActualitySearch.php index bddbc6b1..04d367fc 100644 --- a/erp24/records/Products1cNomenclatureActualitySearch.php +++ b/erp24/records/Products1cNomenclatureActualitySearch.php @@ -28,7 +28,7 @@ class Products1cNomenclatureActualitySearch extends Products1cNomenclatureActual { return [ [['id', 'active', 'created_by', 'updated_by'], 'integer'], - [['guid', 'date_from', 'date_end', 'created_at', 'updated_at'], 'safe'], + [['guid', 'date_from', 'date_to', 'created_at', 'updated_at'], 'safe'], [['category','type','color','subcategory','sort','species','size'], 'safe'], ]; @@ -73,7 +73,7 @@ class Products1cNomenclatureActualitySearch extends Products1cNomenclatureActual $query->andFilterWhere([ 'id' => $this->id, 'date_from' => $this->date_from, - 'date_end' => $this->date_end, + 'date_to' => $this->date_to, 'active' => $this->active, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 7d988619..76d285a3 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -430,8 +430,8 @@ class StorePlanService } $act = $actualities[$guid]; $actFrom = new \DateTime($act->date_from); - $actTo = $act->date_end - ? new \DateTime($act->date_end) + $actTo = $act->date_to + ? new \DateTime($act->date_to) : (new \DateTime())->modify('+1 years'); $isInsideActivity = true; -- 2.39.5