Explorar el Código

Cron paiement automatique des commandes

dev
keun hace 6 años
padre
commit
6777a6458b
Se han modificado 1 ficheros con 28 adiciones y 0 borrados
  1. +28
    -0
      backend/controllers/CronController.php

+ 28
- 0
backend/controllers/CronController.php Ver fichero

@@ -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
);
}
}
}
}
}

}

Cargando…
Cancelar
Guardar