|
|
@@ -158,7 +158,7 @@ class CronController extends BackendController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function actionSendCommandes($key = '') { |
|
|
|
public function actionProcessCommandes($key = '') { |
|
|
|
if ($key == '64ac0bdab7e9f5e48c4d991ec5201d57') { |
|
|
|
$heure = date('H'); |
|
|
|
|
|
|
@@ -178,6 +178,38 @@ class CronController extends BackendController { |
|
|
|
]); |
|
|
|
|
|
|
|
if ($production && $heure == $e['heure_limite_commande']) { |
|
|
|
|
|
|
|
/* |
|
|
|
* Paiement des commandes (paiement automatique) |
|
|
|
*/ |
|
|
|
|
|
|
|
$commandes = Commande::find() |
|
|
|
->with('commandeProduits', 'user') |
|
|
|
->joinWith('production') |
|
|
|
->where(['production.date' => $date]) |
|
|
|
->orderBy('date ASC') |
|
|
|
->all(); |
|
|
|
|
|
|
|
foreach($commandes as $c) { |
|
|
|
if($c->paiement_automatique && Etablissement::getConfig('credit_pain', $c->production->id_etablissement)) { |
|
|
|
$c->init() ; |
|
|
|
|
|
|
|
if ($c->getMontantRestant() > 0) { |
|
|
|
$c->creditHistorique( |
|
|
|
CreditHistorique::TYPE_PAIEMENT, |
|
|
|
$c->getMontantRestant(), |
|
|
|
$c->production->id_etablissement, |
|
|
|
$c->id_user, |
|
|
|
User::ID_USER_SYSTEM |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Envoi des commandes par email au producteur |
|
|
|
*/ |
|
|
|
|
|
|
|
$commandes = Commande::find() |
|
|
|
->with('commandeProduits', 'user') |
|
|
|
->joinWith('production') |
|
|
@@ -224,33 +256,5 @@ class CronController extends BackendController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function actionPaiementAutoCommandes($key = '') { |
|
|
|
if ($key == '64ac0bdab7e9f5e48c4d991ec5201d57') { |
|
|
|
$commandes = Commande::find() |
|
|
|
->with('commandeProduits', 'user') |
|
|
|
->joinWith('production') |
|
|
|
->where(['production.date' => date('Y-m-d')]) |
|
|
|
->orderBy('date ASC') |
|
|
|
->all(); |
|
|
|
|
|
|
|
foreach($commandes as $c) { |
|
|
|
if($c->paiement_automatique && Etablissement::getConfig('credit_pain', $c->production->id_etablissement)) { |
|
|
|
$c->init() ; |
|
|
|
|
|
|
|
if ($c->getMontant() > 0) { |
|
|
|
$c->creditHistorique( |
|
|
|
CreditHistorique::TYPE_PAIEMENT, |
|
|
|
$c->getMontant(), |
|
|
|
$c->production->id_etablissement, |
|
|
|
$c->id_user, |
|
|
|
User::ID_USER_SYSTEM |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |