From f4d4733b15fac96d2fe011464fa40ee600900702 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 19 Aug 2021 15:37:32 +0200 Subject: [PATCH] NEW : Select for BOM workable + JS to fill it according to the product selected --- htdocs/bom/bom_card.php | 25 ++++++++++++++++++++ htdocs/bom/script/interface.php | 29 ++++++++++++++++++++++++ htdocs/bom/tpl/objectline_create.tpl.php | 4 ++++ htdocs/bom/tpl/objectline_title.tpl.php | 3 +++ htdocs/bom/tpl/objectline_view.tpl.php | 2 ++ htdocs/langs/en_US/mrp.lang | 1 + htdocs/langs/fr_FR/mrp.lang | 1 + 7 files changed, 65 insertions(+) create mode 100644 htdocs/bom/script/interface.php diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index cd530994b9b..7bcbcc19e46 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -570,6 +570,31 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } + ?> + + '; print "\n"; diff --git a/htdocs/bom/script/interface.php b/htdocs/bom/script/interface.php new file mode 100644 index 00000000000..d5811db0414 --- /dev/null +++ b/htdocs/bom/script/interface.php @@ -0,0 +1,29 @@ +query($sql); + if ($resql && $db->num_rows($resql) > 0) { + $options = array(); + $cpt=0; + while ($obj = $db->fetch_object($resql)){ + + $options[$obj->rowid] = $obj->ref.' - '.$obj->label; + $cpt++; + } + print json_encode($options); + } + + break; +} diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 7cc2873b261..5835849e9ff 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -107,6 +107,10 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { echo ''; } +$coldisplay++; +print ''; +print ''; +print ''; $coldisplay++; print ''; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index d1b29ee03b0..6b7f04b58f0 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -52,6 +52,9 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { // Description print ''.$langs->trans('Description').''; +// Linked BOM +print ''.$langs->trans('BOM').''; + // Qty print ''.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).''; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index fff9d077a08..d3559857a2a 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -83,6 +83,8 @@ $tmpproduct->fetch($line->fk_product); print $tmpproduct->getNomUrl(1); print ' - '.$tmpproduct->label; print ''; + +print ''; print ''; $coldisplay++; echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 2414a92cefb..8aaf345feed 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -101,3 +101,4 @@ HumanMachine=Human / Machine WorkstationArea=Workstation area Machines=Machines THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item +BOM=Nomenclature diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index e0a2e73365e..2db57d53bfb 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -101,3 +101,4 @@ HumanMachine=Humain/machine WorkstationArea=Espace Poste de travail Machines=Machines THMEstimatedHelp=Ce taux permet de définir un coût prévisionnel de l'article +BOM=Nomenclature