|
|
@@ -208,40 +208,7 @@ class CommandeAuto extends \yii\db\ActiveRecord { |
|
|
|
|
|
|
|
if (!$produits_add) { |
|
|
|
$commande->delete(); |
|
|
|
} else { |
|
|
|
// on débite automatiquement le crédit pain du client |
|
|
|
if ($commande->id_user && |
|
|
|
$this->paiement_automatique && |
|
|
|
Etablissement::getConfig('credit_pain')) { |
|
|
|
$commande = Commande::find() |
|
|
|
->with('commandeProduits') |
|
|
|
->where(['id' => $commande->id]) |
|
|
|
->one(); |
|
|
|
|
|
|
|
$commande->init(); |
|
|
|
|
|
|
|
$user_action = User::find()->where([ |
|
|
|
'id_etablissement' => $production->id_etablissement, |
|
|
|
'status' => 11 |
|
|
|
])->one(); |
|
|
|
|
|
|
|
if ($user_action) |
|
|
|
$id_user_action = $user_action->id; |
|
|
|
else |
|
|
|
$id_user_action = NULL; |
|
|
|
|
|
|
|
if ($commande->getMontant() > 0) { |
|
|
|
$commande->creditHistorique( |
|
|
|
CreditHistorique::TYPE_PAIEMENT, |
|
|
|
$commande->getMontant(), |
|
|
|
$production->id_etablissement, |
|
|
|
$commande->id_user, |
|
|
|
$id_user_action |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |