Work on MO

This commit is contained in:
Laurent Destailleur 2019-10-30 00:56:57 +01:00
parent 66337ec234
commit beb85ee3a8
4 changed files with 68 additions and 3 deletions

View File

@ -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');

View File

@ -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

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
@ -130,6 +130,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* 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 '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LatestMOModified", $max).'</th></tr>';
$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 '<tr class="oddeven">';
print '<td>'.$staticmo->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticmo->getLibStatut(5).'</td>';
print '</tr>';
$i++;
}
} else {
print '<tr class="oddeven">';
print '<td><span class="opacitymedium">' . $langs->trans("None") . '</span></td>';
print '</tr>';
}
print "</table></div>";
print "<br>";
}
else
{
dol_print_error($db);
}
print '</div></div></div>';
$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();

View File

@ -463,6 +463,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
// Validate
if ($user->rights->mrp->write && $object->status == MO::STATUS_DRAFT)
{
if (is_array($object->lines) && count($object->lines) > 0)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate">' . $langs->trans("Validate") . '</a>';
}
else
{
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">' . $langs->trans("Validate") . '</a>';
}
}
// Clone
if (! empty($user->rights->mrp->write))
{