Qual: used jquery by default
This commit is contained in:
parent
7444fd95e2
commit
c222f45bef
@ -859,32 +859,10 @@ class Form
|
|||||||
|
|
||||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||||
{
|
{
|
||||||
if ($conf->global->MAIN_USE_NEW_JQUERY)
|
// mode=1 means customers products
|
||||||
{
|
print ajax_autocompleter('',$htmlname,DOL_URL_ROOT.'/product/ajaxproducts.php','outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,'');
|
||||||
// mode=1 means customers products
|
print $langs->trans("RefOrLabel").' : <input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
|
||||||
print ajax_autocompleter('',$htmlname,DOL_URL_ROOT.'/product/ajaxproducts.php','outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished,'');
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="ui-widget">';
|
|
||||||
print '<label for="search_'.$htmlname.'">'.$langs->trans("RefOrLabel").':</label>';
|
|
||||||
print '<input id="search_'.$htmlname.'" />';
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr class="nocellnopadd">';
|
|
||||||
print '<td class="nobordernopadding" nowrap="nowrap" width="80">';
|
|
||||||
print $langs->trans("RefOrLabel").':</td>';
|
|
||||||
print '<td class="nobordernopadding" width="16">';
|
|
||||||
print ajax_indicator($htmlname,'working'); // Indicator is here
|
|
||||||
print '</td>';
|
|
||||||
print '<td><input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '<tr class="nocellnopadd">';
|
|
||||||
print '<td class="nobordernopadding" colspan="3">';
|
|
||||||
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 '</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1144,21 +1122,10 @@ class Form
|
|||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||||
{
|
{
|
||||||
if ($conf->global->MAIN_USE_NEW_JQUERY)
|
// mode=2 means suppliers products
|
||||||
{
|
print ajax_autocompleter('',$htmlname,DOL_URL_ROOT.'/product/ajaxproducts.php','outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished,'');
|
||||||
// mode=2 means suppliers products
|
print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
|
||||||
print ajax_autocompleter('',$htmlname,DOL_URL_ROOT.'/product/ajaxproducts.php','outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished,'');
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="ui-widget">';
|
|
||||||
print '<label for="search_'.$htmlname.'">'.$langs->trans("RefOrLabel").':</label>';
|
|
||||||
print '<input id="search_'.$htmlname.'" />';
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'">';
|
|
||||||
print ajax_updater($htmlname,'keysearch',DOL_URL_ROOT.'/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtertype.'&mode=2','working');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -119,37 +119,6 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='')
|
|||||||
return $script;
|
return $script;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Get value of field, do Ajax process and return result. Use jQuery.
|
|
||||||
* \param selected Preselected value
|
|
||||||
* \param htmlname Name of html field
|
|
||||||
* \param url Path of source file to get values: /path/ajaxpage.php
|
|
||||||
* \param option Not used
|
|
||||||
* \return string script complet
|
|
||||||
*/
|
|
||||||
function ajax_autocompleter2($selected='', $htmlname, $url, $option='')
|
|
||||||
{
|
|
||||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
|
||||||
|
|
||||||
$script.= '<script type="text/javascript">';
|
|
||||||
$script.= 'jQuery(function() {
|
|
||||||
jQuery("input#'.$htmlname.'free").autocomplete({
|
|
||||||
source: "'.$url.($option?'?'.$option:'').'",
|
|
||||||
delay: 300,
|
|
||||||
minLength: 1,
|
|
||||||
select: function(event, ui) {
|
|
||||||
/* jQuery("#'.$htmlname.'free") is automatically affected with ui.item.key */
|
|
||||||
/* jQuery("#'.$htmlname.'free").val(ui.item.fulltext); */
|
|
||||||
jQuery("#'.$htmlname.'").val(ui.item.key);
|
|
||||||
/* alert(ui.item.key); */
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});';
|
|
||||||
$script.= '</script>';
|
|
||||||
|
|
||||||
return $script;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an ajax dialog
|
* Show an ajax dialog
|
||||||
* @param title Title of dialog box
|
* @param title Title of dialog box
|
||||||
|
|||||||
@ -56,10 +56,10 @@ top_httphead();
|
|||||||
|
|
||||||
dol_syslog(join(',',$_POST));
|
dol_syslog(join(',',$_POST));
|
||||||
|
|
||||||
if (! isset($_GET['keysearch']) && ! isset($_GET['idprod']) && ! isset($_GET['idprodfournprice'])) return;
|
if (! isset($_GET['idprod']) && ! isset($_GET['idprodfournprice'])) return;
|
||||||
|
|
||||||
// When used from jQuery, the search term is added as GET param "term".
|
// When used from jQuery, the search term is added as GET param "term".
|
||||||
$searchkey=isset($_GET['keysearch'])?$_GET['keysearch']:($_GET['idprod']?$_GET['idprod']:$_GET['idprodfournprice']);
|
$searchkey=$_GET['idprod']?$_GET['idprod']:$_GET['idprodfournprice'];
|
||||||
$outjson=isset($_GET['outjson'])?$_GET['outjson']:0;
|
$outjson=isset($_GET['outjson'])?$_GET['outjson']:0;
|
||||||
|
|
||||||
// Get list of product.
|
// Get list of product.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user