From 2ca1d314d599f74dded14cfc5df33e1943d0059d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Feb 2007 11:00:18 +0000 Subject: [PATCH] =?UTF-8?q?D=E9but=20ajout=20de=20l'autocompl=E9tion=20aja?= =?UTF-8?q?x=20sur=20la=20liste=20d=E9roulante=20des=20pays?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/ajaxresponse.php | 32 +++++++++++-- htdocs/html.form.class.php | 98 ++++++++++++++++++++++---------------- htdocs/main.inc.php | 2 + 3 files changed, 87 insertions(+), 45 deletions(-) diff --git a/htdocs/ajaxresponse.php b/htdocs/ajaxresponse.php index 8ce37773bf5..b30a23fdef5 100644 --- a/htdocs/ajaxresponse.php +++ b/htdocs/ajaxresponse.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005-2007 Regis Houssin * * 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 @@ -21,7 +22,7 @@ /** \file htdocs/ajaxresponse.php - \brief Fichier de reponse sur evenement ajax pour generation liste produits + \brief Fichier de reponse sur evenement Ajax \version $Revision$ */ @@ -36,8 +37,33 @@ print '"; print "\n"; -$form = new Form($db); -$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]); +// Generation liste de produits +if(isset($_GET['keyref']) && !empty($_GET['keyref']) || isset($_GET['keylabel']) && !empty($_GET['keylabel'])) +{ + $form = new Form($db); + $form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]); +} + +if(isset($_POST['search']) && !empty($_POST['search'])) +{ + print 'hello world'; + $sql = "SELECT rowid, code, libelle, active"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_pays"; + $sql.= " WHERE active = 1 AND libelle LIKE '%" . $_POST['search'] . "%'"; + $sql.= " ORDER BY code ASC;"; + + $resql=$this->db->query($sql); + + if ($resql) + { + print ''; + } +} print ""; print ""; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 911a4a5247c..9ca11af2a01 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -320,36 +320,50 @@ class Form $resql=$this->db->query($sql); if ($resql) { - print ''; + print ''; + print '
'; + print ''; } - print ''; - return 0; - } - else { - dolibarr_print_error($this->db); + else + { + print ''; + return 0; + } + } + else + { + dolibarr_print_error($this->db); return 1; } } @@ -717,21 +731,21 @@ class Form { global $langs,$conf,$user; if ($conf->use_ajax && $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) - { - print $langs->trans("Ref").':   '; - print $langs->trans("Label").':'; - print ''; - print ''; - print '
'; - } + { + print $langs->trans("Ref").':   '; + print $langs->trans("Label").':'; + print ''; + print ''; + print '
'; + } else - { - $this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level); - } + { + $this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level); + } } /** diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0eec61d3a1e..93537235684 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -524,6 +524,8 @@ function top_htmlhead($head, $title="", $target="") { print ''."\n"; print ''."\n"; + print ''."\n"; + print ''."\n"; } print "\n";