From: marina Date: Tue, 3 Dec 2024 14:37:44 +0000 (+0300) Subject: ERP-243 Действия по замене (II этап) X-Git-Tag: 1.7~193^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=31e6304e967da658e8d24dee21114c46aefccaae;p=erp24_rep%2Fyii-erp24%2F.git ERP-243 Действия по замене (II этап) --- diff --git a/erp24/records/ReplacementInvoice.php b/erp24/records/ReplacementInvoice.php index d8d9db66..d3022f5f 100644 --- a/erp24/records/ReplacementInvoice.php +++ b/erp24/records/ReplacementInvoice.php @@ -97,7 +97,7 @@ class ReplacementInvoice extends \yii\db\ActiveRecord if ($model->validate()) { $model->save(); - $model->updateAttributes(['number' => 'ЕРП_ПС_' . date("Y-m-d_H-i") . $model->id]); + $model->updateAttributes(['number' => 'ЕРП_ПС_' . date("Y-m-d_H-i") . '_' .$model->id]); ReplacementInvoiceProducts::setData($model, $shiftTransfer); } else { var_dump($model->getErrors()); diff --git a/erp24/views/shift-transfer/_replacement.php b/erp24/views/shift-transfer/_replacement.php index f1d2e1ac..03a51117 100644 --- a/erp24/views/shift-transfer/_replacement.php +++ b/erp24/views/shift-transfer/_replacement.php @@ -17,12 +17,6 @@ use yii\widgets\ActiveForm; $this->registerJsFile('/js/shift-transfer/replacement.js', ['position' => \yii\web\View::POS_END]); -$usersOnStoreArray = \yii_app\records\Timetable::find() - ->andWhere(['date' => $shiftTransfer->date]) - ->andWhere(['store_id' => array_flip(array_filter(\yii_app\records\CityStore::getAllActiveGuidId(), 'is_string'))[$shiftTransfer->store_guid]]) - ->select(['admin_id']) - ->column(); - $form = \yii\widgets\ActiveForm::begin(); if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIONS, ShiftTransfer::STATUS_ID_INPUT_FACT_REMAINS]) && Yii::$app->user->id === $shiftTransfer->end_shift_admin_id) { @@ -229,7 +223,7 @@ if (in_array($shiftTransfer->status_id, [ShiftTransfer::STATUS_ID_TRANSFER_ACTIO ]); if ( - in_array(Yii::$app->user->id, $usersOnStoreArray) + \yii_app\records\AdminStores::find()->andWhere(['store_guid' => $shiftTransfer->store_guid, 'admin_id' => Yii::$app->user->id])->exists() && $shiftTransfer->status_id == ShiftTransfer::STATUS_ID_READY_TO_ACCEPT && Yii::$app->user->id != $shiftTransfer->end_shift_admin_id ) {