Fix: bad search ajax
This commit is contained in:
parent
1e791b1f9e
commit
8a38a76821
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009 Cyrille de Lambert <info@auguria.net>
|
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.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
|
||||||
@ -48,25 +48,24 @@ if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST[
|
|||||||
$socid = $_POST['newcompany']?$_POST['newcompany']:'';
|
$socid = $_POST['newcompany']?$_POST['newcompany']:'';
|
||||||
if (! $socid) $socid = $_POST['socid']?$_POST['socid']:'';
|
if (! $socid) $socid = $_POST['socid']?$_POST['socid']:'';
|
||||||
if (! $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 as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " WHERE 1=1";
|
$sql.= " WHERE 1=1";
|
||||||
if ($socid){
|
if ($socid){
|
||||||
$sql.=" AND (rowid LIKE '%" . $socid . "%'";
|
$sql.=" AND (rowid LIKE '%" . $socid . "%'";
|
||||||
$sql.=" OR nom LIKE '%" . $socid . "%'";
|
$sql.=" OR nom LIKE '%" . $socid . "%'";
|
||||||
$sql.=" OR code_fournisseur LIKE '%" . $socid . "%')";
|
$sql.=" OR code_fournisseur LIKE '%" . $socid . "%')";
|
||||||
}
|
}
|
||||||
if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters
|
if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters
|
||||||
$sql.= " ORDER BY nom ASC";
|
$sql.= " ORDER BY nom ASC";
|
||||||
|
|
||||||
dol_syslog("requete sql = ".$sql);
|
//dol_syslog("ajaxcompanies sql=".$sql);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
dol_syslog("resulat OK");
|
|
||||||
print '<ul>';
|
print '<ul>';
|
||||||
while ($company = $resql->fetch_object())
|
while ($company = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
print '<li>';
|
print '<li>';
|
||||||
print $company->nom;
|
print $company->nom;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user