]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
fix storeId is null bad for pgsql
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 2 Apr 2024 10:25:33 +0000 (13:25 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 2 Apr 2024 10:25:33 +0000 (13:25 +0300)
erp24/actions/timetable/EditPlanAction.php

index 5db84ca66d18be49511942105d1a559012cecaa3..6865f36f889d84e7f96f6ca535132d34388594f9 100755 (executable)
@@ -37,11 +37,14 @@ class EditPlanAction extends Action
             'date' => $this->controller->request->get('date'),
             'store_id' => $this->controller->request->get('storeId'),
         ];
+        /** @var Admin $admin */
+        $admin = Admin::find()->andWhere(['id'=>$row['admin_id']])->one();
+        if ($row['store_id'] == 'null') {
+            $row['store_id'] = $admin->store_id ?? null;
+        }
         $slot = TimetablePlan::find()->andWhere($row)->one();
         if (!$slot) {
             $slot = new TimetablePlan($row);
-            /** @var Admin $admin */
-            $admin = Admin::find()->andWhere(['id'=>$row['admin_id']])->one();
             $slot->store_id = $this->controller->request->get('storeId') ?? ($admin ? $admin->store_id : null);
 
             if (