Skip to content

Commit

Permalink
Merge pull request #4688 from fmarcet/3.8
Browse files Browse the repository at this point in the history
FIX: Some filters are lost when paging
  • Loading branch information
Juanjo Menent committed Feb 26, 2016
2 parents ac6001c + 30d6aa0 commit a956195
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
21 changes: 14 additions & 7 deletions htdocs/commande/list.php
Expand Up @@ -9,6 +9,7 @@
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -44,8 +45,10 @@

$orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
$orderday=GETPOST("orderday","int");
$deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int");
$deliveryday=GETPOST("deliveryday","int");
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha');
$search_ref_customer=GETPOST('search_ref_customer','alpha');
Expand Down Expand Up @@ -87,7 +90,9 @@
$search_total_ht='';
$orderyear='';
$ordermonth='';
$deliverymonth='';
$orderday='';
$deliveryday='';
$deliverymonth='';
$deliveryyear='';
}

Expand Down Expand Up @@ -168,10 +173,10 @@
}
if ($ordermonth > 0)
{
if ($orderyear > 0 && empty($day))
if ($orderyear > 0 && empty($orderday))
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'";
else if ($orderyear > 0 && ! empty($day))
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $day, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $day, $orderyear))."'";
else if ($orderyear > 0 && ! empty($orderday))
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'";
else
$sql.= " AND date_format(c.date_commande, '%m') = '".$ordermonth."'";
}
Expand All @@ -181,10 +186,10 @@
}
if ($deliverymonth > 0)
{
if ($deliveryyear > 0 && empty($day))
if ($deliveryyear > 0 && empty($deliveryday))
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'";
else if ($deliveryyear > 0 && ! empty($day))
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $day, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $day, $deliveryyear))."'";
else if ($deliveryyear > 0 && ! empty($deliveryday))
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'";
else
$sql.= " AND date_format(c.date_livraison, '%m') = '".$deliverymonth."'";
}
Expand Down Expand Up @@ -240,8 +245,10 @@
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');

$param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($orderday) $param.='&orderday='.$orderday;
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
if ($orderyear) $param.='&orderyear='.$orderyear;
if ($deliveryday) $param.='&deliveryday='.$deliveryday;
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
if ($search_ref) $param.='&search_ref='.$search_ref;
Expand Down
11 changes: 9 additions & 2 deletions htdocs/compta/facture/list.php
Expand Up @@ -10,7 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -119,7 +119,6 @@
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_categ='';
$search_user='';
$search_sale='';
$search_product_category='';
Expand All @@ -132,6 +131,9 @@
$day='';
$year='';
$month='';
$day_lim='';
$year_lim='';
$month_lim='';
}


Expand Down Expand Up @@ -261,13 +263,18 @@
}

$param='&socid='.$socid;
if ($day) $param.='&day='.$day;
if ($month) $param.='&month='.$month;
if ($year) $param.='&year=' .$year;
if ($day_lim) $param.='&day_lim='.$day_lim;
if ($month_lim) $param.='&month_lim='.$month_lim;
if ($year_lim) $param.='&year_lim=' .$year_lim;
if ($search_ref) $param.='&search_ref=' .$search_ref;
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
if ($search_societe) $param.='&search_societe=' .$search_societe;
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
Expand Down
10 changes: 9 additions & 1 deletion htdocs/fourn/facture/list.php
Expand Up @@ -8,7 +8,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -93,6 +93,10 @@
$search_status="";
$year="";
$month="";
$day="";
$year_lim="";
$month_lim="";
$day_lim="";
}

/*
Expand Down Expand Up @@ -230,8 +234,12 @@
}

$param='&socid='.$socid;
if ($day) $param.='&day='.urlencode($day);
if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year);
if ($day_lim) $param.='&day_lim='.urlencode($day_lim);
if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier);
if ($search_label) $param.='&search_label='.urlencode($search_label);
Expand Down

0 comments on commit a956195

Please sign in to comment.