Browse Source

[Administration] Utilisateurs > Commandes : ajout filtre par producteur

develop
Guillaume Bourgeois 1 month ago
parent
commit
61c59abafd
2 changed files with 5 additions and 3 deletions
  1. +2
    -1
      backend/controllers/admin/OrderAdminController.php
  2. +3
    -2
      domain/Order/Order/OrderSearch.php

+ 2
- 1
backend/controllers/admin/OrderAdminController.php View File

@@ -68,8 +68,9 @@ class OrderAdminController extends BackendController
{
$searchModel = new OrderSearch();
$dataProvider = $searchModel->search([
'ignore_id_producer' => true,
'order_by' => 'IF(ISNULL(date_update), `order`.`date`, `order`.`date_update`) DESC'
], [
'ignore_id_producer' => true,
]);

return $this->render('index', [

+ 3
- 2
domain/Order/Order/OrderSearch.php View File

@@ -42,7 +42,7 @@ use yii\data\ActiveDataProvider;

class OrderSearch extends Order
{
public function search($params)
public function search($params, $options = [])
{
$paramsSearch = [];
if(isset($params['id_user'])) {
@@ -50,7 +50,8 @@ class OrderSearch extends Order
}

$query = Order::searchQuery($paramsSearch, [
'orderby' => isset($params['order_by']) ? $params['order_by'] : 'distribution.date DESC'
'orderby' => isset($params['order_by']) ? $params['order_by'] : 'distribution.date DESC',
'ignore_id_producer' => isset($options['ignore_id_producer']) ? $options['ignore_id_producer'] : false
]);
$dataProvider = new ActiveDataProvider([

Loading…
Cancel
Save