diff --git a/htdocs/telephonie/ligne/commande/liste.php b/htdocs/telephonie/ligne/commande/liste.php index 14d365bfe23..8c8d3af19ab 100644 --- a/htdocs/telephonie/ligne/commande/liste.php +++ b/htdocs/telephonie/ligne/commande/liste.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2005 Rodolphe Quiedeville * * 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 @@ -26,8 +26,6 @@ $page = $_GET["page"]; $sortorder = $_GET["sortorder"]; $sortfield = $_GET["sortfield"]; - - if ($_GET["action"] == "commande" && $user->rights->telephonie->ligne_commander) { $ltel = new LigneTel($db); @@ -56,26 +54,6 @@ if ($sortfield == "") { $sortfield="l.statut"; } -/* - * Recherche - * - * - */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(0); - $socid = $obj->idp; - } - $db->free(); - } -} - if ($page == -1) { $page = 0 ; } $offset = $conf->liste_limit * $page ; @@ -90,10 +68,13 @@ $pagenext = $page + 1; */ $sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid AND l.statut IN (-1,1,4) "; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; +$sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; +$sql .= ",".MAIN_DB_PREFIX."societe as sf"; +$sql .= " WHERE l.fk_soc = s.idp "; +$sql .= " AND l.fk_fournisseur = f.rowid "; +$sql .= " AND l.statut IN (-1,1,4) "; $sql .= " AND l.fk_soc_facture = sf.idp"; $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); @@ -127,7 +108,7 @@ if ($result) if (!array_key_exists($obj->fournid, $fourntels)) { $ft = new FournisseurTelephonie($db, $obj->fournid); - $ft->fetch(); + $ft->fetch($obj->fournid); $fourntels[$obj->fournid] = $ft; } @@ -168,8 +149,8 @@ if ($result) print ''.$ligne->statuts[$obj->statut]."\n"; } - print ''.$obj->nom.''; - print ''.$obj->sfnom.''; + print ''.stripslashes($obj->nom).''; + print ''.stripslashes($obj->sfnom).''; print ''.$socf->verif_rib().''; print "".$obj->fournisseur."\n"; print "\n";