From 9e667e015597258eb2003ed067b0956017281431 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 9 Feb 2022 15:55:21 +0100 Subject: [PATCH 1/5] NEW Needed nets bom --- htdocs/bom/bom_net_needs.php | 354 +++++++++++++++++++++++++++++++++ htdocs/bom/class/bom.class.php | 55 +++++ htdocs/bom/lib/bom.lib.php | 5 + htdocs/langs/en_US/mrp.lang | 3 + 4 files changed, 417 insertions(+) create mode 100644 htdocs/bom/bom_net_needs.php diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php new file mode 100644 index 00000000000..399aa8aa739 --- /dev/null +++ b/htdocs/bom/bom_net_needs.php @@ -0,0 +1,354 @@ + + * Copyright (C) 2019 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/bom/bom_net_needs.php + * \ingroup bom + * \brief Page to create/edit/view bom + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("mrp", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + + + +// Initialize technical objects +$object = new BOM($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all = GETPOST("search_all", 'alpha'); +$search = array(); +foreach ($object->fields as $key => $val) { + if (GETPOST('search_'.$key, 'alpha')) { + $search[$key] = GETPOST('search_'.$key, 'alpha'); + } +} + +if (empty($action) && empty($id) && empty($ref)) { + $action = 'view'; +} + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +if ($object->id > 0) { + $object->calculateCosts(); +} + + + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft); + +$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; + + +/* + * Actions + */ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + $error = 0; + + $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/bom/bom_net_needs.php?id='.($id > 0 ? $id : '__ID__'); + } + } + } + if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + else $object->getNetNeeds($TChildBom, 1); + +} + + +/* + * View + */ + +$form = new Form($db); +$formfile = new FormFile($db); + + +$title = $langs->trans('BOM'); +$help_url ='EN:Module_BOM'; +llxHeader('', $title, $help_url); + + +// Part to edit record +if (($id || $ref) && $action == 'edit') { + print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print dol_get_fiche_head(); + + //$object->fields['keyfield']['disabled'] = 1; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $head = bomPrepareHead($object); + print dol_get_fiche_head($head, 'net_needs', $langs->trans("BillOfMaterials"), -1, 'bom'); + + $formconfirm = ''; + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + $keyforbreak = 'duration'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + print ''; + print ''; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'; + print '
'; + print '
'; + + print '
'; + + print dol_get_fiche_end(); + + + + /* + * Lines + */ + print ''; + print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if(! empty($TChildBom)) { + if($action == 'treeview') { + foreach($TChildBom as $fk_bom => $TProduct) { + $repeatChar = ' '; + if(! empty($TProduct['bom'])) { + if($TProduct['parentid'] != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + if(! empty($TProduct['product'])) { + foreach($TProduct['product'] as $fk_product => $TInfos) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if($fk_bom != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + } + else { + foreach($TChildBom as $fk_product => $qty) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + print ''; + print '
'.$langs->trans('Product'); + if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; + print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; + } + print ''.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); + print ' '; + print img_picto('', 'folder-open'); + print ''; + print ''.$TProduct['qty'].'
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].''.$prod->stock_reel.''.$prod->stock_theorique.'
'.$prod->getNomUrl(1).''.$qty.''.$prod->stock_reel.''.$prod->stock_theorique.'
'; + + + + /* + * ButAction + */ + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + + if(empty($reshook)) { + if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + else print ''.$langs->trans("BackToStandardView").''."\n"; + } + + print '
'; + + + ?> + + + + close(); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5f732c47300..7acc2749fad 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,6 +1085,7 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); + $line->childBom[] = $bom_child; $this->total_cost += $bom_child->total_cost; } else { $this->error = $bom_child->error; @@ -1101,6 +1102,55 @@ class BOM extends CommonObject } } } + + /** + * Get Net needs by product + * + * @param array $TNetNeeds + * @param int $qty + * @return void + */ + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } + else { + $TNetNeeds[$line->fk_product] += $line->qty*$qty; + } + } + } + } + + /** + * Get Net needs Tree by product or bom + * + * @param array $TNetNeeds + * @param int $qty + * @param int $level + * @return void + */ + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) { + $TNetNeeds[$childBom->id]['bom'] = $childBom; + $TNetNeeds[$childBom->id]['parentid'] = $this->id; + $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; + $TNetNeeds[$childBom->id]['level'] = $level; + $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); + } + } + else { + $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; + $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; + } + } + } + } + } @@ -1227,6 +1277,11 @@ class BOMLine extends CommonObjectLine public $unit_cost = 0; + /** + * @var Bom array of Bom in line + */ + public $childBom = array(); + /** * Constructor * diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 805ba304c1d..954959d5d7a 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -84,6 +84,11 @@ function bomPrepareHead($object) $head[$h][2] = 'card'; $h++; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_net_needs.php?id=".$object->id; + $head[$h][1] = $langs->trans("BOMNetNeeds"); + $head[$h][2] = 'net_needs'; + $h++; + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; if (!empty($object->note_private)) { diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 74bed0d9186..ca902380935 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -107,3 +107,6 @@ THMEstimatedHelp=This rate makes it possible to define a forecast cost of the it BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines +BOMNetNeeds=Net Needs +DisplayInTreeStructure=Display in tree structure +BackToStandardView=Back to standard view \ No newline at end of file From 2260276bed0c7d02a480efa7b395daf580dd9287 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:09:36 +0100 Subject: [PATCH 2/5] add tooltip --- htdocs/bom/bom_net_needs.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 399aa8aa739..dcd6764d74a 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -220,6 +220,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* * Lines */ + $text_stock_options = $langs->trans("RealStockDesc").'
'; + $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'
'; + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); + print ''; print "\n"; print ''; @@ -230,8 +240,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if(! empty($TChildBom)) { if($action == 'treeview') { From 7cf94486098fbdcedada47441e85f6eff4d20d5a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Feb 2022 09:22:53 +0000 Subject: [PATCH 3/5] Fixing style errors. --- htdocs/bom/bom_net_needs.php | 43 ++++++++++++++++------------------ htdocs/bom/class/bom.class.php | 29 +++++++++++------------ 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index dcd6764d74a..e9f408498f0 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -110,9 +110,8 @@ if (empty($reshook)) { } } } - if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); else $object->getNetNeeds($TChildBom, 1); - } @@ -234,7 +233,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print "\n"; print ''; print ''; print ''; print ''; - if(! empty($TChildBom)) { - if($action == 'treeview') { - foreach($TChildBom as $fk_bom => $TProduct) { + if (! empty($TChildBom)) { + if ($action == 'treeview') { + foreach ($TChildBom as $fk_bom => $TProduct) { $repeatChar = ' '; - if(! empty($TProduct['bom'])) { - if($TProduct['parentid'] != $object->id) print ''; + if (! empty($TProduct['bom'])) { + if ($TProduct['parentid'] != $object->id) print ''; else print ''; print ''; print ''; } - if(! empty($TProduct['product'])) { - foreach($TProduct['product'] as $fk_product => $TInfos) { + if (! empty($TProduct['product'])) { + foreach ($TProduct['product'] as $fk_product => $TInfos) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; - if($fk_bom != $object->id) print ''; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; + if ($fk_bom != $object->id) print ''; else print ''; print ''; print ''; @@ -276,13 +275,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } } - } - else { - foreach($TChildBom as $fk_product => $qty) { + } else { + foreach ($TChildBom as $fk_product => $qty) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; print ''; print ''; print ''; @@ -297,18 +295,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea - /* - * ButAction - */ + /* + * ButAction + */ print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if($reshook < 0) { + if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if(empty($reshook)) { - if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + if (empty($reshook)) { + if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; else print ''.$langs->trans("BackToStandardView").''."\n"; } @@ -356,7 +354,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); - } - else { + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } else { $TNetNeeds[$line->fk_product] += $line->qty*$qty; } } @@ -1131,26 +1131,25 @@ class BOM extends CommonObject * @param int $level * @return void */ - public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { - if(! empty($this->lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) { + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) { $TNetNeeds[$childBom->id]['bom'] = $childBom; $TNetNeeds[$childBom->id]['parentid'] = $this->id; $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; $TNetNeeds[$childBom->id]['level'] = $level; $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); } - } - else { + } else { $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; } } } } - } From dd0202de47a702d9ad100c66c2250c8d7b78d9e4 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:46:04 +0100 Subject: [PATCH 4/5] fix comment doc --- htdocs/bom/class/bom.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 75cf0e3a65e..17d17edad8d 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1106,8 +1106,8 @@ class BOM extends CommonObject /** * Get Net needs by product * - * @param array $TNetNeeds - * @param int $qty + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed * @return void */ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) @@ -1126,9 +1126,9 @@ class BOM extends CommonObject /** * Get Net needs Tree by product or bom * - * @param array $TNetNeeds - * @param int $qty - * @param int $level + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed + * @param int $level level of recursivity * @return void */ public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) From cd955930b6ead7a8bcd2e99623d6917bdd06401c Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 15:00:55 +0100 Subject: [PATCH 5/5] change bt link --- htdocs/bom/bom_net_needs.php | 39 +++--------------------------------- htdocs/langs/en_US/mrp.lang | 4 ++-- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index e9f408498f0..4b2d5cdecab 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -128,36 +128,6 @@ $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); -// Part to edit record -if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print dol_get_fiche_head(); - - //$object->fields['keyfield']['disabled'] = 1; - - print '
'.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.$langs->trans('Product'); - if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + if (! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } @@ -243,12 +242,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); print ' '; @@ -260,13 +259,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].'
'.$prod->getNomUrl(1).''.$qty.'
'."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - - print ''; -} // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { @@ -214,7 +184,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); + $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); + $viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); + print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes'); /* * Lines @@ -304,12 +277,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - - if (empty($reshook)) { - if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; - else print ''.$langs->trans("BackToStandardView").''."\n"; - } - print ''; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index ca902380935..4dc74122ea9 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -108,5 +108,5 @@ BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines BOMNetNeeds=Net Needs -DisplayInTreeStructure=Display in tree structure -BackToStandardView=Back to standard view \ No newline at end of file +TreeStructure=Tree structure +GroupByProduct=Group by product \ No newline at end of file