Browse Source

Liste utilisateurs : bug id user

master
keun 7 years ago
parent
commit
82519c3c8d
2 changed files with 8 additions and 3 deletions
  1. +1
    -1
      backend/controllers/UserController.php
  2. +7
    -2
      backend/views/user/index.php

+ 1
- 1
backend/controllers/UserController.php View File

$params = Yii::$app->request->queryParams; $params = Yii::$app->request->queryParams;
$query = (new \yii\db\Query()) $query = (new \yii\db\Query())
->select('*')
->select('user.id AS user_id, *')
->from('user, user_etablissement') ->from('user, user_etablissement')
->where('user.id = user_etablissement.id_user') ->where('user.id = user_etablissement.id_user')
->andWhere('user_etablissement.actif = 1') ->andWhere('user_etablissement.actif = 1')

+ 7
- 2
backend/views/user/index.php View File

'headerOptions' => ['class' => 'actions'], 'headerOptions' => ['class' => 'actions'],
'buttons' => [ 'buttons' => [
'commandes' => function ($url, $model) { 'commandes' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/commandes','id' => $model['id']]) ;
$count_commandes = Commande::find()->joinWith('production')->where(['id_user' => $model['id'], 'production.id_etablissement' => Yii::$app->user->identity->id_etablissement])->count() ;
$url = Yii::$app->urlManager->createUrl(['user/commandes','id' => $model['user_id']]) ;
$count_commandes = Commande::find()
->joinWith('production')
->where([
'id_user' => $model['user_id'],
'production.id_etablissement' => Yii::$app->user->identity->id_etablissement])
->count() ;
$html = '' ; $html = '' ;
if($count_commandes) if($count_commandes)
{ {

Loading…
Cancel
Save