forked from Wavyzz/dolibarr
Just for test
This commit is contained in:
@@ -480,7 +480,7 @@ if (GETPOST('action') == 'create')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $html->select_societes('','socid','',1,1);
|
print $html->select_societes('','company','',1,1);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@@ -668,7 +668,7 @@ if ($id)
|
|||||||
// Company
|
// Company
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $html->select_societes($act->societe->id,'socid','',1,1);
|
print $html->select_societes($act->societe->id,'company','',1,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Contact
|
// Contact
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ class Form
|
|||||||
* \param showtype Show third party type in combolist (customer, prospect or supplier)
|
* \param showtype Show third party type in combolist (customer, prospect or supplier)
|
||||||
* \param forcecombo Force to use combo box
|
* \param forcecombo Force to use combo box
|
||||||
*/
|
*/
|
||||||
function select_societes($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
|
function select_societes($selected='',$htmlname='company',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ class Form
|
|||||||
{
|
{
|
||||||
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
|
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
|
||||||
}
|
}
|
||||||
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
|
print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="nobordernopadding" align="left" width="16">';
|
print '<td class="nobordernopadding" align="left" width="16">';
|
||||||
print ajax_indicator($htmlname,'working'); // Indicator is here
|
print ajax_indicator($htmlname,'working'); // Indicator is here
|
||||||
|
|||||||
@@ -81,14 +81,25 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
|
|||||||
* \param indicator nom de l'image gif sans l'extension
|
* \param indicator nom de l'image gif sans l'extension
|
||||||
* \return string script complet
|
* \return string script complet
|
||||||
*/
|
*/
|
||||||
function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
|
function ajax_autocompleter($selected='',$htmlname,$value,$url,$indicator='working')
|
||||||
{
|
{
|
||||||
$script='';
|
$script='';
|
||||||
|
|
||||||
$script.= '<input type="hidden" name="'.$htmlname.'_id" id="'.$htmlname.'_id" value="'.$selected.'" />';
|
$script.= '<input type="hidden" name="'.$value.'" id="'.$value.'" value="'.$selected.'" />';
|
||||||
|
|
||||||
$script.= '<div id="result'.$htmlname.'" class="autocomplete"></div>';
|
$script.= '<div id="result'.$htmlname.'" class="autocomplete"></div>';
|
||||||
$script.= '<script type="text/javascript">';
|
$script.= '<script type="text/javascript">';
|
||||||
|
$script.= 'jQuery(document).ready(function() {
|
||||||
|
jQuery("input#'.$htmlname.'").autocomplete({
|
||||||
|
source: "'.$url.'",
|
||||||
|
minLength: 2,
|
||||||
|
select: function( event, ui ) {
|
||||||
|
'.$htmlname.': ui.item.value,
|
||||||
|
'.$value.': ui.item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
/*
|
||||||
$script.= 'new Ajax.Autocompleter(\''.$htmlname.'\',\'result'.$htmlname.'\',\''.$url.'\',{
|
$script.= 'new Ajax.Autocompleter(\''.$htmlname.'\',\'result'.$htmlname.'\',\''.$url.'\',{
|
||||||
method: \'post\',
|
method: \'post\',
|
||||||
paramName: \'socid\',
|
paramName: \'socid\',
|
||||||
@@ -98,7 +109,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
|
|||||||
});'; // paramName must be 'socid', as it is the name of POST parameter to send value in htmlname field.
|
});'; // paramName must be 'socid', as it is the name of POST parameter to send value in htmlname field.
|
||||||
// and it is name of parameter read by ajaxcompanies.php
|
// and it is name of parameter read by ajaxcompanies.php
|
||||||
// Note: The ac_return will fill value inside field htmlname (param of Autocompleter constructor)
|
// Note: The ac_return will fill value inside field htmlname (param of Autocompleter constructor)
|
||||||
// and will also fill value inside field htmlname_id (using function ac_return)
|
// and will also fill value inside field htmlname_id (using function ac_return)*/
|
||||||
$script.= '</script>';
|
$script.= '</script>';
|
||||||
|
|
||||||
return $script;
|
return $script;
|
||||||
|
|||||||
Reference in New Issue
Block a user