Browse Source

[backend] Cron : ajout de logs dans l'action processOrders afin de déterminer pourquoi les commandes ne se payent pas automatiquement.

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
85b52e9fbb
2 changed files with 12 additions and 2 deletions
  1. +1
    -1
      backend/config/main.php
  2. +11
    -1
      backend/controllers/CronController.php

+ 1
- 1
backend/config/main.php View File

'targets' => [ 'targets' => [
[ [
'class' => 'yii\log\FileTarget', 'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
'levels' => ['error', 'warning', 'info'],
], ],
], ],
], ],

+ 11
- 1
backend/controllers/CronController.php View File

$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') ;
}
}
} }
} }
} }

Loading…
Cancel
Save