From 85f0462c2028d0428bf376127c43623d9274d7f6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 15:16:49 +0100 Subject: [PATCH] Suppliers list --- htdocs/fourn/list.php | 57 +++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index d3f7e55c19976..296415c1aee5a 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -32,15 +32,15 @@ $langs->load("orders"); $langs->load("companies"); -$socname = GETPOST("socname"); -$search_nom = GETPOST("search_nom"); -$search_zipcode = GETPOST("search_zipcode"); -$search_town = GETPOST("search_town"); -$search_code_fournisseur = GETPOST("search_code_fournisseur"); -$search_compta_fournisseur = GETPOST("search_compta_fournisseur"); -$search_datec = GETPOST("search_datec"); -$search_categ = GETPOST('search_categ','int'); -$catid = GETPOST("catid",'int'); +$socname = GETPOST("socname"); +$search_name = GETPOST("search_name"); +$search_zipcode = GETPOST("search_zipcode"); +$search_town = GETPOST("search_town"); +$search_supplier_code = GETPOST("search_supplier_code"); +$search_supplier_accounting = GETPOST("search_supplier_accounting"); +$search_datec = GETPOST("search_datec"); +$search_categ = GETPOST('search_categ','int'); +$catid = GETPOST("catid",'int'); // Security check $socid = GETPOST('socid','int'); @@ -60,6 +60,19 @@ // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('supplierlist')); +if (GETPOST("button_removefilter_x")) +{ + $socname=""; + $search_name=""; + $search_zipcode=""; + $search_town=""; + $search_supplier_code=""; + $search_supplier_accounting=""; + $search_datec=""; + $search_categ=""; + $catid=""; +} + /* * Actions */ @@ -95,15 +108,15 @@ $sortfield = "s.nom"; $sortorder = "ASC"; } -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_name) { + $sql .= natural_search('s.nom', $search_name); } if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { $sql .= natural_search('s.town', $search_town); } -if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'"; -if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'"; +if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'"; +if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL"; @@ -126,7 +139,7 @@ $num = $db->num_rows($resql); $i = 0; - $param = "&search_nom=".$search_nom."&search_code_fournisseur=".$search_code_fournisseur."&search_zipcode=".$search_zipcode."&search_town=".$search_town; + $param = "&search_name=".$search_name."&search_supplier_code=".$search_supplier_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); @@ -166,26 +179,28 @@ print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; - + print ''; + print ''; + print "\n"; + $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook