Преглед на файлове

[Administration] Utilisateurs : correctif tri par crédit #1209

feature/souke
Guillaume Bourgeois преди 1 година
родител
ревизия
f17772f08c
променени са 2 файла, в които са добавени 12 реда и са изтрити 9 реда
  1. +1
    -0
      backend/views/user/index.php
  2. +11
    -9
      common/logic/User/User/Model/UserSearch.php

+ 1
- 0
backend/views/user/index.php Целия файл

@@ -175,6 +175,7 @@ $this->render('_menu', [
) . '
</span>
</div>';

return $html;
}
],

+ 11
- 9
common/logic/User/User/Model/UserSearch.php Целия файл

@@ -62,9 +62,6 @@ class UserSearch extends User

public function search($params = [])
{
$userRepository = UserRepository::getInstance();
$optionsSearch = $userRepository->getDefaultOptionsSearch();

$query = User::find()
->select(
'`user`.id, '
@@ -91,14 +88,24 @@ class UserSearch extends User
. '`user`.type, '
. '(SELECT COUNT(*) FROM `order` WHERE `user`.id = `order`.id_user) AS count_orders');

$query->innerJoin('user_producer', 'user.id = user_producer.id_user AND user_producer.id_producer = :id_producer AND user_producer.active = 1', [':id_producer' => GlobalParam::getCurrentProducerId()]);

$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['username', 'credit', 'orders']],
'sort' => [
'attributes' => ['username', 'credit', 'orders'],
'defaultOrder' => ['created_at' => SORT_DESC]
],
'pagination' => [
'pageSize' => 20,
],
]);

$dataProvider->sort->attributes['created_at'] = [
'asc' => ['user.created_at' => SORT_ASC],
'desc' => ['user.created_at' => SORT_DESC],
];

$dataProvider->sort->attributes['username'] = [
'asc' => ['user.lastname' => SORT_ASC, 'user.name' => SORT_ASC],
'desc' => ['user.lastname' => SORT_DESC, 'user.name' => SORT_DESC],
@@ -114,10 +121,7 @@ class UserSearch extends User
return $dataProvider;
}

$query->innerJoin('user_producer', 'user.id = user_producer.id_user AND user_producer.id_producer = :id_producer AND user_producer.active = 1', [':id_producer' => GlobalParam::getCurrentProducerId()]);

if (isset($this->id_point_sale) && $this->id_point_sale) {
$pointSale = PointSale::findOne(['id' => $this->id_point_sale]);
$query->innerJoin('user_point_sale', 'user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale', [':id_point_sale' => $this->id_point_sale]);
}

@@ -142,8 +146,6 @@ class UserSearch extends User
['like', 'user.name_legal_person', $this->username],
]);

$query->orderBy('user.created_at DESC');

return $dataProvider;
}


Loading…
Отказ
Запис