From: Alexander Smirnov Date: Mon, 10 Jun 2024 08:26:06 +0000 (+0300) Subject: fix if base promocode is off then single use promocode is also off X-Git-Tag: 1.2^2~2^2~4 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=5d6d56da527ade8246c85b610c588b712288f20c;p=erp24_rep%2Fyii-erp24%2F.git fix if base promocode is off then single use promocode is also off --- diff --git a/erp24/api2/controllers/ClientController.php b/erp24/api2/controllers/ClientController.php index 1d9ae8e9..c3d2308a 100644 --- a/erp24/api2/controllers/ClientController.php +++ b/erp24/api2/controllers/ClientController.php @@ -1084,7 +1084,7 @@ class ClientController extends BaseController { return $this->asJson(["error_id" => 3, "error" => "промокод уже использован"]); } - if (!$promoCode) { + if (!$promoCode || ($promoCode->base == Promocode::BASE_SINGLE_USE && $promoCode->parent && $promoCode->parent->active == Promocode::ACTIVE_OFF)) { $promoCodeWeak = Promocode::find()->where(['code' => $result['code'], 'base' => [Promocode::BASE_SHARED, Promocode::BASE_SINGLE_USE]])->one(); return $this->asJson(["error_id" => 2, "error" => $promoCodeWeak ? "истёк срок действия промокода" : "промокод не известен"]); }