|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function actionView($id) |
|
|
public function actionView($id) |
|
|
{ |
|
|
{ |
|
|
$orderModule = $this->getOrderModule(); |
|
|
|
|
|
|
|
|
$userModule = $this->getUserModule(); |
|
|
$pointSaleModule = $this->getPointSaleModule(); |
|
|
$pointSaleModule = $this->getPointSaleModule(); |
|
|
$model = $this->findModel($id); |
|
|
$model = $this->findModel($id); |
|
|
|
|
|
|
|
|
|
|
|
// Email de bienvenue |
|
|
|
|
|
$mailWelcome = Yii::$app->request->post('submit_mail_welcome'); |
|
|
|
|
|
if ($mailWelcome) { |
|
|
|
|
|
$this->getUserModule()->getManager()->welcome($model); |
|
|
|
|
|
$this->setFlash('success', 'Email de bienvenue envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Mot de passe oublié |
|
|
|
|
|
$newPassword = Yii::$app->request->post('submit_new_password'); |
|
|
|
|
|
if ($newPassword) { |
|
|
|
|
|
$this->getUserModule()->getManager()->newPassword($model); |
|
|
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $this->render('view', [ |
|
|
return $this->render('view', [ |
|
|
'model' => $model, |
|
|
'model' => $model, |
|
|
'pointSaleBillingArray' => $pointSaleModule->findByBillingUser($model) |
|
|
'pointSaleBillingArray' => $pointSaleModule->findByBillingUser($model) |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Utilisateur <strong>' . Html::encode($userModule->getUsername($model)) . '</strong> modifié.'); |
|
|
$this->setFlash('success', 'Utilisateur <strong>' . Html::encode($userModule->getUsername($model)) . '</strong> modifié.'); |
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Email de bienvenue |
|
|
|
|
|
$mailWelcome = Yii::$app->request->post('submit_mail_welcome'); |
|
|
|
|
|
if ($mailWelcome) { |
|
|
|
|
|
$this->getUserModule()->getManager()->welcome($model); |
|
|
|
|
|
$this->setFlash('success', 'Email de bienvenue envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Mot de passe oublié |
|
|
|
|
|
$newPassword = Yii::$app->request->post('submit_new_password'); |
|
|
|
|
|
if ($newPassword) { |
|
|
|
|
|
$this->getUserModule()->getManager()->newPassword($model); |
|
|
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
throw new UserException("Vous ne pouvez pas modifier cet utilisateur."); |
|
|
throw new UserException("Vous ne pouvez pas modifier cet utilisateur."); |
|
|
} |
|
|
} |