diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f5d14b75296e..09730a9354573 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -544,7 +544,7 @@ function select_country($selected='',$htmlname='country_id',$htmloption='',$maxl * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param int $hidetext Do not show label before combo box - * @param string $forceall Force to show products and services in combo list, whatever are activated modules + * @param string $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service') * @return void */ function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0) @@ -552,8 +552,8 @@ function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidete global $db,$langs,$user,$conf; // If product & services are enabled or both disabled. - if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) - || (empty($conf->product->enabled) && empty($conf->service->enabled))) + if ($forceall > 0 || (empty($forceall) && ! empty($conf->product->enabled) && ! empty($conf->service->enabled)) + || (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled)) ) { if (empty($hidetext)) print $langs->trans("Type").': '; print ''; - if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product) + if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product > 0) { print ''; $product_static=new ProductFournisseur($db); @@ -1964,9 +1964,9 @@ print '
'; } else - { + { $forceall=1; // For suppliers, we always show all types - print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1); + print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1,0,$forceall); if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) || (empty($conf->product->enabled) && empty($conf->service->enabled))) print '
'; }