From b491f68b4b0f75879479ce59b240e5b159d14131 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 30 May 2024 18:58:18 +0300 Subject: [PATCH] del old employee on shift in initial and rejected state --- .../modules/v1/controllers/claim/WorkerController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erp24/api3/modules/v1/controllers/claim/WorkerController.php b/erp24/api3/modules/v1/controllers/claim/WorkerController.php index e0b0a9d..057496c 100644 --- a/erp24/api3/modules/v1/controllers/claim/WorkerController.php +++ b/erp24/api3/modules/v1/controllers/claim/WorkerController.php @@ -9,6 +9,7 @@ use yii_app\api3\core\traits\ServiceTrait; use yii_app\api3\helpers\Util; use yii_app\api3\modules\v1\requests\claim\Worker; use yii_app\api3\modules\v1\requests\claim\WorkerControl; +use yii_app\records\EmployeeOnShift; /** * @property ClaimService $claimService @@ -45,6 +46,13 @@ class WorkerController extends \yii_app\api3\controllers\ActiveController public function actionCreate() { + // Удаляем старые заявки + EmployeeOnShift::deleteAll([ + 'and', + ['status' => [EmployeeOnShift::STATUS_INITIAL, EmployeeOnShift::STATUS_REJECT]], + ['<=', 'created_at', date('Y-m-d H:i:s', strtotime('-30 minutes', time()))] + ]); + $params = Yii::$app->request->bodyParams; $data = $this->validate(new Worker(), $params); -- 2.39.5