Corrections diverses sur code ajax pour éviter plantage sur certains nenv php.
This commit is contained in:
parent
8f3c588156
commit
44a5511973
@ -1,6 +1,5 @@
|
|||||||
<?
|
<?php
|
||||||
/*
|
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -16,12 +15,19 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* 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$
|
||||||
|
* $Source$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/ajaxresponse.php
|
||||||
|
\brief Fichier de reponse sur evenement ajax pour generation liste produits
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
require('./pre.inc.php');
|
require('./pre.inc.php');
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$form->select_produits_do("","","","","",$_GET["keyref"],$_GET["keylabel"]);
|
$form->select_produits_do("","","","","",$_GET["keyref"],$_GET["keylabel"]);
|
||||||
// print $_GET["key"];
|
// print $_GET["key"];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?PHP
|
<?php
|
||||||
/* Copyright (c) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (c) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
@ -617,40 +617,35 @@ class Form
|
|||||||
global $langs,$conf,$user;
|
global $langs,$conf,$user;
|
||||||
if($conf->use_ajax)
|
if($conf->use_ajax)
|
||||||
{
|
{
|
||||||
?>
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/prototype.js"></script>';
|
||||||
<script type="text/javascript" src="<?=DOL_URL_ROOT?>/lib/prototype.js"></script>
|
print '<form>';
|
||||||
<form>
|
print $langs->trans("Ref").'<input type="text" size="5" name="ajkeyref" id="ajkeyref"> ';
|
||||||
<?=$langs->trans("Ref")?><input type="text" size="5" name="ajkeyref" id="ajkeyref">
|
print $langs->trans("Label").'<input type="text" size="5" name="ajkeylabel" id="ajkeylabel">';
|
||||||
<?=$langs->trans("Label")?><input type="text" size="5" name="ajkeylabel" id="ajkeylabel">
|
print '</form>';
|
||||||
</form>
|
print '<div id="'.$htmlname.'"></div>';
|
||||||
<div id='<?=$htmlname ?>'></div>
|
print '<script type="text/javascript">';
|
||||||
<script type="text/javascript">
|
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
||||||
var url = '<?=DOL_URL_ROOT?>/ajaxresponse.php';
|
print 'new Form.Element.Observer($("ajkeyref"), 1, function(){var myAjax = new Ajax.Updater( {success: \''.$htmlname.'\'}, url, {method: \'get\', parameters: "keyref="+$("ajkeyref").value});});';
|
||||||
|
print '</script>';
|
||||||
new Form.Element.Observer($("ajkeyref"), 1, function(){var myAjax = new Ajax.Updater( {success: '<?=$htmlname ?>'}, url, {method: 'get', parameters: "keyref="+$("ajkeyref").value});});
|
print '<script type="text/javascript">';
|
||||||
|
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
||||||
</script>
|
print 'new Form.Element.Observer($("ajkeylabel"), 1, function(){var myAjax = new Ajax.Updater( {success: \''.$htmlname.'\'}, url, {method: \'get\', parameters: "keylabel="+$("ajkeylabel").value});});';
|
||||||
<script type="text/javascript">
|
print '</script>';
|
||||||
var url = '<?=DOL_URL_ROOT?>/ajaxresponse.php';
|
|
||||||
|
|
||||||
new Form.Element.Observer($("ajkeylabel"), 1, function(){var myAjax = new Ajax.Updater( {success: '<?=$htmlname ?>'}, url, {method: 'get', parameters: "keylabel="+$("ajkeylabel").value});});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this -> select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level);
|
$this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste des produits
|
* \brief Retourne la liste des produits
|
||||||
* \param selected Produit présélectionné
|
* \param selected Produit présélectionné
|
||||||
* \param htmlname Nom de la zone select
|
* \param htmlname Nom de la zone select
|
||||||
* \param filtretype Pour filtre sur type de produit
|
* \param filtretype Pour filtre sur type de produit
|
||||||
* \param limit Limite sur le nombre de lignes retournées
|
* \param limit Limite sur le nombre de lignes retournées
|
||||||
*/
|
*/
|
||||||
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeyref='',$ajaxkeylabel='')
|
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeyref='',$ajaxkeylabel='')
|
||||||
{
|
{
|
||||||
global $langs,$conf,$user;
|
global $langs,$conf,$user;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user