Fixing style errors.

This commit is contained in:
stickler-ci 2022-02-10 09:22:53 +00:00
parent 2260276bed
commit 7cf9448609
2 changed files with 34 additions and 38 deletions

View File

@ -112,7 +112,6 @@ if (empty($reshook)) {
} }
if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1);
else $object->getNetNeeds($TChildBom, 1); else $object->getNetNeeds($TChildBom, 1);
} }
@ -276,8 +275,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
} }
} }
} } else {
else {
foreach ($TChildBom as $fk_product => $qty) { foreach ($TChildBom as $fk_product => $qty) {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($fk_product); $prod->fetch($fk_product);
@ -356,7 +354,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
</script> </script>
<?php <?php
} }
// End of page // End of page

View File

@ -1110,13 +1110,13 @@ class BOM extends CommonObject
* @param int $qty * @param int $qty
* @return void * @return void
*/ */
public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) { public function getNetNeeds(&$TNetNeeds = array(), $qty = 0)
{
if (! empty($this->lines)) { if (! empty($this->lines)) {
foreach ($this->lines as $line) { foreach ($this->lines as $line) {
if (! empty($line->childBom)) { if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} } else {
else {
$TNetNeeds[$line->fk_product] += $line->qty*$qty; $TNetNeeds[$line->fk_product] += $line->qty*$qty;
} }
} }
@ -1131,7 +1131,8 @@ class BOM extends CommonObject
* @param int $level * @param int $level
* @return void * @return void
*/ */
public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0)
{
if (! empty($this->lines)) { if (! empty($this->lines)) {
foreach ($this->lines as $line) { foreach ($this->lines as $line) {
if (! empty($line->childBom)) { if (! empty($line->childBom)) {
@ -1142,15 +1143,13 @@ class BOM extends CommonObject
$TNetNeeds[$childBom->id]['level'] = $level; $TNetNeeds[$childBom->id]['level'] = $level;
$childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); $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]['qty'] += $line->qty * $qty;
$TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level;
} }
} }
} }
} }
} }