|
|
|
|
|
|
|
|
$arrayProducers = Producer::searchAll() ; |
|
|
$arrayProducers = Producer::searchAll() ; |
|
|
|
|
|
|
|
|
foreach ($arrayProducers as $producer) { |
|
|
foreach ($arrayProducers as $producer) { |
|
|
|
|
|
|
|
|
|
|
|
$countOrders = 0 ; |
|
|
|
|
|
$mailOrdersSend = false ; |
|
|
|
|
|
|
|
|
$distribution = Distribution::findOne([ |
|
|
$distribution = Distribution::findOne([ |
|
|
'date' => $date, |
|
|
'date' => $date, |
|
|
'active' => 1, |
|
|
'active' => 1, |
|
|
|
|
|
|
|
|
$order->id_user, |
|
|
$order->id_user, |
|
|
User::ID_USER_SYSTEM |
|
|
User::ID_USER_SYSTEM |
|
|
); |
|
|
); |
|
|
|
|
|
$countOrders ++ ; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mail->setSubject($subject) |
|
|
$mail->setSubject($subject) |
|
|
->send(); |
|
|
->send(); |
|
|
|
|
|
$mailOrdersSend = true ; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($producer->active) { |
|
|
|
|
|
Yii::info($producer->name.' : Distribution du '.$date.', '.count($arrayOrders).' commande(s) enregistrée(s), '.$countOrders.' commande(s) payée(s), '.($mailOrdersSend ? 'Récapitulatif de commandes envoyé' : 'Aucun email envoyé'), 'cron-process-orders') ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |