|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* Envoi email de confirmation |
|
|
* Envoi email de confirmation |
|
|
*/ |
|
|
*/ |
|
|
if ($isNewOrder) { |
|
|
|
|
|
|
|
|
|
|
|
$emailSubject = 'Confirmation de commande'; |
|
|
|
|
|
$emailContentParams = [ |
|
|
|
|
|
'order' => $order, |
|
|
|
|
|
'pointSale' => $pointSale, |
|
|
|
|
|
'distribution' => $distribution, |
|
|
|
|
|
'user' => $user, |
|
|
|
|
|
'producer' => $producer |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
// au client |
|
|
|
|
|
if ($producerModule->getConfig('option_email_confirm')) { |
|
|
|
|
|
\Yii::$app->mailerService->sendFromProducer( |
|
|
|
|
|
$emailSubject, |
|
|
|
|
|
'orderConfirm', |
|
|
|
|
|
$emailContentParams, |
|
|
|
|
|
$user->email, |
|
|
|
|
|
$producer |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
$emailSubject = 'Confirmation de commande'; |
|
|
|
|
|
$emailContentParams = [ |
|
|
|
|
|
'order' => $order, |
|
|
|
|
|
'pointSale' => $pointSale, |
|
|
|
|
|
'distribution' => $distribution, |
|
|
|
|
|
'user' => $user, |
|
|
|
|
|
'producer' => $producer |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// au client |
|
|
|
|
|
if ($producerModule->getConfig('option_email_confirm')) { |
|
|
|
|
|
\Yii::$app->mailerService->sendFromProducer( |
|
|
|
|
|
$emailSubject, |
|
|
|
|
|
'orderConfirm', |
|
|
|
|
|
$emailContentParams, |
|
|
|
|
|
$user->email, |
|
|
|
|
|
$producer |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
// au producteur |
|
|
|
|
|
$contactProducer = $producerModule->getMainContact($producer); |
|
|
|
|
|
if ($producerModule->getConfig('option_email_confirm_producer') && $contactProducer && strlen( |
|
|
|
|
|
$contactProducer->email |
|
|
|
|
|
)) { |
|
|
|
|
|
|
|
|
|
|
|
\Yii::$app->mailerService->sendFromSite( |
|
|
|
|
|
$emailSubject, |
|
|
|
|
|
'orderConfirmProducer', |
|
|
|
|
|
$emailContentParams, |
|
|
|
|
|
$contactProducer->email |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// au producteur |
|
|
|
|
|
$contactProducer = $producerModule->getMainContact($producer); |
|
|
|
|
|
if ($producerModule->getConfig('option_email_confirm_producer') && $contactProducer && strlen( |
|
|
|
|
|
$contactProducer->email |
|
|
|
|
|
)) { |
|
|
|
|
|
|
|
|
|
|
|
\Yii::$app->mailerService->sendFromSite( |
|
|
|
|
|
$emailSubject, |
|
|
|
|
|
'orderConfirmProducer', |
|
|
|
|
|
$emailContentParams, |
|
|
|
|
|
$contactProducer->email |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$order = $orderModule->findOneOrderById($order->id); |
|
|
$order = $orderModule->findOneOrderById($order->id); |
|
|
$orderModule->initOrder($order); |
|
|
$orderModule->initOrder($order); |
|
|
$orderModule->updateOrderTillerSynchronization($order); |
|
|
$orderModule->updateOrderTillerSynchronization($order); |