Kaynağa Gözat

Adaptation de l'option "Paiement automatique" en fonction du mode de Crédit choisi

dev
Guillaume Bourgeois 5 yıl önce
ebeveyn
işleme
6979b3518e
1 değiştirilmiş dosya ile 24 ekleme ve 1 silme
  1. +24
    -1
      common/models/Subscription.php

+ 24
- 1
common/models/Subscription.php Dosyayı Görüntüle

@@ -45,6 +45,7 @@ use common\models\PointSale;
use common\models\UserPointSale;
use common\models\Order;
use common\models\ProductOrder;
use common\models\User ;

/**
* This is the model class for table "commande_auto".
@@ -189,7 +190,29 @@ class Subscription extends ActiveRecordCommon
$order->id_point_sale = $this->id_point_sale;
$order->id_distribution = $distribution->id;
$order->id_subscription = $this->id;
$order->auto_payment = $this->auto_payment ;
$pointSale = PointSale::findOne($this->id_point_sale) ;
$creditFunctioning = $pointSale->getCreditFunctioning() ;
$order->auto_payment = 0 ;
if($order->id_user && Producer::getConfig('credit') && $pointSale->credit) {
if($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) {
$order->auto_payment = $this->auto_payment ;
}
elseif($creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) {
$order->auto_payment = 1 ;
}
elseif($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) {
$user = User::findOne($order->id_user) ;
$userProducer = UserProducer::searchOne([
'id_user' => $order->id_user,
'id_producer' => $distribution->id_producer
]) ;
if($userProducer) {
$order->auto_payment = $userProducer->credit_active ;
}
}
}
$userPointSale = UserPointSale::searchOne([
'id_point_sale' => $this->id_point_sale,

Yükleniyor…
İptal
Kaydet