Browse Source

[Distributions] Commandes : logs envoi récapitulatif de commandes #672

refactoring
Guillaume Bourgeois 2 years ago
parent
commit
a2d59ac8e3
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      backend/controllers/CronController.php

+ 13
- 3
backend/controllers/CronController.php View File

public function actionProcessOrders($key = '', $forceDate = '') public function actionProcessOrders($key = '', $forceDate = '')
{ {
if ($key == '64ac0bdab7e9f5e48c4d991ec5201d57') { if ($key == '64ac0bdab7e9f5e48c4d991ec5201d57') {
ini_set('memory_limit', '-1');
set_time_limit(0);
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
} }


if ($producer->active) { if ($producer->active) {

$strCountOrders = 0; $strCountOrders = 0;
if ($arrayOrders && is_array($arrayOrders)) { if ($arrayOrders && is_array($arrayOrders)) {
$strCountOrders = count($arrayOrders); $strCountOrders = count($arrayOrders);
} }
$messageLog = $producer->name . ' : Distribution du ' . $date . ', ' . $strCountOrders . ' commande(s) enregistrée(s), ' . $countOrders . ' commande(s) payée(s), ' . ($mailOrdersSend ? 'Récapitulatif de commandes envoyé' : 'Aucun email envoyé');
/*Yii::$app->mailer->compose()

$messageLog =
$producer->name . '<br />' .
'Distribution du ' . $date . '<br />' .
$strCountOrders . ' commande(s) enregistrée(s)<br />' .
$countOrders . ' commande(s) payée(s)<br .>' .
($mailOrdersSend ? 'Récapitulatif de commandes envoyé' : 'Aucun récapitulatif envoyé');

Yii::$app->mailer->compose()
->setFrom('contact@opendistrib.net') ->setFrom('contact@opendistrib.net')
->setTo('contact@opendistrib.net') ->setTo('contact@opendistrib.net')
->setSubject('[Opendistrib] Log '.$producer->name) ->setSubject('[Opendistrib] Log '.$producer->name)
->setTextBody($messageLog) ->setTextBody($messageLog)
->send();*/
->send();
} }
} }
} }

Loading…
Cancel
Save