|
|
|
|
|
|
|
|
':id_subscription' => $this->id |
|
|
':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() |
|
|
$orders = Order::find() |
|
|
->joinWith('distribution') |
|
|
->joinWith('distribution') |
|
|
->where('distribution.id_producer = :id_producer') |
|
|
->where('distribution.id_producer = :id_producer') |
|
|
->andWhere('distribution.date >= :date_today') |
|
|
|
|
|
|
|
|
->andWhere($conditionDistributionDate) |
|
|
->andWhere('distribution.date >= :date_begin') |
|
|
->andWhere('distribution.date >= :date_begin') |
|
|
->andWhere('order.id_subscription = :id_subscription') ; |
|
|
->andWhere('order.id_subscription = :id_subscription') ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach($ordersArray as $order) { |
|
|
foreach($ordersArray as $order) { |
|
|
|
|
|
|
|
|
$theOrder = Order::searchOne(['id' => $order->id]) ; |
|
|
$theOrder = Order::searchOne(['id' => $order->id]) ; |
|
|
|
|
|
|
|
|
// remboursement de la commande |
|
|
// remboursement de la commande |
|
|
if ($theOrder->id_user && $theOrder->getAmount(Order::AMOUNT_PAID) && $configCredit) { |
|
|
if ($theOrder->id_user && $theOrder->getAmount(Order::AMOUNT_PAID) && $configCredit) { |
|
|
$theOrder->saveCreditHistory( |
|
|
$theOrder->saveCreditHistory( |