|
|
|
|
|
|
|
|
use common\logic\User\User\Model\UserSearch; |
|
|
use common\logic\User\User\Model\UserSearch; |
|
|
use common\logic\User\UserProducer\Model\UserProducer; |
|
|
use common\logic\User\UserProducer\Model\UserProducer; |
|
|
use common\logic\User\UserUserGroup\Model\UserUserGroup; |
|
|
use common\logic\User\UserUserGroup\Model\UserUserGroup; |
|
|
|
|
|
use Faker\Provider\HtmlLorem; |
|
|
use yii\base\UserException; |
|
|
use yii\base\UserException; |
|
|
use yii\filters\AccessControl; |
|
|
use yii\filters\AccessControl; |
|
|
use yii\filters\VerbFilter; |
|
|
use yii\filters\VerbFilter; |
|
|
use \Yii; |
|
|
use \Yii; |
|
|
|
|
|
use yii\helpers\Html; |
|
|
use yii\web\NotFoundHttpException; |
|
|
use yii\web\NotFoundHttpException; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
$userGroupManager = $this->getUserGroupManager(); |
|
|
$userGroupManager = $this->getUserGroupManager(); |
|
|
|
|
|
|
|
|
$producerCurrent = $this->getProducerCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
if ($model->id) { |
|
|
if ($model->id) { |
|
|
$userPointSaleArray = $userPointSaleManager->findUserPointSalesByUser($model); |
|
|
$userPointSaleArray = $userPointSaleManager->findUserPointSalesByUser($model); |
|
|
if ($userPointSaleArray && count($userPointSaleArray) > 0) { |
|
|
if ($userPointSaleArray && count($userPointSaleArray) > 0) { |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
$userManager = $this->getUserManager(); |
|
|
$userManager = $this->getUserManager(); |
|
|
$producerManager = $this->getProducerManager(); |
|
|
$producerManager = $this->getProducerManager(); |
|
|
$pointSaleManager = $this->getPointSaleManager(); |
|
|
|
|
|
|
|
|
|
|
|
$producerCurrent = $this->getProducerCurrent(); |
|
|
$producerCurrent = $this->getProducerCurrent(); |
|
|
$model = $userManager->instanciateUser(); |
|
|
$model = $userManager->instanciateUser(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Updates an existing User model. |
|
|
|
|
|
* If update is successful, the browser will be redirected to the 'view' page. |
|
|
|
|
|
*/ |
|
|
|
|
|
public function actionUpdate($id) |
|
|
public function actionUpdate($id) |
|
|
{ |
|
|
{ |
|
|
$userManager = $this->getUserManager(); |
|
|
$userManager = $this->getUserManager(); |
|
|
|
|
|
|
|
|
$this->processLinkUserGroup($model); |
|
|
$this->processLinkUserGroup($model); |
|
|
$this->processProductPricePercent($model); |
|
|
$this->processProductPricePercent($model); |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Utilisateur modifié.'); |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Utilisateur <strong>'.Html::encode($userManager->getUsername($model)).'</strong> modifié.'); |
|
|
|
|
|
|
|
|
|
|
|
return $this->redirect(['index']); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
throw new UserException("Vous ne pouvez pas modifier cet utilisateur."); |
|
|
throw new UserException("Vous ne pouvez pas modifier cet utilisateur."); |
|
|
|
|
|
|
|
|
] |
|
|
] |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé.'); |
|
|
|
|
|
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>'.Html::encode($userManager->getUsername($model)).'</strong>.'); |
|
|
|
|
|
|
|
|
|
|
|
return $this->redirect(['index']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $this->render('update', array_merge($this->initForm($model), [ |
|
|
return $this->render('update', array_merge($this->initForm($model), [ |
|
|
|
|
|
|
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
|
|
|
|
|
|
$user = $userManager->findOneUserById($id); |
|
|
$user = $userManager->findOneUserById($id); |
|
|
$producer = $this->getProducerCurrent(); |
|
|
|
|
|
$userProducer = $userProducerManager->findOneUserProducer($user); |
|
|
$userProducer = $userProducerManager->findOneUserProducer($user); |
|
|
|
|
|
|
|
|
if ($userProducer) { |
|
|
if ($userProducer) { |
|
|
|
|
|
|
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
$userProducerManager = $this->getUserProducerManager(); |
|
|
|
|
|
|
|
|
$user = $userManager->findOneUserById($idUser); |
|
|
$user = $userManager->findOneUserById($idUser); |
|
|
$producerCurrent = $this->getproducerCurrent(); |
|
|
|
|
|
$userProducer = $userProducerManager->findOneUserProducer($user); |
|
|
$userProducer = $userProducerManager->findOneUserProducer($user); |
|
|
|
|
|
|
|
|
if ($userProducer) { |
|
|
if ($userProducer) { |