diff --git a/htdocs/ajaxbox.php b/htdocs/ajaxbox.php index 72a01728500..31c90506857 100644 --- a/htdocs/ajaxbox.php +++ b/htdocs/ajaxbox.php @@ -23,9 +23,10 @@ * \version $Id$ */ -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // This is to make Dolibarr working with Plesk set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index bdacde356a3..5ef158d875a 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -248,7 +248,7 @@ class Form } print ajax_indicator($htmlname,'working'); - print ajax_autocompleter($pays_id,'pays','/societe/ajaxcountries.php',''); + print ajax_autocompleter($pays_id,'pays',DOL_URL_ROOT.'/societe/ajaxcountries.php',''); } else { @@ -495,7 +495,7 @@ class Form //$htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; $htmloption=''; - print ''."\n"; + print "\n".''."\n"; print ''; print ''; print '
'; if ($socid == 0) @@ -507,7 +507,7 @@ class Form { print ''; } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); + print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); print ''; print ajax_indicator($htmlname,'working'); @@ -771,18 +771,17 @@ class Form if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) { - print ''; - print '
'; + print ''; + print ''; - print ''; - print ''; + print ''; print ''; print ''; print ''; print '
'; print $langs->trans("RefOrLabel").':'; + print ''; print ajax_indicator($htmlname,'working'); // Indicator is et here print ' '; - print '
'; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,''); // Indicator is '' to disable it as it is alreay output + print ajax_updater($htmlname,'keysearch',DOL_URL_ROOT.'/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,''); // Indicator is '' to disable it as it is alreay output print '
'; } @@ -999,7 +998,7 @@ class Form if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) { print $langs->trans("RefOrLabel").' : '; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtertype.'&mode=2','working'); + print ajax_updater($htmlname,'keysearch',DOL_URL_ROOT.'/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtertype.'&mode=2','working'); } else { diff --git a/htdocs/html.formcompany.class.php b/htdocs/html.formcompany.class.php index bf2c852aee1..097d2d64c98 100644 --- a/htdocs/html.formcompany.class.php +++ b/htdocs/html.formcompany.class.php @@ -474,7 +474,7 @@ class FormCompany $javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'newcompany_id\').value;"; $htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; - print ''."\n"; + print "\n".''."\n"; print ''; print '
'; if ($obj->rowid == 0) diff --git a/htdocs/lib/ajax.lib.php b/htdocs/lib/ajax.lib.php index a01c3ed8fb1..4281e8d630c 100644 --- a/htdocs/lib/ajax.lib.php +++ b/htdocs/lib/ajax.lib.php @@ -31,7 +31,7 @@ function ajax_indicator($htmlname,$indicator='working') } /** - * \brief Recupere la valeur d'un champ, effectue un traitement Ajax et affiche le resultat + * \brief Get value of a field, do Ajax process and show result * \param htmlname nom et id du champ * \param keysearch nom et id complementaire du champ de collecte * \param url chemin du fichier de reponse : /chemin/fichier.php @@ -136,7 +136,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working') paramName: \''.$htmlname.'\', indicator: \'indicator'.$htmlname.'\', afterUpdateElement: ac_return - });'; + });'; // Note: The ac_return will fill value inside the field htmlname (param of Autocompleter constructor) and htmlname_id (function ac_return) $script.= ''; return $script; diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index 9beaa0de40b..6fac4b050fa 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -585,14 +585,9 @@ function newpopup(url,title) { Licence: GPL ==================================================================*/ function ac_return(field, item){ - // on met en place l'expression régulière - var regex = new RegExp('[0123456789]*-idcache', 'i'); - // on l'applique au contenu - var idCache = regex.exec($(item).innerHTML); - //on récupère l'id - id = idCache[0].replace('-idcache', ''); - // et on l'affecte au champ caché - $(field.name+'_id').value = id; + /*alert('id='+field.name+'-'+item.id);*/ + $(field.name+'_id').value = item.id; + /*alert('after='+$(field.name+'_id').value);*/ } /*================================================================= @@ -601,9 +596,9 @@ function ac_return(field, item){ Author: Regis Houssin Licence: GPL ==================================================================*/ - function ac_delay(funct,delay) { - // délai exprimé en millisecondes avant le déclenchement de l'action - setTimeout(funct,delay); +function ac_delay(funct,delay) { + /* delay before action start */ + setTimeout(funct,delay); } /*================================================================= diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4e737b09098..2fdb9d775f8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -167,9 +167,9 @@ if ($conf->file->main_force_https) // Chargement des includes complementaires de presentation -if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/menu.class.php"); // Need 11ko memory (11ko in 2.2) -if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php"); // Need 690ko memory (800ko in 2.2) -if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once(DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php'); // Need 20ko memory +if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/menu.class.php"); // Need 10ko memory (11ko in 2.2) +if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php"); // Need 660ko memory (800ko in 2.2) +if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once(DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php'); // Need 22ko memory //stopwithmem(); // If install or upgrade process not done or not completely finished, we call the install page. diff --git a/htdocs/product/ajaxproducts.php b/htdocs/product/ajaxproducts.php index cde7ee9592d..f0ffb403ce7 100644 --- a/htdocs/product/ajaxproducts.php +++ b/htdocs/product/ajaxproducts.php @@ -24,7 +24,10 @@ * \version $Id$ */ -define('NOTOKENRENEWAL',1); // Disables token renewal +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (empty($_GET['keysearch']) && ! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); require('../main.inc.php'); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index d6af52b568c..36a8d6e602a 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -24,7 +24,10 @@ * \version $Id$ */ -define('NOTOKENRENEWAL',1); // Disables token renewal +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); require('../main.inc.php'); @@ -53,9 +56,9 @@ if (! empty($_POST['newcompany']) || ! empty($_POST['socid']) || ! empty($_POST[ print '
    '; while ($company = $db->fetch_object($resql)) { - print '
  • '; + print '
  • '; print $company->nom; - print ''; + //print ''; print '
  • '; } print '
'; diff --git a/htdocs/societe/ajaxcountries.php b/htdocs/societe/ajaxcountries.php index dc9a2587fb7..2dbbe9dbc95 100644 --- a/htdocs/societe/ajaxcountries.php +++ b/htdocs/societe/ajaxcountries.php @@ -23,7 +23,10 @@ * \version $Id$ */ -define('NOTOKENRENEWAL',1); // Disables token renewal +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); require('../main.inc.php');