diff --git a/ChangeLog b/ChangeLog
index 33c35923532..06ff0255eac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -159,7 +159,6 @@ NEW: Add mass action to cancel invoices using credit notes (#37852)
NEW: Add personal_data flag in extrafields admin UI - next step of #8612 (#38133)
NEW: Direct installation for community and free modules on DoliStore (#38357)
NEW: Display thirdparty name with ref in supplier orders linked objects (#36952)
-NEW: Show bom net needs treeview by line position. (#37459)
NEW: Show name_alias in parentheses in thirdparty dropdown lists (#37997)
NEW: Thirdparty card +tab with events where thirdparty is attendee/booth (#37743)
NEW: Update ticket read date when status changes (#37470)
diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php
index e06e249d624..346cd67f1aa 100644
--- a/htdocs/bom/bom_net_needs.php
+++ b/htdocs/bom/bom_net_needs.php
@@ -257,57 +257,33 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
print '
';
- $tablerows = array();
- $position = '';
- $levelposition = '';
- $lineposition = 0;
if (count($TChildBom) > 0) {
if ($action == 'treeview') {
foreach ($TChildBom as $fk_bom => $TProduct) {
$repeatChar = ' ';
if (!empty($TProduct['bom'])) {
- // we make position string in format 'lineposition.bomlevel.childposition'
- if (!empty($TProduct['position']) && $TProduct['parentid'] == $object->id) {
- // define lineposition
- $lineposition = $TProduct['position'];
- }
- // define lineposition.bomlevel
- $position = sprintf('%d.%d', $lineposition, $TProduct['level']);
- // memorize level position for products in bom
- $levelposition = $position;
- if (!empty($TProduct['parentid']) && $TProduct['parentid'] != $object->id && empty($TProduct['product'])) {
- // define lineposition.bomlevel.childposition
- $position = sprintf('%s.%d', $position, $TProduct['position']);
- }
$prod = new Product($db);
$prod->fetch($TProduct['bom']->fk_product);
if ($TProduct['parentid'] != $object->id) {
- $tablerows[$position] = '';
+ print '
';
} else {
- $tablerows[$position] = '
';
+ print '
';
}
- $tablerows[$position] .= '| '.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1);
- $tablerows[$position] .= ' ';
- $tablerows[$position] .= img_picto('', 'folder-open');
- $tablerows[$position] .= '';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= ''.$TProduct['bom']->getNomUrl(1).' | ';
- $tablerows[$position] .= ''.price(price2num($TProduct['qty'], 'MS')).' | ';
- $tablerows[$position] .= '';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= '
';
+ print ''.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1);
+ print ' ';
+ print img_picto('', 'folder-open');
+ print '';
+ print ' | ';
+ print ''.$TProduct['bom']->getNomUrl(1).' | ';
+ print ''.price(price2num($TProduct['qty'], 'MS')).' | ';
+ print '';
+ print ' | ';
+ print ' | ';
+ print ' | ';
+ print '';
}
if (!empty($TProduct['product'])) {
foreach ($TProduct['product'] as $fk_product => $TInfos) {
- if (!empty($TInfos['position']) && $fk_bom == $object->id) {
- // top level position
- $position = $TInfos['position'];
- } else {
- // sublevel position
- $position = sprintf('%s.%d', $levelposition, $TInfos['position']);
- }
$prod = new Product($db);
$prod->fetch($fk_product);
$prod->load_virtual_stock();
@@ -315,27 +291,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$prod->stock_reel = 0;
}
if ($fk_bom != $object->id) {
- $tablerows[$position] = ''; // sub bom on same position
+ print '
';
} else {
- $tablerows[$position] = '
';
+ print '
';
}
- $tablerows[$position] .= '| '.str_repeat($repeatChar, (int) $TInfos['level']).$prod->getNomUrl(1).' | ';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= ''.price(price2num((float) $TInfos['qty'], 'MS')).' | ';
- $tablerows[$position] .= '';
- $tablerows[$position] .= ' | ';
- $tablerows[$position] .= ''.price2num($prod->stock_reel, 'MS').' | ';
- $tablerows[$position] .= ''.$prod->stock_theorique.' | ';
- $tablerows[$position] .= '
';
+ print ''.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).' | ';
+ print ' | ';
+ print ''.price(price2num($TInfos['qty'], 'MS')).' | ';
+ print '';
+ print ' | ';
+ print ''.price2num($prod->stock_reel, 'MS').' | ';
+ print ''.$prod->stock_theorique.' | ';
+ print '';
}
}
}
- // Sort the rows numeric by position string
- ksort($tablerows, SORT_NUMERIC);
- // Print the rows
- foreach ($tablerows as $position => $row) {
- print $row;
- }
} else {
foreach ($TChildBom as $fk_product => $elem) {
$prod = new Product($db);