diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 3826a1b10d0..84f13d0c495 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -43,12 +43,6 @@ $langs->load("bills"); $langs->load("orders"); $langs->load("agenda"); -// If socid provided by ajax company selector -if (GETPOST('socid_id')) -{ - $_GET['socid'] = GETPOST('socid_id'); - $_POST['socid'] = GETPOST('socid_id'); -} // Security check $socid = GETPOST('socid'); @@ -480,7 +474,7 @@ if (GETPOST('action') == 'create') } else { - print $html->select_societes('','company','',1,1); + print $html->select_societes('','socid','',1,1); } print ''; @@ -668,7 +662,7 @@ if ($id) // Company print ''.$langs->trans("Company").''; print ''; - print $html->select_societes($act->societe->id,'company','',1,1); + print $html->select_societes($act->societe->id,'socid','',1,1); print ''; // Contact diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d788cc556a7..35e8d82447d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -526,7 +526,7 @@ class Form * \param showtype Show third party type in combolist (customer, prospect or supplier) * \param forcecombo Force to use combo box */ - function select_societes($selected='',$htmlname='company',$filter='',$showempty=0, $showtype=0, $forcecombo=0) + function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0) { global $conf,$user,$langs; @@ -558,13 +558,13 @@ class Form print ''; if ($socid == 0) { - print ''; + print ''; } else { - print ''; + print ''; } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); + print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socname',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); print ''; print ''; print ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 97cf9fa4be5..36dffc0e6c4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -529,7 +529,7 @@ class FormCompany } // We call a page after a small delay when a new input has been selected - $javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'".$htmlname."_id\').value;"; + $javaScript = "window.location=\'./contact.php?".$var_id."=".$object->id."&".$htmlname."=\' + document.getElementById(\'".$htmlname."\').value;"; $htmloption = 'onChange="ac_delay(\''.$javaScript.'\',\'500\')"'; print "\n".''."\n"; @@ -539,17 +539,15 @@ class FormCompany { //$langs->load("companies"); //print ''; - print ''; + print ''; } else { - print ''; + print ''; } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php',''); + print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socname',DOL_URL_ROOT.'/societe/ajaxcompanies.php',''); print ''; - print ''; - print ajax_indicator($htmlname,'working'); - print ''; + print ''; print ''; print "\n"; return $socid; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 89d86cb0176..2c95076aaca 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -58,14 +58,6 @@ if ($_GET["id"] > 0 || ! empty($_GET["ref"])) $fichinterid=$fichinter->id; } -// If socid provided by ajax company selector -if (! empty($_REQUEST['socid_id'])) -{ - $_GET['socid'] = $_GET['socid_id']; - $_POST['socid'] = $_POST['socid_id']; - $_REQUEST['socid'] = $_REQUEST['socid_id']; -} - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); diff --git a/htdocs/lib/ajax.lib.php b/htdocs/lib/ajax.lib.php index 0aaa3d3ae0b..bb5201110a3 100644 --- a/htdocs/lib/ajax.lib.php +++ b/htdocs/lib/ajax.lib.php @@ -78,31 +78,29 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working') * \brief Get value of field, do Ajax process and return result * \param htmlname nom et id du champ * \param url chemin du fichier de reponse : /chemin/fichier.php - * \param indicator nom de l'image gif sans l'extension * \return string script complet */ -function ajax_autocompleter($selected='',$htmlname,$value,$url,$indicator='working') +function ajax_autocompleter($selected='',$htmlname,$valname,$url) { $script=''; - $script.= ''; + $script.= ''; //$script.= '
'; $script.= '