Sfoglia il codice sorgente

Merge branch 'dev'

master
Guillaume 4 anni fa
parent
commit
802abc6ef8
3 ha cambiato i file con 5 aggiunte e 13 eliminazioni
  1. +2
    -2
      backend/controllers/UserController.php
  2. +3
    -7
      backend/views/user/index.php
  3. +0
    -4
      producer/controllers/ProducerBaseController.php

+ 2
- 2
backend/controllers/UserController.php Vedi File

@@ -205,7 +205,7 @@ class UserController extends BackendController
$previousMail = $model->email ;
$user = User::find()->with('userProducer')->where(['id' => $model['id']])->one();
$userBelongToProducer = UserProducer::findOne(['id_user' => $id, 'id_producer' => GlobalParam::getCurrentProducerId()]);
if (($userBelongToProducer && count($user->userProducer) == 1) || User::getCurrentStatus() == USER::STATUS_ADMIN) {
if ($userBelongToProducer) {
if ($model->load(Yii::$app->request->post()) && $model->save()) {
// on envoie le mail de bienvenue si le mail vient d'être défini
@@ -220,7 +220,7 @@ class UserController extends BackendController
}
}
else {
throw new UserException("Vous ne pouvez pas modifier cet utilisateur, soit parce qu'il appartient à plusieurs établissements, soit parce qu'il n'est pas lié au votre.");
throw new UserException("Vous ne pouvez pas modifier cet utilisateur.");
}
// Nouveau mot de passe

+ 3
- 7
backend/views/user/index.php Vedi File

@@ -153,13 +153,9 @@ $this->render('_menu', [
'update' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/update', 'id' => $model->id]);
$user = User::find()->with('userProducer')->where(['id' => $model->id])->one();
if (count($user->userProducer) <= 1) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
} else {
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les utilisateurs qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>';
}
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [

+ 0
- 4
producer/controllers/ProducerBaseController.php Vedi File

@@ -92,10 +92,6 @@ class ProducerBaseController extends CommonController
$this->redirect(Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer-offline','id' => $producer->id])) ;
}
if(!$userProducer) {
Producer::addUser(User::getCurrentId(), $producer->id, 0) ;
}
return parent::beforeAction($event);
}

Loading…
Annulla
Salva