From ba909bbc1efadc02a70b8fce55e0ff926f591d89 Mon Sep 17 00:00:00 2001 From: fomichev Date: Tue, 21 Apr 2026 11:36:43 +0300 Subject: [PATCH] =?utf8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D1=83=D0=B4=D0=B0?= =?utf8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/SupplierController.php | 2 +- erp24/records/ProductMapping.php | 4 ++++ erp24/records/Supplier.php | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erp24/controllers/SupplierController.php b/erp24/controllers/SupplierController.php index 3c9a529f..db098bbb 100644 --- a/erp24/controllers/SupplierController.php +++ b/erp24/controllers/SupplierController.php @@ -144,7 +144,7 @@ class SupplierController extends BaseController return $this->asJson([ 'success' => true, 'message' => sprintf( - 'Поставщик "%s" деактивирован. Связанных записей: маркировки — %d, маппинги — %d.', + 'Поставщик "%s" деактивирован. Маркировки: %d, маппинги: %d.', $model->name, $result['markings'], $result['product_mappings'] diff --git a/erp24/records/ProductMapping.php b/erp24/records/ProductMapping.php index 1f7fc44e..7c3526e3 100644 --- a/erp24/records/ProductMapping.php +++ b/erp24/records/ProductMapping.php @@ -23,6 +23,7 @@ use yii\db\Expression; * @property string|null $article * @property string|null $barcode * @property int $quant Кратность заказа (>=1) + * @property bool $is_active * @property int $created_by * @property int|null $updated_by * @property string $created_at @@ -97,6 +98,8 @@ class ProductMapping extends ActiveRecord ], ['supplier_id', 'validatePartialUnique'], [['article', 'barcode', 'plantation_id'], 'default', 'value' => null], + ['is_active', 'boolean'], + ['is_active', 'default', 'value' => true], ['marking_ids', 'each', 'rule' => ['integer']], ['marking_ids', 'default', 'value' => []], ]; @@ -113,6 +116,7 @@ class ProductMapping extends ActiveRecord 'article' => 'Артикул', 'barcode' => 'Штрихкод', 'quant' => 'Квант', + 'is_active' => 'Статус', 'marking_ids' => 'Маркировки', ]; } diff --git a/erp24/records/Supplier.php b/erp24/records/Supplier.php index 71cfb424..73c7531b 100644 --- a/erp24/records/Supplier.php +++ b/erp24/records/Supplier.php @@ -167,13 +167,13 @@ class Supplier extends ActiveRecord ->execute(); $mappingsCount = (int)Yii::$app->db->createCommand() - ->update('{{%erp24.product_mappings}}', ['deleted_at' => new Expression('NOW()')], ['supplier_id' => $this->id, 'deleted_at' => null]) + ->update('{{%erp24.product_mappings}}', ['is_active' => false], ['supplier_id' => $this->id, 'is_active' => true]) ->execute(); $transaction->commit(); return [ - 'markings' => $markingsCount, + 'markings' => $markingsCount, 'product_mappings' => $mappingsCount, ]; } catch (\Exception $e) { -- 2.39.5