From 7ef3ee56bd96bf53fd8087ca32583cb1e195039d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 20:28:21 +0100 Subject: [PATCH] Fix MRP --- htdocs/comm/action/card.php | 1 + htdocs/core/lib/functions2.lib.php | 5 +++ htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/mrp.lang | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_production.php | 37 ++++++++++++++++--- .../stock/class/mouvementstock.class.php | 4 ++ htdocs/product/stock/movement_list.php | 10 ++--- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f7a9495c244..118ab6ededf 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1461,6 +1461,7 @@ if ($id > 0) print ''.$langs->trans("Priority").''; print ''; print ''; + // Object linked if (!empty($object->fk_element) && !empty($object->elementtype)) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e1603fce57d..2eebf38ad56 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1888,6 +1888,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $module='stock'; $myobject='inventory'; } + elseif ($objecttype == 'mo') { + $classpath = 'mrp/class'; + $module='mrp'; + $myobject='mo'; + } // Generic case for $classfile and $classname $classfile = strtolower($myobject); $classname = ucfirst($myobject); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ac411f56f3e..942d7eac20f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1013,3 +1013,4 @@ ContactDefault_supplier_proposal=Supplier Proposal ContactDefault_ticketsup=Ticket ContactAddedAutomatically=Contact added from contact thirdparty roles More=More +ShowDetails=Show details diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index e336dd2552d..6bec44d66e6 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -60,6 +60,6 @@ TheProductXIsAlreadyTheProductToProduce=The product to add is already the produc ForAQuantityOf1=For a quantity to produce of 1 ConfirmValidateMo=Are you sure you want to validate this Manufacturing Order? ConfirmProductionDesc=By clicking on '%s', you will validate the consumption and/or production for the quantities set. This will also update the stock and record stock movements. -ProductionForRefAndDate=Production %s - %s +ProductionForRef=Production of %s AutoCloseMO=Close automatically the Manufacturing Order if quantities to consume and to produce are reached NoStockChangeOnServices=No stock change on services \ No newline at end of file diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index ee2c9840a0d..203408ea79e 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -242,7 +242,7 @@ if ($object->id > 0) $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 9c588d927de..7284d764d6f 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -577,9 +577,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if ($action == 'consumeandproduceall') { - $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard')); + $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') : $object->ref; + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); print '
'; print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; @@ -654,8 +654,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; print ''.$alreadyconsumed.''; - print ''; - print ''; // Warehouse + print ''; // Warehouse + 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 ($conf->productbatch->enabled) { print ''; // Lot } @@ -757,7 +770,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$tmpproduct->getNomUrl(1).''; print ''.$line->qty.''; print ''.$alreadyproduced.''; - print ''; // Warehouse + print ''; // Warehouse + if ($alreadyproduced) { + print ''; + if (empty($conf->use_javascript_ajax)) print 'id.'">'; + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expand'.$line->id.'"'); + if (empty($conf->use_javascript_ajax)) print ''; + } + print ''; if ($conf->productbatch->enabled) { print ''; // Lot } diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index c50d816f14f..55e7af367b7 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -941,6 +941,10 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $origin = new Project($this->db); break; + case 'mo': + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; + $origin = new Mo($this->db); + break; default: if ($origintype) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index cfb0d6d0b9c..ebcc7968c60 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -674,9 +674,9 @@ if ($resql) } $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($id > 0) $param .= '&id='.$id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($id > 0) $param .= '&id='.urlencode($id); if ($search_movement) $param .= '&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode); if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement); @@ -684,10 +684,8 @@ if ($resql) if ($search_product) $param .= '&search_product='.urlencode($search_product); if ($search_batch) $param .= '&search_batch='.urlencode($search_batch); if ($search_warehouse > 0) $param .= '&search_warehouse='.urlencode($search_warehouse); - if (!empty($sref)) $param .= '&sref='.urlencode($sref); // FIXME $sref is not defined - if (!empty($snom)) $param .= '&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param .= '&search_user='.urlencode($search_user); - if ($idproduct > 0) $param .= '&idproduct='.$idproduct; + if ($idproduct > 0) $param .= '&idproduct='.urlencode($idproduct); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';