* Revert "NEW: Show bom net needs treeview by line position. (#37459)"
This reverts commit b02f1a4ebf.
* Update changelog and fix stan
* fix stan
This commit is contained in:
parent
7612b0f74d
commit
0a3ba8e740
2 changed files with 24 additions and 55 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -257,57 +257,33 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
print '</thead>';
|
||||
print '<tbody>';
|
||||
$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] = '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">';
|
||||
print '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">';
|
||||
} else {
|
||||
$tablerows[$position] = '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
}
|
||||
$tablerows[$position] .= '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1);
|
||||
$tablerows[$position] .= ' <a class="collapse_bom" id="collapse-'.$fk_bom.'" href="#">';
|
||||
$tablerows[$position] .= img_picto('', 'folder-open');
|
||||
$tablerows[$position] .= '</a>';
|
||||
$tablerows[$position] .= '</td>';
|
||||
$tablerows[$position] .= '<td class="left">'.$TProduct['bom']->getNomUrl(1).'</td>';
|
||||
$tablerows[$position] .= '<td class="linecolqty right">'.price(price2num($TProduct['qty'], 'MS')).'</td>';
|
||||
$tablerows[$position] .= '<td>';
|
||||
$tablerows[$position] .= '</td>';
|
||||
$tablerows[$position] .= '<td class="linecolstock right"></td>';
|
||||
$tablerows[$position] .= '<td class="linecoltheoricalstock right"></td>';
|
||||
$tablerows[$position] .= '</tr>';
|
||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1);
|
||||
print ' <a class="collapse_bom" id="collapse-'.$fk_bom.'" href="#">';
|
||||
print img_picto('', 'folder-open');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td class="left">'.$TProduct['bom']->getNomUrl(1).'</td>';
|
||||
print '<td class="linecolqty right">'.price(price2num($TProduct['qty'], 'MS')).'</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '<td class="linecolstock right"></td>';
|
||||
print '<td class="linecoltheoricalstock right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
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] = '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">'; // sub bom on same position
|
||||
print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
||||
} else {
|
||||
$tablerows[$position] = '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
}
|
||||
$tablerows[$position] .= '<td class="linecoldescription">'.str_repeat($repeatChar, (int) $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||
$tablerows[$position] .= '<td></td>';
|
||||
$tablerows[$position] .= '<td class="linecolqty right">'.price(price2num((float) $TInfos['qty'], 'MS')).'</td>';
|
||||
$tablerows[$position] .= '<td>';
|
||||
$tablerows[$position] .= '</td>';
|
||||
$tablerows[$position] .= '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||
$tablerows[$position] .= '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||
$tablerows[$position] .= '</tr>';
|
||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="linecolqty right">'.price(price2num($TInfos['qty'], 'MS')).'</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue