From 7cf94486098fbdcedada47441e85f6eff4d20d5a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Feb 2022 09:22:53 +0000 Subject: [PATCH] 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 ''.$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).''; print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; 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 ''.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 ''; 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 ''.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''; print ''.$TInfos['qty'].''; @@ -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 ''.$prod->getNomUrl(1).''; print ''.$qty.''; @@ -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; } } } } - }