]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
миграция
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 3 Apr 2024 07:36:19 +0000 (10:36 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 3 Apr 2024 07:36:19 +0000 (10:36 +0300)
erp24/controllers/MatrixErpController.php
erp24/controllers/MatrixErpPropertyController.php
erp24/views/matrix_erp/index.php
erp24/views/write_offs_erp/_form.php

index d8e86c71fe805f9f1bfc4d85ddb69e2aa968b4e0..d0ddafb934fe6e304e75e98538518db735e977f9 100644 (file)
@@ -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([
index 77735501817bbb294fa1ddbbd6cc6069178b1d01..3e37dbfd7e198d3362d3f51ac81c7c65f16fa243 100644 (file)
@@ -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();
                                 }
+                            }
 
 
 
index 514e0f59f0d3d7c76ca1a9645d2cdf19f363aa2d..f0e0bf970a796b8b0556c0fe9429d298c9dc8264 100644 (file)
@@ -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)) {
index cd992accaff6358a5365a6d9994169175eb157e5..9209d2fe08c266591a03b40f0fc0105d55bd4fef 100644 (file)
@@ -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'],