From 5953f18f545ef9b557568bf64cc3e9d44b0c188b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 May 2012 22:58:12 +0200 Subject: [PATCH] Fix: filter on status --- htdocs/commande/class/commande.class.php | 3 ++- htdocs/commande/liste.php | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ce2b3014604..76a27ab2769 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2363,7 +2363,8 @@ class Commande extends CommonObject $clause = " AND"; } $sql.= $clause." c.entity = ".$conf->entity; - $sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; + //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; + $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; $resql=$this->db->query($sql); diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index ad32f3e39de..18e76541ae3 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * @@ -108,12 +108,13 @@ if ($viewstatut <> '') } if ($viewstatut == -2) // To process { - $sql .= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; + //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; + $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected } } if ($ordermonth > 0) { - $sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'"; + $sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'"; // TODO do not use date_format but a between } if ($orderyear > 0) { @@ -178,7 +179,7 @@ if ($resql) print_liste_field_titre($langs->trans('RefCustomerOrder'),'liste.php','c.ref_client','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('OrderDate'),'liste.php','c.date_commande','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DeliveryDate'),'liste.php','c.date_livraison','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),'liste.php','c.fk_statut','','&socid='.$socid.'&viewstatut='.$viewstatut,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),'liste.php','c.fk_statut','','&socid='.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield,$sortorder); print ''; // Lignes des champs de filtre print '
';