Debug mrp

This commit is contained in:
Laurent Destailleur 2019-11-09 20:02:46 +01:00
parent 59d83fce59
commit b1394463db
3 changed files with 22 additions and 9 deletions

View File

@ -584,13 +584,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send // Send
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n"; //print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) if ($user->rights->bom->write && $object->status == $object::STATUS_VALIDATED)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
} }
// Modify // Modify
if ($permissiontoadd) if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} }
@ -600,7 +600,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Validate // Validate
if ($user->rights->bom->write && $object->status == BOM::STATUS_DRAFT) if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
{ {
if (is_array($object->lines) && count($object->lines) > 0) if (is_array($object->lines) && count($object->lines) > 0)
{ {
@ -613,13 +613,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Close / Cancel // Close / Cancel
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED) if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close">' . $langs->trans("Disable") . '</a>'; print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close">' . $langs->trans("Disable") . '</a>';
} }
// Re-open // Re-open
if ($user->rights->bom->write && $object->status == BOM::STATUS_CANCELED) if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans("ReOpen") . '</a>'; print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans("ReOpen") . '</a>';
} }

View File

@ -454,7 +454,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n"; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
// Back to draft // Back to draft
if (! empty($user->rights->mymodule->myobject->write) && $object->status == BOM::STATUS_VALIDATED) if (! empty($user->rights->mymodule->myobject->write) && $object->status == $object::STATUS_VALIDATED)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>'; print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
} }
@ -469,6 +469,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"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
} }
// Validate
if ($permissiontoadd && $object->status == $object::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 // Clone
if ($permissiontoadd) if ($permissiontoadd)
{ {

View File

@ -323,7 +323,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}*/ }*/
$formquestion = array(); $formquestion = array();
if (!empty($conf->bom->enabled)) if (!empty($conf->mrp->enabled))
{ {
$langs->load("mrp"); $langs->load("mrp");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
@ -494,7 +494,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send // Send
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n"; //print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
if ($user->rights->bom->write && $object->status == MO::STATUS_VALIDATED) if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
} }
@ -510,7 +510,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Validate // Validate
if ($user->rights->mrp->write && $object->status == MO::STATUS_DRAFT) if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
{ {
if (is_array($object->lines) && count($object->lines) > 0) if (is_array($object->lines) && count($object->lines) > 0)
{ {