diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d5216b72e85..bfd8768aacd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -561,6 +561,8 @@ class Form print "\n".''."\n"; print ''; print ''; //print '
'; + print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); + print '
'; if ($socid == 0) { //$langs->load("companies"); @@ -570,7 +572,8 @@ class Form { print ''; } - print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); + print '
'; + //print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), ''); print '
'; //print ajax_indicator($htmlname,'working'); // Indicator is here diff --git a/htdocs/lib/ajax.lib.php b/htdocs/lib/ajax.lib.php index f938bd24df5..4911b142a85 100644 --- a/htdocs/lib/ajax.lib.php +++ b/htdocs/lib/ajax.lib.php @@ -94,8 +94,8 @@ function ajax_autocompleter($selected='',$htmlname,$value,$url,$indicator='worki source: "'.$url.'", minLength: 2, select: function( event, ui ) { - jQuery("#'.$htmlname.'").val(ui.item.value); - jQuery("#'.$value.'").val(ui.item.id); + jQuery("#'.$htmlname.'").val(ui.item.socname); + jQuery("#'.$value.'").val(ui.item.socid); } }); });'; diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 9c32cc4e16f..14c03d1fc51 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -82,9 +82,9 @@ if (! empty($_POST['newcompany']) || ! empty($_GET['term']) || ! empty($_POST['i $resql=$db->query($sql); if ($resql) { - while ($row = $db->fetch_array($resql)) { - $row_array['id'] = $row['rowid']; - $row_array['value'] = $row['nom']; + while ($row = $db->fetch_array($resql)) { + $row_array['socname'] = $row['nom']; + $row_array['socid'] = $row['rowid']; array_push($return_arr,$row_array); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ba0bf7d3127..2509c3551d0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1465,6 +1465,10 @@ table.cal_event td { border: 0px; padding-: 0px; padding-) right center no-repeat; + } + div.autocomplete { position:absolute; width:250px;