diff --git a/controllers/OrderController.php b/controllers/OrderController.php index 6d75810..4d9458f 100755 --- a/controllers/OrderController.php +++ b/controllers/OrderController.php @@ -290,7 +290,7 @@ } $model = $this->findModel($id); - + /** * @var User $user */ @@ -388,7 +388,7 @@ throw new NotFoundHttpException('The requested page does not exist.'); } } - + public function actionExitOrder($id) { $this->unblockOrder($id); @@ -413,7 +413,10 @@ 'time' => $date, ]; } else { - return [ 'success' => false ]; + return [ + 'success' => false, + 'errors' => $model->errors, + ]; } } } diff --git a/models/Order.php b/models/Order.php index 8a27ba0..092d2ee 100755 --- a/models/Order.php +++ b/models/Order.php @@ -110,6 +110,7 @@ ], [ [ + 'shipping_by', 'created_at', 'updated_at', 'deleted_at', @@ -159,7 +160,6 @@ 'consignment', 'insurance', 'amount_imposed', - 'shipping_by', 'city', 'adress', 'status', diff --git a/models/OrderPayment.php b/models/OrderPayment.php index f76a3c5..23d3b5b 100644 --- a/models/OrderPayment.php +++ b/models/OrderPayment.php @@ -1,97 +1,98 @@ [ + 'class' => LanguageBehavior::className(), + 'objectLang' => OrderPaymentLang::className(), + 'ownerKey' => 'id', + 'langKey' => 'order_payment_id', + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ 'status' ], + 'integer', + ], + [ + [ 'status' ], + 'default', + 'value' => 1, + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => \Yii::t('app', 'ID'), + 'status' => \Yii::t('app', 'Статус'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOrderPaymentLangs() + { + return $this->hasMany(OrderPaymentLang::className(), [ 'order_payment_id' => 'id' ]); + } } - - - public function behaviors() - { - return [ - 'language' => [ - 'class' => LanguageBehavior::className(), - 'objectLang' => OrderPaymentLang::className(), - 'ownerKey' => 'id', - 'langKey' => 'order_payment_id', - ], - ]; - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [['status'], 'integer'], - [ - [ 'status' ], - 'default', - 'value' => 1, - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => \Yii::t('app','ID'), - 'status' => \Yii::t('app','Статус'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOrderPaymentLangs() - { - return $this->hasMany(OrderPaymentLang::className(), ['order_payment_id' => 'id']); - } -} diff --git a/views/order/_form.php b/views/order/_form.php index cf66cd0..5a1970b 100755 --- a/views/order/_form.php +++ b/views/order/_form.php @@ -92,37 +92,6 @@ JS;