From 2eb2feff045b20bb88bb244a97f1827358d0ea0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 14:16:05 +0100 Subject: [PATCH 1/6] More complete repair --- htdocs/install/mysql/migration/repair.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 47d3127274f..832335bdbae 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -201,6 +201,13 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); +-- Fix: delete orphelin links in llx_bank_url +DELETE from llx_bank_url where type = 'payment' and url_id not in (select rowid from llx_paiement); +DELETE from llx_bank_url where type = 'payment_supplier' and url_id not in (select rowid from llx_paiementfourn); +DELETE from llx_bank_url where type = 'company' and url_id not in (select rowid from llx_societe); +--SELECT * from llx_bank where rappro = 0 and label LIKE '(CustomerInvoicePayment%)' and rowid not in (select fk_bank from llx_bank_url where type = 'payment'); +--SELECT * from llx_bank where rappro = 0 and label LIKE '(SupplierInvoicePayment%)' and rowid not in (select fk_bank from llx_bank_url where type = 'payment_supplier'); + -- Fix link on parent that were removed DROP table tmp_user; CREATE TABLE tmp_user as (select * from llx_user); From 0802df78b59cb30a2a55aec0c992c0a279b19921 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 17:56:02 +0100 Subject: [PATCH 2/6] Debug MRP --- htdocs/bom/bom_card.php | 20 +++++--- htdocs/core/actions_addupdatedelete.inc.php | 7 ++- htdocs/langs/en_US/mrp.lang | 1 + htdocs/langs/en_US/stocks.lang | 1 + htdocs/mrp/mo_card.php | 11 ++++- htdocs/mrp/mo_production.php | 48 +++++++------------ .../stock/class/mouvementstock.class.php | 10 ++-- 7 files changed, 55 insertions(+), 43 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index a980df3e6fc..1caa0c347b4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -97,11 +97,13 @@ if (empty($reshook)) $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; if (empty($backtopage) || ($cancel && empty($id))) { - //var_dump($backurlforlist);exit; - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; - else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__'); + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } } - $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record + + $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -169,7 +171,9 @@ if (empty($reshook)) } else { - unset($_POST['qty_frozen']); + unset($_POST['idprod']); + unset($_POST['qty']); + unset($_POST['qty_frozen']); unset($_POST['disable_stock_change']); } } @@ -207,7 +211,9 @@ if (empty($reshook)) } else { - unset($_POST['qty_frozen']); + unset($_POST['idprod']); + unset($_POST['qty']); + unset($_POST['qty_frozen']); unset($_POST['disable_stock_change']); } } @@ -644,7 +650,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { - print ''.$langs->trans("CreateMO").''; + print ''.$langs->trans("CreateMO").''; } } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b30cc1a411d..59606ee65b5 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -36,7 +36,12 @@ if ($cancel) { /*var_dump($cancel); var_dump($backtopage);exit;*/ - if (!empty($backtopage)) + if (!empty($backtopageforcancel)) + { + header("Location: ".$backtopageforcancel); + exit; + } + elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 6bec44d66e6..faec35f6d46 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -54,6 +54,7 @@ ToConsume=To consume ToProduce=To produce QtyAlreadyConsumed=Qty already consumed QtyAlreadyProduced=Qty already produced +ConsumeOrProduce=Consume or Produce ConsumeAndProduceAll=Consume and Produce All Manufactured=Manufactured TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ecee37908ce..bcdaabb7f6e 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -143,6 +143,7 @@ InventoryCode=Movement or inventory code IsInPackage=Contained into package WarehouseAllowNegativeTransfer=Stock can be negative qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks. +qtyToTranferLotIsNotEnough=You don't have enough stock, for this lot number, from your source warehouse and your setup does not allow negative stocks (Qty for product '%s' with lot '%s' is %s in warehouse '%s'). ShowWarehouse=Show warehouse MovementCorrectStock=Stock correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 68938f97a58..1993f6e46aa 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -62,6 +62,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); //$lineid = GETPOST('lineid', 'int'); // Initialize technical objects @@ -135,6 +136,10 @@ if (empty($reshook)) else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } } + if ($cancel && ! empty($backtopageforcancel)) { + $backtopage = $backtopageforcancel; + } + $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen @@ -202,7 +207,8 @@ if ($action == 'create') print '
'; print ''; print ''; - print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; dol_fiche_head(array(), ''); @@ -304,8 +310,9 @@ if (($id || $ref) && $action == 'edit') print ''; print ''; print ''; - print ''; print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; dol_fiche_head(); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 037fe3270b1..6a2b0e88dc4 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 (in_array($action, array('confirm_consume', 'confirm_produce', 'confirm_consumeandproduceall'))) { + if (in_array($action, array('confirm_consumeorproduce', 'confirm_consumeandproduceall'))) { $stockmove = new MouvementStock($db); $labelmovement = GETPOST('inventorylabel', 'alphanohtml'); @@ -256,13 +256,13 @@ if (empty($reshook)) $error++; } } - + var_dump(GETPOST('batchtoproduce-'.$line->id.'-'.$i)); $idstockmove = 0; if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { // Record stock movement $id_product_batch = 0; $stockmove->origin = $object; - $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), dol_now(), $id_product_batch, $codemovement); if ($idstockmove < 0) { $error++; setEventMessages($stockmove->error, $stockmove->errors, 'errors'); @@ -516,7 +516,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea dol_fiche_end(); - if (! in_array($action, array('consume', 'produce', 'consumeandproduceall'))) + if (! in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print '
'; @@ -524,27 +524,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); if (empty($reshook)) { - // Consume - + // Consume or produce if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) { if ($permissiontoproduce) { - print ''.$langs->trans('Consume').''; + print ''.$langs->trans('ConsumeOrProduce').''; } else { - print ''.$langs->trans('Consume').''; + print ''.$langs->trans('ConsumeOrProduce').''; } } elseif ($object->status == Mo::STATUS_DRAFT) { - print ''.$langs->trans('Consume').''; - } - - // Produce - if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) { - if ($permissiontoproduce) { - print ''.$langs->trans('Produce').''; - } else { - print ''.$langs->trans('Produce').''; - } - } elseif ($object->status == Mo::STATUS_DRAFT) { - print ''.$langs->trans('Produce').''; + print ''.$langs->trans('ConsumeOrProduce').''; } // ConsumeAndProduceAll @@ -571,7 +559,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; } - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print ''; print ''; @@ -620,11 +608,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyConsumed").''; print ''; - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -678,12 +666,12 @@ 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 (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $i = 1; print ''; print ''.$langs->trans("ToConsume").''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); - if ($action == 'produce') $preselected = 0; + if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0; print ''; print ''; print ''; @@ -747,11 +735,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyProduced").''; print ''; - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -793,11 +781,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print ''; print ''.$langs->trans("ToProduce").''; $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); - if ($action == 'consume') $preselected = 0; + if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0; print ''; print ''; print ''; @@ -829,7 +817,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } - if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print "
\n"; } diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 55e7af367b7..790db5d7c5e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -317,14 +317,18 @@ class MouvementStock extends CommonObject { if ($batch != $batchcursor) continue; $foundforbatch=1; - if ($prodbatch->qty < abs($qty)) $qtyisnotenough=1; + if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; break; } if (! $foundforbatch || $qtyisnotenough) { $langs->load("stocks"); - $this->error = $langs->trans('qtyToTranferLotIsNotEnough').' : '.$product->ref; - $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough').' : '.$product->ref; + include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + $tmpwarehouse = new Entrepot($this->db); + $tmpwarehouse->fetch($entrepot_id); + + $this->error = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); + $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); $this->db->rollback(); return -8; } From d0739af8b422e62a8154382b2e0e4b9fe24b9500 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 19:04:00 +0100 Subject: [PATCH 3/6] Debug MRP --- .../install/mysql/migration/10.0.0-11.0.0.sql | 1 + htdocs/install/mysql/migration/repair.sql | 5 +- htdocs/mrp/class/mo.class.php | 1 + htdocs/mrp/lib/mrp_mo.lib.php | 6 + htdocs/mrp/mo_production.php | 150 ++++++++++++------ htdocs/theme/eldy/global.inc.php | 3 + htdocs/theme/md/style.css.php | 3 + 7 files changed, 119 insertions(+), 50 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 24c62c040e4..18972bc6b8f 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -554,6 +554,7 @@ ALTER TABLE llx_mrp_production MODIFY COLUMN qty real NOT NULL DEFAULT 1; ALTER TABLE llx_mrp_production ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_mrp_production ADD COLUMN disable_stock_change smallint DEFAULT 0; + ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_mo FOREIGN KEY (fk_mo) REFERENCES llx_mrp_mo (rowid); ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 832335bdbae..4660eaf9246 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -469,7 +469,10 @@ update llx_facturedet set product_type = 1 where product_type = 0 AND fk_product update llx_facture_fourn_det set product_type = 0 where product_type = 1 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 0); update llx_facture_fourn_det set product_type = 1 where product_type = 0 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 1); - + +DELETE FROM llx_mrp_production where qty = 0; + + UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS NULL; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index be784dbf5ad..df7ad6ea94f 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -496,6 +496,7 @@ class Mo extends CommonObject if ($obj) { $resarray[] = array( 'rowid'=> $obj->rowid, + 'date'=> $this->db->jdate($obj->date_creation), 'qty' => $obj->qty, 'role' => $obj->role, 'fk_product' => $obj->fk_product, diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index 2e47c7bf621..c3f8e7825d4 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -43,6 +43,12 @@ function moPrepareHead($object) $head[$h][0] = DOL_URL_ROOT.'/mrp/mo_production.php?id='.$object->id; $head[$h][1] = $langs->trans("Production"); + $arrayproduced = $object->fetchLinesLinked('produced', 0); + $nbProduced = 0; + foreach($arrayproduced as $lineproduced) { + $nbProduced += $lineproduced['qty']; + } + $head[$h][1].= ''.$nbProduced.' / '.$object->qty.''; $head[$h][2] = 'production'; $h++; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 6a2b0e88dc4..148caa30ed7 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -49,6 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; dol_include_once('/mrp/class/mo.class.php'); dol_include_once('/mrp/lib/mrp_mo.lib.php'); @@ -66,6 +67,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'moc $backtopage = GETPOST('backtopage', 'alpha'); //$lineid = GETPOST('lineid', 'int'); +$collapse = GETPOST('collapse', 'aZ09comma'); + // Initialize technical objects $object = new Mo($db); $extrafields = new ExtraFields($db); @@ -371,6 +374,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formproject = new FormProjets($db); $formproduct = new FormProduct($db); +$tmpwarehouse = new Entrepot($db); llxHeader('', $langs->trans('Mo'), ''); @@ -587,6 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* * Lines */ + $collapse = 1; if (!empty($object->table_element_line)) { @@ -601,26 +606,36 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print load_fiche_titre($langs->trans('Consumption'), '', ''); print '
'; - print ''; + print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($conf->productbatch->enabled) { print ''; } print ''; if (!empty($object->lines)) { - foreach($object->lines as $line) { + $nblinetoconsume = 0; + foreach($object->lines as $line) { + if ($line->role == 'toconsume') { + $nblinetoconsume++; + } + } + + $nblinetoconsumecursor = 0; + foreach($object->lines as $line) { if ($line->role == 'toconsume') { + $nblinetoconsumecursor++; + $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); @@ -632,31 +647,37 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print ''; - print ''; - print ''; + print ''; if ($conf->productbatch->enabled) { print ''; // Lot @@ -664,7 +685,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Show detailed of already consumed with js code to collapse - //$arrayoflines = $object->fetchLinesLinked('consumed', $line->id); + foreach($arrayoflines as $line2) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $i = 1; @@ -672,7 +708,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); if ($action == 'consumeorproduce' && ! GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0; - print ''; + print ''; print ''; print '
'.$langs->trans("Product").''.$langs->trans("Qty").''.$langs->trans("QtyAlreadyConsumed").''.$langs->trans("Qty").''.$langs->trans("QtyAlreadyConsumed").''; - if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); + if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; - if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); + if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); print '
'.$tmpproduct->getNomUrl(1).''; + print ''; $help = ''; if ($line->qty_frozen) $help.=($help ? '
' : '').''.$langs->trans("QuantityFrozen").': '.yn(1).' ('.$langs->trans("QuantityConsumedInvariable").')'; if ($line->disable_stock_change) $help.=($help ? '
' : '').''.$langs->trans("DisableStockChange").': '.yn(1).' ('.(($tmpproduct->type == Product::TYPE_SERVICE && empty($conf->global->STOCK_SUPPORTS_SERVICES)) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")).')'; if ($help) { - print $form->textwithpicto($line->qty, $help); + print $form->textwithpicto($line->qty, $help, -1); } else { print $line->qty; } print '
'.$alreadyconsumed.''; // Warehouse + print ''; if ($alreadyconsumed) { - print ''; - if (empty($conf->use_javascript_ajax)) print 'id.'">'; - print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); - if (empty($conf->use_javascript_ajax)) print ''; + print ''; + if (empty($conf->use_javascript_ajax)) print 'id.'">'; + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); + if (empty($conf->use_javascript_ajax)) print ''; } + print ' '.$alreadyconsumed; + print ''; // Warehouse print '
'; + print dol_print_date($line2['date'], 'dayhour'); + print ''.$line2['qty'].''; + if ($line2['fk_warehouse'] > 0) { + $tmpwarehouse->fetch($line2['fk_warehouse']); + print $tmpwarehouse->getNomUrl(); + } + print ''.$line2['batch'].'
'.$langs->trans("ToConsume").''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { @@ -700,24 +736,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - /*if (!empty($object->lines)) - { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/mrp/tpl'); - } - - // Form to add new line - if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') - { - if ($action != 'editline') - { - // Add products/services form - $object->formAddObjectLine(1, $mysoc, $soc, '/mrp/tpl'); - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - } - }*/ - print '
'; print '
'; @@ -728,26 +746,36 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print load_fiche_titre($langs->trans('Production'), '', ''); print '
'; - print ''; + print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($conf->productbatch->enabled) { print ''; } print ''; if (!empty($object->lines)) { + $nblinetoproduce = 0; foreach($object->lines as $line) { if ($line->role == 'toproduce') { + $nblinetoproduce++; + } + } + + $nblinetoproducecursor = 0; + foreach($object->lines as $line) { + if ($line->role == 'toproduce') { + $nblinetoproducecursor++; + $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); @@ -759,34 +787,58 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; if ($conf->productbatch->enabled) { print ''; // Lot } print ''; + // Show detailed of already consumed with js code to collapse + foreach($arrayoflines as $line2) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print ''; print ''; $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); if ($action == 'consumeorproduce' && ! GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0; - print ''; + print ''; print ''; print '
'.$langs->trans("Product").''.$langs->trans("Qty").''.$langs->trans("QtyAlreadyProduced").''.$langs->trans("Qty").''.$langs->trans("QtyAlreadyProduced").''; - if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); + if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; - if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); + if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); print '
'.$tmpproduct->getNomUrl(1).''.$line->qty.''.$alreadyproduced.''; // Warehouse + print ''.$line->qty.''; if ($alreadyproduced) { print ''; if (empty($conf->use_javascript_ajax)) print 'id.'">'; - print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expand'.$line->id.'"'); + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); if (empty($conf->use_javascript_ajax)) print ''; } + print ' '.$alreadyproduced; + print ''; // Warehouse print '
'; + print dol_print_date($line2['date'], 'dayhour'); + print ''.$line2['qty'].''; + if ($line2['fk_warehouse'] > 0) { + $tmpwarehouse->fetch($line2['fk_warehouse']); + print $tmpwarehouse->getNomUrl(); + } + print ''.$line2['batch'].'
'.$langs->trans("ToProduce").''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c8c535a9038..a8e2339a7b9 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -244,6 +244,9 @@ select.flat, form.flat select { .opacitymediumbycolor { color: rgba(0, 0, 0, 0.4); } +.opacitylow { + opacity: 0.6; +} .opacityhigh { opacity: 0.2; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 50c637be3c9..e396b5f7a42 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -462,6 +462,9 @@ select.flat, form.flat select { .opacitymediumbycolor { color: rgba(0, 0, 0, 0.4); } +.opacitylow { + opacity: 0.6; +} .opacityhigh { opacity: 0.2; } From aeaaa689de7bbcb3fb8d9d137cb1aa5b40b6b42d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 19:10:07 +0100 Subject: [PATCH 4/6] Debug MRP --- htdocs/mrp/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index 8f893f832bf..26524b2df6d 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -93,7 +93,7 @@ if ($conf->use_javascript_ajax) print '
'; print ''; - print ''."\n"; + print ''."\n"; if ($conf->use_javascript_ajax) { print '
'.$langs->trans("Statistics").'
'.$langs->trans("Statistics").' - '.$langs->trans("MO").'
'; From 66ab93035eda2607edb71eab2137d5fa8786b2c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 19:12:00 +0100 Subject: [PATCH 5/6] Doc --- ChangeLog | 60 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d3f04d314f..e4bee4c4739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,40 +2,14 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 10.0.5 compared to 10.0.4 ***** -FIX: 10.0: add URL param "restore_last_search_values=1" to all backlinks pointing to lists -FIX: 10.0: do not display single-letter values (indicating duration unit without value) in product list -FIX: #12473 -FIX: #12481 : fix ticket creation from thirdparty, mission $socid var -FIX: #12482 -FIX: #12644 -FIX: #12665 Mass invoice validation with stock management -FIX: #12688 -FIX: #12745 -FIX: add and modify category translate form with posted values on errors -FIX: add URL param "restore_last_search_values=1" to all backlinks that point to a list -FIX: CommandeFournisseurLigne update function must not be able to return other value than 1 if success -FIX: contact card state address selected after filling address -FIX: dol_string_nohtmltag when there is html with windows EOL "
\r\n" -FIX: filter language is an array -FIX: first col at wrong position in Export 2007 (new) -FIX: getrights() request -FIX: Invoice Situation integration into Margin -FIX: missing nl2br conversion -FIX: not fee in payout list -FIX: product_fourn_price_id was assigned too late for logPrice() function -FIX: Reduce number of request for list of products -FIX: set due date in object in create invoice -FIX: units traductions for selectUnits() function -FIX: when we need to bill several orders, order lines unit is not on bill lines -NEW: 9.0: allow users to use the mysqldump '--quick' option ***** ChangeLog for 11.0.0 compared to 10.0.0 ***** For Users: -NEW: Module BOM is now stable (Module MO - Manufacturing Order is still in development). +NEW: Module BOM is now stable. +NEW: Module MO - Manufacturing Order available with experimental status. NEW: Can set the Address/Contact by default on third parties. -NEW: Add a dictionary for list of Social networks +NEW: Add a dictionary to edit list of Social networks. NEW: A nicer dashboard for open elements on Home page. NEW: Add task widget and add task progress bar NEW: Support of deployment of metapackages @@ -239,6 +213,34 @@ Following changes may create regressions for some external modules, but were nec * The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core. +***** ChangeLog for 10.0.5 compared to 10.0.4 ***** +FIX: 10.0: add URL param "restore_last_search_values=1" to all backlinks pointing to lists +FIX: 10.0: do not display single-letter values (indicating duration unit without value) in product list +FIX: #12473 +FIX: #12481 : fix ticket creation from thirdparty, mission $socid var +FIX: #12482 +FIX: #12644 +FIX: #12665 Mass invoice validation with stock management +FIX: #12688 +FIX: #12745 +FIX: add and modify category translate form with posted values on errors +FIX: add URL param "restore_last_search_values=1" to all backlinks that point to a list +FIX: CommandeFournisseurLigne update function must not be able to return other value than 1 if success +FIX: contact card state address selected after filling address +FIX: dol_string_nohtmltag when there is html with windows EOL "
\r\n" +FIX: filter language is an array +FIX: first col at wrong position in Export 2007 (new) +FIX: getrights() request +FIX: Invoice Situation integration into Margin +FIX: missing nl2br conversion +FIX: not fee in payout list +FIX: product_fourn_price_id was assigned too late for logPrice() function +FIX: Reduce number of request for list of products +FIX: set due date in object in create invoice +FIX: units traductions for selectUnits() function +FIX: when we need to bill several orders, order lines unit is not on bill lines +NEW: 9.0: allow users to use the mysqldump '--quick' option + ***** ChangeLog for 10.0.4 compared to 10.0.3 ***** FIX: The pdf templates were using the large logo making PDF too large (and edition of proposal, order, invoice VERY slow) FIX: #12258 From b3d8a1e76a3801470ca7d79c7c02a1c74ec98478 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 19:46:13 +0100 Subject: [PATCH 6/6] Fix template --- htdocs/modulebuilder/template/myobject_card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 65d013992be..aa1af165813 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -73,6 +73,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); //$lineid = GETPOST('lineid', 'int'); // Initialize technical objects @@ -204,7 +205,8 @@ if ($action == 'create') print '
'; print ''; print ''; - print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; dol_fiche_head(array(), ''); @@ -239,8 +241,9 @@ if (($id || $ref) && $action == 'edit') print ''; print ''; print ''; - print ''; print ''; + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; dol_fiche_head();