Browse Source

[Administration] Documents > Liste : filtre par utilisateur #271

refactoring
Guillaume Bourgeois 2 years ago
parent
commit
097d2c297a
3 changed files with 44 additions and 35 deletions
  1. +1
    -1
      backend/views/invoice/index.php
  2. +42
    -34
      common/models/InvoiceSearch.php
  3. +1
    -0
      common/versions/22.10.A.php

+ 1
- 1
backend/views/invoice/index.php View File

], ],
'name', 'name',
[ [
'attribute' => 'id_user',
'attribute' => 'username',
'header' => 'Utilisateur', 'header' => 'Utilisateur',
'value' => function($model) { 'value' => function($model) {
return $model->user->getUsername() ; return $model->user->getUsername() ;

+ 42
- 34
common/models/InvoiceSearch.php View File

class InvoiceSearch extends Invoice class InvoiceSearch extends Invoice
{ {


public function rules()
{
return [
[[], 'safe'],
[['comment', 'address', 'status'], 'string'],
[['id_user'], 'integer'],
[['name', 'reference'], 'string', 'max' => 255],
];
}

public function search($params)
{
$optionsSearch = self::defaultOptionsSearch();
var $username;


$query = Invoice::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'])
->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('invoice.status ASC, invoice.reference DESC')
->groupBy('invoice.id');
public function rules()
{
return [
[[], 'safe'],
[['comment', 'address', 'status', 'username'], 'string'],
[['name', 'reference'], 'string', 'max' => 255],
];
}


$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'reference', 'date']],
'pagination' => [
'pageSize' => 20,
],
]);
public function search($params)
{
$optionsSearch = self::defaultOptionsSearch();


$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$query = Invoice::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'])
->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('invoice.status ASC, invoice.reference DESC')
->groupBy('invoice.id');


$query->andFilterWhere(['like', 'invoice.name', $this->name]);
$query->andFilterWhere(['like', 'invoice.reference', $this->reference]);
$query->andFilterWhere(['like', 'invoice.status', $this->status]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'reference', 'date']],
'pagination' => [
'pageSize' => 20,
],
]);


return $dataProvider;
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
} }

$query->andFilterWhere(['like', 'invoice.name', $this->name]);
$query->andFilterWhere(['like', 'invoice.reference', $this->reference]);
$query->andFilterWhere(['like', 'invoice.status', $this->status]);

$query->andFilterWhere([
'or',
['like', 'user.lastname', $this->username],
['like', 'user.name', $this->username],
['like', 'user.name_legal_person', $this->username],
]);

return $dataProvider;
}
} }

+ 1
- 0
common/versions/22.10.A.php View File

niveau des produits niveau des produits
</li> </li>
<li>[Administration] Documents > liste : ajout champs "Envoyé"</li> <li>[Administration] Documents > liste : ajout champs "Envoyé"</li>
<li>[Administration] Documents > factures > liste : filtre par utilisateur</li>
<li>[Administration] Paramètres : tri et réagencement</li> <li>[Administration] Paramètres : tri et réagencement</li>
<li>[Administration] Développement : page de suivi des versions du logiciel (liste des évolutions et correctifs)</li> <li>[Administration] Développement : page de suivi des versions du logiciel (liste des évolutions et correctifs)</li>
<li>[Espace producteur] Formulaire de contact avec protection par captcha</li> <li>[Espace producteur] Formulaire de contact avec protection par captcha</li>

Loading…
Cancel
Save