From: Aleksey Filippov Date: Wed, 3 Apr 2024 07:36:19 +0000 (+0300) Subject: миграция X-Git-Tag: 1.1~162^2~2^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=19e631359b1652a22e3834f0c8a3d68cb6d950c9;p=erp24_rep%2Fyii-erp24%2F.git миграция --- diff --git a/erp24/controllers/MatrixErpController.php b/erp24/controllers/MatrixErpController.php index d8e86c71..d0ddafb9 100644 --- a/erp24/controllers/MatrixErpController.php +++ b/erp24/controllers/MatrixErpController.php @@ -100,7 +100,7 @@ class MatrixErpController extends Controller if (isset($nameFilter) && $nameFilter != "") { if (!empty($nameFilter)) { - $query->andFilterWhere(['like', '`matrix_erp`.`name`', $nameFilter]);; + $query->andFilterWhere(['like', 'matrix_erp.name', $nameFilter]);; } } $test = 1; @@ -196,8 +196,8 @@ class MatrixErpController extends Controller $isSetModelsMatrixErpMedia = true; } - if ($this->request->isPost && $modelMatrixErp->load($this->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); + if ($this->request->isPost && $modelMatrixErp->load($this->request->post()) && $modelMatrixErp->save()) { + return $this->redirect(['view', 'id' => $modelMatrixErp->id]); } $filterModel = DynamicModel::validateData([ diff --git a/erp24/controllers/MatrixErpPropertyController.php b/erp24/controllers/MatrixErpPropertyController.php index 77735501..3e37dbfd 100644 --- a/erp24/controllers/MatrixErpPropertyController.php +++ b/erp24/controllers/MatrixErpPropertyController.php @@ -175,7 +175,10 @@ class MatrixErpPropertyController extends Controller $loadMediaIds = ArrayHelper::getColumn($modelsMatrixErpMedia, 'id'); + if (!empty(array_filter($loadMediaIds))) { $MatrixErpMediaOld = MatrixErpMedia::find()->andWhere(['guid' => $modelEdit->guid])->andWhere(['NOT IN','id', $loadMediaIds])->all(); + } + if (!empty($MatrixErpMediaOld)) { foreach ($MatrixErpMediaOld as $item) { /** @var MatrixErpMedia $item */ if (!empty($item->file_id)) { @@ -188,6 +191,7 @@ class MatrixErpPropertyController extends Controller } $item->delete(); } + } diff --git a/erp24/views/matrix_erp/index.php b/erp24/views/matrix_erp/index.php index 514e0f59..f0e0bf97 100644 --- a/erp24/views/matrix_erp/index.php +++ b/erp24/views/matrix_erp/index.php @@ -75,7 +75,7 @@ $this->params['breadcrumbs'][] = $this->title; echo $form->field($filterModel, 'groupNameFilter')->dropDownList(array_merge(['' => 'Все'], ArrayHelper::map( \yii_app\records\MatrixErp::find() - ->select(['group_name' => new \yii\db\Expression("DISTINCT(`group_name`)")]) + ->select(['group_name' => new \yii\db\Expression("DISTINCT(group_name)")]) ->orderBy(['group_name' => SORT_ASC]) ->asArray() ->all(), @@ -147,7 +147,7 @@ $this->params['breadcrumbs'][] = $this->title; } if (!empty($item->matrixProperty)) { $matrixPropertyRow = $item->matrixProperty; - $imageIdRow = $matrixPropertyRow->image_id ?? '-'; + $imageIdRow = $matrixPropertyRow->image_id; } $matrixMediaRow = null; if (!empty($item->matrixMedia)) { diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index cd992acc..9209d2fe 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -145,7 +145,7 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View 'type' => BaseColumn::TYPE_STATIC, 'value' => function($data) { // $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp); - if (!empty($data)) { + if (!empty($data['id'])) { $query = WriteOffsProductsErp::find() ->andWhere([ 'write_offs_products_erp.id' => $data['id'],