From c7ff60866a871af82322722b8d163a94be0f218d Mon Sep 17 00:00:00 2001 From: Stephan Steininger Date: Mon, 27 Sep 2021 10:04:59 +0200 Subject: [PATCH 1/7] load existing batch numbers for item within mrp consumtion --- htdocs/mrp/mo_production.php | 10 ++++++++-- htdocs/product/class/html.formproduct.class.php | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 84dab109b91..9bde31e2a53 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -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 ''; + + $disable = 'disabled'; + if ( ($line->qty - $alreadyconsumed) > 0 ) + $disable = ''; + + print ''; if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } @@ -967,7 +972,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); - print ''; + print ''.$formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product,'','','','','','',1).''; + //print ''; } print ''; } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 64517c25443..75e731873d1 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -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 .= ' ('.$langs->trans("Stock").' '.$arraytypes['qty'].')'; } - $out .= '