|
|
|
|
|
|
|
|
if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) { |
|
|
if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) { |
|
|
|
|
|
|
|
|
$paymentContainer->getUtils() |
|
|
$paymentContainer->getUtils() |
|
|
->creditOrDebitUser($creditForm->type, $user, $creditForm->amount, $creditForm->mean_payment, $user); |
|
|
|
|
|
|
|
|
->creditOrDebitUser($creditForm->type, $user, $creditForm->amount, $creditForm->mean_payment, $this->getUserCurrent()); |
|
|
|
|
|
|
|
|
if($creditForm->send_mail) { |
|
|
if($creditForm->send_mail) { |
|
|
$paymentContainer->getNotifier() |
|
|
$paymentContainer->getNotifier() |
|
|
->notifyUserCreditMovement($user, $creditForm->type, $creditForm->amount); |
|
|
->notifyUserCreditMovement($user, $creditForm->type, $creditForm->amount); |
|
|
|
|
|
if(!$user->email) { |
|
|
|
|
|
$this->addFlash('error', "L'utilisateur n'a pas pu être prévenu car son adresse email n'est pas définie."); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Crédit mis à jour.'); |
|
|
|
|
|
|
|
|
$this->addFlash('success', 'Crédit mis à jour.'); |
|
|
|
|
|
|
|
|
return $this->refresh(); |
|
|
return $this->refresh(); |
|
|
} |
|
|
} |