From: marina Date: Thu, 20 Feb 2025 13:02:36 +0000 (+0300) Subject: ERP-302 Редактирование букета X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=04c5d69d8e9d7eff0e0231e9c7ab606c0750c937;p=erp24_rep%2Fyii-erp24%2F.git ERP-302 Редактирование букета --- diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index 4e876dbb..13fda34e 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -69,18 +69,19 @@ class BouquetController extends Controller { $model = new BouquetComposition(); + if (Yii::$app->request->isPost) { $data = Yii::$app->request->post(); $model->guid = DataHelper::createGuidMy('07'); $model->load($data); - if ($data['matrix_type_id']) { - BouquetCompositionMatrixTypeHistory::setData($data['matrix_type_id'], $model->id); - } if ($model->save()) { - $month = $data['month']; $year = $data['year']; + if ($data['matrix_type_id']) { + BouquetCompositionMatrixTypeHistory::setData($data['matrix_type_id'], $model->id); + } + $model->photo_bouquet = UploadedFile::getInstances($model, 'photo_bouquet'); if ($model->photo_bouquet) { Files::deleteAll(['file_type' => 'image', 'entity_id' => $model->id, 'entity' => BouquetComposition::PHOTO_BOUQUET]); @@ -132,11 +133,10 @@ class BouquetController extends Controller } } } - return $this->redirect(['view', 'id' => $model->id]); } } - + $availableItems = ArrayHelper::map( Products1c::find() ->where([