Fix: La liste deroulant ajax sur creation facture fourn affichait les clients

This commit is contained in:
Laurent Destailleur 2007-12-21 11:13:13 +00:00
parent 993799af8b
commit 635a492549
3 changed files with 23 additions and 22 deletions

View File

@ -42,7 +42,7 @@ $langs->load('bills');
$langs->load('suppliers'); $langs->load('suppliers');
$langs->load('companies'); $langs->load('companies');
// Sécurité accés client // S<EFBFBD>curit<EFBFBD> acc<63>s client
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -120,7 +120,7 @@ if ($_POST['action'] == 'update' && ! $_POST['cancel'])
$result = $db->query( $sql); $result = $db->query( $sql);
} }
/* /*
* Action création * Action cr<EFBFBD>ation
*/ */
if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
{ {
@ -257,7 +257,7 @@ if ($_GET['action'] == 'add_ligne')
{ {
$result=$nv_prod->fetch($idprod); $result=$nv_prod->fetch($idprod);
// cas spécial pour lequel on a les meme référence que le fournisseur // cas sp<EFBFBD>cial pour lequel on a les meme r<>f<EFBFBD>rence que le fournisseur
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle; // $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
$label = $nv_prod->libelle; $label = $nv_prod->libelle;
@ -274,7 +274,7 @@ if ($_GET['action'] == 'add_ligne')
} }
if ($idprod == -1) if ($idprod == -1)
{ {
// Quantité insuffisante // Quantit<EFBFBD> insuffisante
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
} }
} }
@ -346,7 +346,7 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy')
} }
else 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 '</td>'; print '</td>';
print '<td width="50%">'.$langs->trans('NotePublic').'</td></tr>'; print '<td width="50%">'.$langs->trans('NotePublic').'</td></tr>';
@ -816,7 +816,7 @@ else
print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>'; print '<td align="center" valign="middle" colspan="2"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td></tr>';
print '</form>'; print '</form>';
// Ajout de produits/services prédéfinis // Ajout de produits/services pr<EFBFBD>d<EFBFBD>finis
if ($conf->produit->enabled) if ($conf->produit->enabled)
{ {
print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&amp;action=add_ligne" method="post">'; print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&amp;action=add_ligne" method="post">';

View File

@ -674,6 +674,7 @@ class Form
} }
$sql.= " ORDER BY nom ASC"; $sql.= " ORDER BY nom ASC";
dolibarr_syslog("Html.form::select_societe sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -696,7 +697,7 @@ class Form
{ {
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'"/>'; print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'"/>';
} }
print ajax_autocompleter($socid,$htmlname,'/societe/ajaxcompanies.php',''); print ajax_autocompleter($socid,$htmlname,'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
print '</td>'; print '</td>';
print '<td class="nobordernopadding" align="left" width="16">'; print '<td class="nobordernopadding" align="left" width="16">';
print ajax_indicator($htmlname,'working'); print ajax_indicator($htmlname,'working');

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> /* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,11 +18,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
\file htdocs/societe/ajaxcountries.php \file htdocs/societe/ajaxcompanies.php
\brief Fichier de reponse sur evenement Ajax \brief Fichier de reponse sur evenement Ajax
\version $Revision$ \version $Revision$
*/ */
@ -32,26 +32,26 @@ top_htmlhead("", "", 1, 1);
print '<body id="mainbody">'; print '<body id="mainbody">';
// Generation liste des sociétés // Generation liste des societes
if(isset($_POST['newcompany']) && !empty($_POST['newcompany']) || isset($_POST['socid']) && !empty($_POST['socid']) if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST['id_fourn']))
|| isset($_POST['id_fourn']) && !empty($_POST['id_fourn']))
{ {
// Define filter on text typed
$socid = $_POST['newcompany']?$_POST['newcompany']:''; $socid = $_POST['newcompany']?$_POST['newcompany']:'';
$socid = $_POST['socid']?$_POST['socid']:''; if (! $socid) $socid = $_POST['socid']?$_POST['socid']:'';
$socid = $_POST['id_fourn']?$_POST['id_fourn']:''; if (! $socid) $socid = $_POST['id_fourn']?$_POST['id_fourn']:'';
$sql = "SELECT rowid, nom"; $sql = "SELECT rowid, nom";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE nom LIKE '%" . utf8_decode($socid) . "%'"; $sql.= " WHERE nom LIKE '%" . $socid . "%'";
$sql.= " ORDER BY nom ASC;"; 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); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
print '<ul>'; print '<ul>';
while($company = $db->fetch_object($resql)) while ($company = $db->fetch_object($resql))
{ {
print '<li>'; print '<li>';
print $company->nom; print $company->nom;