From c50f02cf39f3335d0ac10f1fcc1f1d9fc7758005 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 9 Oct 2024 12:00:19 +0300 Subject: [PATCH] 2024_10_09 motivation empty store_id --- erp24/actions/motivation/IndexAction.php | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index e43de196..59d8eb67 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -70,21 +70,22 @@ class IndexAction extends Action }, ARRAY_FILTER_USE_BOTH); - // Загружаем данные из GET-запроса, если они есть - if (Yii::$app->request->get()) { - $model->load(Yii::$app->request->get()); - - if ($model->year === '') { + $model->load(Yii::$app->request->get()); + + if ($model->year === '') { + $model->year = $currentDate->format('Y'); + } else { + $model->year = intval($model->year); + // Проверяем, что год находится в допустимом диапазоне + if (!in_array($model->year, $years)) { $model->year = $currentDate->format('Y'); - } else { - $model->year = intval($model->year); - // Проверяем, что год находится в допустимом диапазоне - if (!in_array($model->year, $years)) { - $model->year = $currentDate->format('Y'); - } } + } + + $model->month = intval($model->month); - $model->month = intval($model->month); + if ($model->store_id === '') { + $model->store_id = array_keys($stores)[0]; } // Подсчитываем стоимость брака -- 2.39.5