From beb85ee3a885ca9b92aae8205c66655dca2ad13e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2019 00:56:57 +0100 Subject: [PATCH] Work on MO --- htdocs/core/actions_addupdatedelete.inc.php | 1 - htdocs/langs/en_US/mrp.lang | 1 + htdocs/mrp/index.php | 56 ++++++++++++++++++++- htdocs/mrp/mo_card.php | 13 +++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 72ad67db52e..dcb8f75c637 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -108,7 +108,6 @@ if ($action == 'update' && ! empty($permissiontoadd)) { if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields - var_dump($object->fields[$key]['type']); // Set value to update if (in_array($object->fields[$key]['type'], array('text', 'html'))) { $value = GETPOST($key, 'none'); diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 1de5f40c79c..6bf86dac102 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -5,6 +5,7 @@ MRPArea=MRP Area MrpSetupPage=Setup of module MO MenuBOM=Bills of material LatestBOMModified=Latest %s Bills of materials modified +LatestMOModified=Latest %s Manufacturing Orders modified Bom=Bills of Material BillOfMaterials=Bill of Material BOMsSetup=Setup of module BOM diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index 18cef7f75ea..742d94109e2 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2019 Frédéric France @@ -130,6 +130,7 @@ print '
'; /* * Last modified BOM */ + $max=5; $sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status"; @@ -179,12 +180,63 @@ else dol_print_error($db); } +/* + * Last modified MOs + */ +$max=5; + +$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status"; +$sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo as a"; +$sql.= " WHERE a.entity IN (".getEntity('mo').")"; +$sql.= $db->order("a.tms", "DESC"); +$sql.= $db->plimit($max, 0); + +$resql=$db->query($sql); +if ($resql) +{ + print '
'; + print ''; + print ''; + print ''; + + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $staticmo->id=$obj->rowid; + $staticmo->ref=$obj->ref; + $staticmo->date_modification=$obj->datem; + $staticmo->status=$obj->status; + + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + } else { + print ''; + print ''; + print ''; + } + print "
'.$langs->trans("LatestMOModified", $max).'
'.$staticmo->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticmo->getLibStatut(5).'
' . $langs->trans("None") . '
"; + print "
"; +} +else +{ + dol_print_error($db); +} print '
'; $parameters = array('type' => $type, 'user' => $user); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, null); // Note that $action and $object may have been modified by hook // End of page llxFooter(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 356ea7bb07f..680a19fb18a 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -463,6 +463,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + // Validate + if ($user->rights->mrp->write && $object->status == MO::STATUS_DRAFT) + { + if (is_array($object->lines) && count($object->lines) > 0) + { + print '' . $langs->trans("Validate") . ''; + } + else + { + print '' . $langs->trans("Validate") . ''; + } + } + // Clone if (! empty($user->rights->mrp->write)) {