diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 006df3f260b..250803e65da 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -42,7 +42,7 @@ $langs->load('bills'); $langs->load('suppliers'); $langs->load('companies'); -// Sécurité accés client +// S�curit� acc�s client if ($user->societe_id > 0) { $action = ''; @@ -120,7 +120,7 @@ if ($_POST['action'] == 'update' && ! $_POST['cancel']) $result = $db->query( $sql); } /* - * Action création + * Action cr�ation */ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) { @@ -257,7 +257,7 @@ if ($_GET['action'] == 'add_ligne') { $result=$nv_prod->fetch($idprod); - // cas spécial pour lequel on a les meme référence que le fournisseur + // cas sp�cial pour lequel on a les meme r�f�rence que le fournisseur // $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle; $label = $nv_prod->libelle; @@ -274,7 +274,7 @@ if ($_GET['action'] == 'add_ligne') } if ($idprod == -1) { - // Quantité insuffisante + // Quantit� insuffisante $mesg='
'.$langs->trans("ErrorQtyTooLowForThisSupplier").'
'; } } @@ -346,7 +346,7 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy') } else { - $html->select_societes(empty($_GET['socid'])?'':$_GET['socid'],'socid','s.fournisseur = 1'); + $html->select_societes((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1'); } print ''; print ''.$langs->trans('NotePublic').''; @@ -816,7 +816,7 @@ else print ''; print ''; - // Ajout de produits/services prédéfinis + // Ajout de produits/services pr�d�finis if ($conf->produit->enabled) { print '
'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 52ffb4be72e..a7f8a726730 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -674,6 +674,7 @@ class Form } $sql.= " ORDER BY nom ASC"; + dolibarr_syslog("Html.form::select_societe sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -696,7 +697,7 @@ class Form { print ''; } - print ajax_autocompleter($socid,$htmlname,'/societe/ajaxcompanies.php',''); + print ajax_autocompleter($socid,$htmlname,'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); print ''; print ''; print ajax_indicator($htmlname,'working'); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index ecb40e2f916..c0e4439c6d3 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -1,7 +1,8 @@ * Copyright (C) 2005-2007 Regis Houssin - * + * Copyright (C) 2007 Laurent Destailleur + * * 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 * the Free Software Foundation; either version 2 of the License, or @@ -17,11 +18,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/societe/ajaxcountries.php + \file htdocs/societe/ajaxcompanies.php \brief Fichier de reponse sur evenement Ajax \version $Revision$ */ @@ -32,26 +32,26 @@ top_htmlhead("", "", 1, 1); print ''; -// Generation liste des sociétés -if(isset($_POST['newcompany']) && !empty($_POST['newcompany']) || isset($_POST['socid']) && !empty($_POST['socid']) - || isset($_POST['id_fourn']) && !empty($_POST['id_fourn'])) +// Generation liste des societes +if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST['id_fourn'])) { - + // Define filter on text typed $socid = $_POST['newcompany']?$_POST['newcompany']:''; - $socid = $_POST['socid']?$_POST['socid']:''; - $socid = $_POST['id_fourn']?$_POST['id_fourn']:''; + if (! $socid) $socid = $_POST['socid']?$_POST['socid']:''; + if (! $socid) $socid = $_POST['id_fourn']?$_POST['id_fourn']:''; $sql = "SELECT rowid, nom"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe"; - $sql.= " WHERE nom LIKE '%" . utf8_decode($socid) . "%'"; - $sql.= " ORDER BY nom ASC;"; - + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE nom LIKE '%" . $socid . "%'"; + if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters + $sql.= " ORDER BY nom ASC"; + + //dolibarr_syslog("ajaxcompanies sql=".$sql); $resql=$db->query($sql); - if ($resql) { print '
    '; - while($company = $db->fetch_object($resql)) + while ($company = $db->fetch_object($resql)) { print '
  • '; print $company->nom;