瀏覽代碼

Correction bug annulation de commande du jour lors de la suppression d'un abonnement.

dev
Guillaume Bourgeois 5 年之前
父節點
當前提交
6f88fddc06
共有 1 個文件被更改,包括 13 次插入1 次删除
  1. +13
    -1
      common/models/Subscription.php

+ 13
- 1
common/models/Subscription.php 查看文件

@@ -404,10 +404,21 @@ class Subscription extends ActiveRecordCommon
':id_subscription' => $this->id
];
$orderDeadline = Producer::getConfig('order_deadline') ;
$hour = date('G') ;
if($hour >= $orderDeadline) {
$conditionDistributionDate = 'distribution.date > :date_today' ;
}
else {
$conditionDistributionDate = 'distribution.date >= :date_today' ;
}
$orders = Order::find()
->joinWith('distribution')
->where('distribution.id_producer = :id_producer')
->andWhere('distribution.date >= :date_today')
->andWhere($conditionDistributionDate)
->andWhere('distribution.date >= :date_begin')
->andWhere('order.id_subscription = :id_subscription') ;
@@ -425,6 +436,7 @@ class Subscription extends ActiveRecordCommon
foreach($ordersArray as $order) {
$theOrder = Order::searchOne(['id' => $order->id]) ;

// remboursement de la commande
if ($theOrder->id_user && $theOrder->getAmount(Order::AMOUNT_PAID) && $configCredit) {
$theOrder->saveCreditHistory(

Loading…
取消
儲存