From e5ee280c269afa2e0c8d0e4c23c8169e9e946e04 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 4 Aug 2003 19:50:47 +0000 Subject: [PATCH] =?UTF-8?q?Bascule=20sur=20la=20fiche=20si=201=20seul=20et?= =?UTF-8?q?=20unique=20r=E9ponse=20=E0=20une=20recherche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/clients.php3 | 45 ++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/clients.php3 b/htdocs/comm/clients.php3 index 4b7baef4c44..f3ce6573b9a 100644 --- a/htdocs/comm/clients.php3 +++ b/htdocs/comm/clients.php3 @@ -25,8 +25,6 @@ require("../lib/webcal.class.php3"); require("../cactioncomm.class.php3"); require("../actioncomm.class.php3"); -llxHeader(); - /* * Sécurité accés client */ @@ -130,21 +128,26 @@ if ($action == 'stcomm') * * */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.idp FROM llx_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; +/* +if ($mode == 'search') +{ + if ($mode-search == 'soc') + { + $sql = "SELECT s.idp FROM llx_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(); } - $db->free(); - } } - +*/ if ($page == -1) { $page = 0 ; } $offset = $conf->liste_limit * $page ; @@ -197,6 +200,18 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows(); + + if ($num == 1) + { + $obj = $db->fetch_object(0); + Header("Location: fiche.php3?socid=$obj->idp"); + } + else + { + llxHeader(); + } + + print_barre_liste("Liste des clients", $page, $PHP_SELF,"",$sortfield,$sortorder,'',$num); $i = 0;