From: JoySystem_v Date: Thu, 8 Aug 2024 10:32:55 +0000 (+0300) Subject: fix form salary data X-Git-Tag: 1.4~35^2~11 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=798b18ade66900b32bb8db8c96c2e74cacd6fc9f;p=erp24_rep%2Fyii-erp24%2F.git fix form salary data --- diff --git a/erp24/actions/motivation/GetSalaryAction.php b/erp24/actions/motivation/GetSalaryAction.php index 6395ffd9..5fa26fda 100644 --- a/erp24/actions/motivation/GetSalaryAction.php +++ b/erp24/actions/motivation/GetSalaryAction.php @@ -5,6 +5,7 @@ namespace yii_app\actions\motivation; use Yii; use yii\base\Action; use yii\base\DynamicModel; +use yii_app\models\SumSalaryForm; use yii_app\services\MotivationService; use yii_app\records\TimetableFactModel; use DateTime; @@ -16,10 +17,12 @@ class GetSalaryAction extends Action public function run() { - $request = Yii::$app->request; - $store_id = $request->get('store_id', 1); - $month = $request->get('month', 7); - $year = $request->get('year', 2024); + $model = new SumSalaryForm(); + + if ($model->load(Yii::$app->request->post()) && $model->validate()) { + $store_id = $model->store_id; + $year = $model->year; + $month = $model->month; $records = []; $vacationSum = 0; @@ -115,5 +118,10 @@ class GetSalaryAction extends Action 'monthlyVacationSum' => $monthlyVacationSum, 'monthlySalaryWithoutVacation' => $monthlySalaryWithoutVacation, ]); + + } else { + Yii::warning("Неправильный ввод данных."); + return $this->controller->redirect(['motivation/index']); + } } } diff --git a/erp24/views/motivation/run-sum-salary.php b/erp24/views/motivation/run-sum-salary.php index 554db402..2f35fb6a 100644 --- a/erp24/views/motivation/run-sum-salary.php +++ b/erp24/views/motivation/run-sum-salary.php @@ -33,24 +33,24 @@ $this->title = 'Запуск экшена SumSalary'; 'btn btn-primary']) ?> - + +