load existing batch numbers for item within mrp consumtion

This commit is contained in:
Stephan Steininger 2021-09-27 10:04:59 +02:00
parent 4a85304572
commit c7ff60866a
2 changed files with 15 additions and 4 deletions

View File

@ -945,7 +945,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) {
$preselected = 0;
}
print '<td class="right"><input type="text" class="width50 right" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
$disable = 'disabled';
if ( ($line->qty - $alreadyconsumed) > 0 )
$disable = '';
print '<td class="right"><input type="text" class="width50 right" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'" '.$disable.' ></td>';
if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
print '<td></td>';
}
@ -967,7 +972,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
if ($tmpproduct->status_batch) {
$preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : '');
print '<input type="text" class="width50" name="batch-'.$line->id.'-'.$i.'" value="'.$preselected.'">';
print '<td>'.$formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product,'','','','','','',1).'</td>';
//print '<input type="text" class="width50" name="batch-'.$line->id.'-'.$i.'" value="'.$preselected.'">';
}
print '</td>';
}

View File

@ -536,10 +536,11 @@ class FormProduct
* @param int $forcecombo 1=Force combo iso ajax select2
* @param array $events Events to add to select2
* @param string $morecss Add more css classes to HTML select
* @param int $use_baseval 1=uses batch as value within select
*
* @return string HTML select
*/
public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200')
public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $use_baseval = 0)
{
global $conf, $langs;
@ -590,7 +591,11 @@ class FormProduct
$label .= ' <span class=\'opacitymedium\'>('.$langs->trans("Stock").' '.$arraytypes['qty'].')</span>';
}
$out .= '<option value="'.$id.'"';
if ( $use_baseval = 1 )
$out .= '<option value="'.$arraytypes['batch'].'"';
else
$out .= '<option value="'.$id.'"';
if ($selected == $id || ($selected == 'ifone' && $nboflot == 1)) {
$out .= ' selected';
}