From bf61a9423c41363d6c2d0c02fdd2515f9d74d027 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 03:08:12 +0100 Subject: [PATCH] Debug MRP --- htdocs/mrp/mo_production.php | 61 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index ba4a2ca9c3d..037fe3270b1 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -157,7 +157,7 @@ if (empty($reshook)) $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN'); } - if ($action == 'confirm_consumeandproduceall') { + if (in_array($action, array('confirm_consume', 'confirm_produce', 'confirm_consumeandproduceall'))) { $stockmove = new MouvementStock($db); $labelmovement = GETPOST('inventorylabel', 'alphanohtml'); @@ -579,31 +579,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - if ($action == 'consume') - { - print $langs->trans("FeatureNotYetAvailable"); - } - if ($action == 'produce') - { - print $langs->trans("FeatureNotYetAvailable"); - } - if ($action == 'consumeandproduceall') - { - $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); - //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); + $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); + //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); - print '
'; - print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; - print $langs->trans("MovementLabel").':   '; - print $langs->trans("InventoryCode").':

'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; - print '
'; - } + print '
'; + print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; + print $langs->trans("MovementLabel").':   '; + print $langs->trans("InventoryCode").':

'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + print '
'; } @@ -631,11 +620,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyConsumed").''; print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Warehouse"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Batch"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -689,11 +678,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Show detailed of already consumed with js code to collapse //$arrayoflines = $object->fetchLinesLinked('consumed', $line->id); - if ($action == 'consumeandproduceall') { + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { $i = 1; print ''; print ''.$langs->trans("ToConsume").''; - print ''; + $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); + if ($action == 'produce') $preselected = 0; + print ''; print ''; print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { @@ -756,11 +747,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyProduced").''; print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Warehouse"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Batch"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -802,15 +793,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; - if ($action == 'consumeandproduceall') { + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { print ''; print ''.$langs->trans("ToProduce").''; - print ''; + $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); + if ($action == 'consume') $preselected = 0; + print ''; print ''; print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone')); print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1); + } else { + print ''.$langs->trans("NoStockChangeOnServices").''; } print ''; if ($conf->productbatch->enabled) {