ソースを参照

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

refactoring
Guillaume Bourgeois 2年前
コミット
097d2c297a
3個のファイルの変更44行の追加35行の削除
  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 ファイルの表示

@@ -79,7 +79,7 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
],
'name',
[
'attribute' => 'id_user',
'attribute' => 'username',
'header' => 'Utilisateur',
'value' => function($model) {
return $model->user->getUsername() ;

+ 42
- 34
common/models/InvoiceSearch.php ファイルの表示

@@ -44,44 +44,52 @@ use common\models\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 ファイルの表示

@@ -15,6 +15,7 @@
niveau des produits
</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] 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>

読み込み中…
キャンセル
保存