diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e4dc71fcb9a..da63720a69c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1615,9 +1615,11 @@ class Form * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter * @param int $socid Thirdparty Id (to get also price dedicated to this customer) + * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. + * @param int $forcecombo Force to use combo box * @return void */ - function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0) + function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0) { global $langs,$conf; @@ -1650,14 +1652,14 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; + print 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } } else { - print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid); + print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo); } } @@ -1674,9 +1676,11 @@ class Form * @param int $finished Filter on finished field: 2=No filter * @param int $outputmode 0=HTML select string, 1=Array * @param int $socid Thirdparty Id (to get also price dedicated to this customer) + * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. + * @param int $forcecombo Force to use combo box * @return array Array of keys for json */ - function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0) + function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0) { global $langs,$conf,$user,$db; @@ -1767,8 +1771,27 @@ class Form require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $num = $this->db->num_rows($result); - $out.=''; + + $textifempty=''; + // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) + { + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + else $textifempty.=$langs->trans("All"); + } + if ($showempty) $out.=''; $i = 0; while ($num && $i < $num) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ca53bc971a9..ad8f09205b7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -58,8 +58,8 @@ ErrorCodeCantContainZero=Code can't contain value 0 DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers) UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant COMPANY_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectContactTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. -DelaiedFullListToSelectCompany=Wait you press a key before loading content of thirdparties combo list (This may increase performance if you have a large number of thirdparties) -DelaiedFullListToSelectContact=Wait you press a key before loading content of contact combo list (This may increase performance if you have a large number of contact) +DelaiedFullListToSelectCompany=Wait you press a key before loading content of thirdparties combo list (This may increase performance if you have a large number of thirdparties, but it is less convenient) +DelaiedFullListToSelectContact=Wait you press a key before loading content of contact combo list (This may increase performance if you have a large number of contact, but it is less convenient) NumberOfKeyToSearch=Nbr of characters to trigger search: %s NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party @@ -1320,7 +1320,7 @@ ViewProductDescInFormAbility=Visualization of product descriptions in the forms MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal ViewProductDescInThirdpartyLanguageAbility=Visualization of products descriptions in the third party language UseSearchToSelectProductTooltip=Also if you have a large number of product (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. -UseSearchToSelectProduct=Use a search form to choose a product (rather than a drop-down list). +UseSearchToSelectProduct=Wait you press a key before loading content of product combo list (This may increase performance if you have a large number of products, but it is less convenient) SetDefaultBarcodeTypeProducts=Default barcode type to use for products SetDefaultBarcodeTypeThirdParties=Default barcode type to use for third parties UseUnits=Define a unit of measure for Quantity during order, proposal or invoice lines edition diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 14a5219d31c..2675e3c95b0 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -94,7 +94,7 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto); print ''; print ''; -print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 54b83aca42c..34463db14e2 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -90,7 +90,7 @@ if ($socid > 0) { if ($soc->client) { print ''; - print ''; @@ -102,7 +102,7 @@ if ($socid > 0) { } else { print ''; - print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 7a2ac98a5f8..24150a1050c 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -105,20 +105,17 @@ print '
'.$langs->trans('SalesRepresentative').''; +print ''; print $form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '
'.$langs->trans('ThirdPartyName').''; + print ''; print $form->select_company($socid, 'socid', 'client=1 OR client=3', 1, 0, 0); //$form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1 OR client=3',1,0,1); print '
'.$langs->trans('ThirdPartyName').''; + print ''; print $form->select_company(null, 'socid', 'client=1 OR client=3', 1, 0, 0); //$form->form_thirdparty($_SERVER['PHP_SELF'],null,'socid','client=1 OR client=3',1,0,1); print '
'; if ($id > 0) { print ''; - print ''; - print ''; - print ''; - if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef"; } else { print ''; - print ''; } @@ -339,10 +336,6 @@ print '
'.$langs->trans('ChooseProduct/Service').''; - print $form->select_produits($id,'id','',20,0,1,2,'',1); + print ''; + print $form->select_produits($id,'id','',20,0,1,2,'',1, array(), 0, 'All'); print '
'.$langs->trans('AllProducts').'
'.$langs->trans('ChooseProduct/Service').''; - print $form->select_produits('','id','',20,0,1,2,'',1); + print ''; + print $form->select_produits('','id','',20,0,1,2,'',1, array(), 0, 'All'); print '