From 8015d9d9565eb4e4ccd992d5e20f516409686ebb Mon Sep 17 00:00:00 2001 From: Anastasia Date: Thu, 13 Sep 2018 16:07:45 +0300 Subject: [PATCH] incust on frontend --- controllers/OrderController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/OrderController.php b/controllers/OrderController.php index 7676514..95144a5 100755 --- a/controllers/OrderController.php +++ b/controllers/OrderController.php @@ -10,6 +10,7 @@ use artbox\order\models\OrderProduct; use artbox\order\labels\models\Payment; use backend\incust\components\Incust; + use common\models\IncustLog; use Yii; use artbox\order\models\Order; use yii\web\Controller; @@ -234,7 +235,16 @@ ) )) { OrderProduct::saveItems(\Yii::$app->request->post('OrderProduct'), $id); - if ($model->paid and class_exists(Incust::className()) and $model->bonuses_add == null and $model->incust) { + + if ($model->paid and class_exists(Incust::className()) and $model->incust) { + $incustAdd = IncustLog::find()->where(['status' => IncustLog::STARUS_ADD])->andWhere(['order_id' => $model->id]); + if ($incustAdd !== null){ + return $this->redirect( + [ + 'index', + ] + ); + } /** * @var \backend\incust\components\Incust $incust; */ -- libgit2 0.21.4