From 8137fd7fe427bf42ab461842e826efc678432996 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jul 2014 02:36:03 +0200 Subject: [PATCH] Fix: Type of line (product/service) could not be edited on supplier order/invoice. --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/fourn/commande/fiche.php | 12 +++++++----- htdocs/fourn/facture/fiche.php | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f5d14b7529..09730a93545 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -544,7 +544,7 @@ class Form * @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 @@ class Form 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 @@ else 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 '
'; }