|
|
@@ -224,5 +224,33 @@ 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 |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |