Fix: Products on hold are not reported in list with ajax selector
This commit is contained in:
parent
5a6b708626
commit
f92c05ec38
@ -932,14 +932,15 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
\brief Retourne la liste des produits en Ajax si ajax activé ou renvoie à select_produits_do
|
||||
\param selected Produit pré-sélectionné
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param limit Limite sur le nombre de lignes retournées
|
||||
\param price_level Niveau de prix en fonction du client
|
||||
\brief Retourne la liste des produits en Ajax si ajax activé ou renvoie à select_produits_do
|
||||
\param selected Produit pré-sélectionné
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param limit Limite sur le nombre de lignes retournées
|
||||
\param price_level Niveau de prix en fonction du client
|
||||
\param status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||
*/
|
||||
function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0)
|
||||
function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$status=1)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@ -956,13 +957,13 @@ class Form
|
||||
print '</tr>';
|
||||
print '<tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding" colspan="3">';
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type=1','');
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtretype.'&status='.$status,'');
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level);
|
||||
$this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level,'',$status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,8 +975,9 @@ class Form
|
||||
\param limit Limite sur le nombre de lignes retournées
|
||||
\param price_level Niveau de prix en fonction du client
|
||||
\param ajaxkeysearch Filtre des produits si ajax est utilisé
|
||||
\param status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||
*/
|
||||
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeysearch='')
|
||||
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeysearch='',$status=1)
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
|
||||
@ -991,13 +993,14 @@ class Form
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql.= " WHERE p.envente = 1";
|
||||
if ($status >= 0) $sql.= " WHERE p.envente = ".$status;
|
||||
else $sql.= " WHERE 1 = 1";
|
||||
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||
}
|
||||
if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype;
|
||||
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%'";
|
||||
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')";
|
||||
$sql.= " ORDER BY p.nbvente DESC";
|
||||
if ($limit) $sql.= " LIMIT $limit";
|
||||
|
||||
@ -1128,7 +1131,7 @@ class Form
|
||||
\param selected Produit pré-sélectionné
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param limit Limite sur le nombre de lignes retournées
|
||||
\param filtre Pour filtre sql
|
||||
*/
|
||||
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='')
|
||||
{
|
||||
@ -1136,7 +1139,7 @@ class Form
|
||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'">';
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type=2','working');
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtretype,'working');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1150,7 +1153,7 @@ class Form
|
||||
\param selected Produit pré-sélectionné
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param filtre Pour filtre
|
||||
\param filtre Pour filtre sql
|
||||
\param ajaxkeysearch Filtre des produits si ajax est utilisé
|
||||
*/
|
||||
function select_produits_fournisseurs_do($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='',$ajaxkeysearch='')
|
||||
@ -1169,8 +1172,8 @@ class Form
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pf.rowid = pfp.fk_product_fournisseur";
|
||||
$sql.= " WHERE p.envente = 1";
|
||||
if ($socid) $sql.= " AND pf.fk_soc = ".$socid;
|
||||
if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype;
|
||||
if ($filtre) $sql.="$filtre";
|
||||
if (! empty($filtretype)) $sql.=" AND p.fk_product_type=".$filtretype;
|
||||
if (! empty($filtre)) $sql.=" ".$filtre;
|
||||
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (pf.ref_fourn like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')";
|
||||
$sql.= " ORDER BY pf.ref_fourn DESC";
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -16,15 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/product/ajaxproducts.php
|
||||
\brief Fichier de reponse sur evenement Ajax
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
@ -37,19 +34,22 @@ top_htmlhead("", "", 1);
|
||||
print '<body class="nocellnopadd">'."\n";
|
||||
|
||||
// Generation liste de produits
|
||||
if(isset($_GET['keysearch']) && !empty($_GET['keysearch']))
|
||||
if (! empty($_GET['keysearch']))
|
||||
{
|
||||
$status=-1;
|
||||
if (isset($_GET['status'])) $status=$_GET['status'];
|
||||
|
||||
$form = new Form($db);
|
||||
if ($_GET['type'] == 1)
|
||||
{
|
||||
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keysearch"]);
|
||||
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keysearch"],$status);
|
||||
}
|
||||
else if ($_GET['type'] == 2)
|
||||
if ($_GET['type'] == 2)
|
||||
{
|
||||
$form->select_produits_fournisseurs_do($_GET["socid"],"",$_GET["htmlname"],"","",$_GET["keysearch"]);
|
||||
}
|
||||
}
|
||||
else if(isset($_GET['markup']) && !empty($_GET['markup']))
|
||||
else if (! empty($_GET['markup']))
|
||||
{
|
||||
print $_GET['markup'];
|
||||
//print $_GET['count'];
|
||||
@ -57,7 +57,7 @@ else if(isset($_GET['markup']) && !empty($_GET['markup']))
|
||||
//print '<input size="10" type="text" class="flat" id="sellingdata_ht'.$_GET['count'].'" name="sellingdata_ht'.$_GET['count'].'" value="'.$field.'">';
|
||||
//print $field;
|
||||
}
|
||||
else if(isset($_GET['selling']) && !empty($_GET['selling']))
|
||||
else if (! empty($_GET['selling']))
|
||||
{
|
||||
//print $_GET['markup'];
|
||||
//print $_GET['count'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user