Debug BOM

This commit is contained in:
Laurent Destailleur 2019-11-09 20:12:27 +01:00
parent b1394463db
commit 96314c9c26
3 changed files with 62 additions and 39 deletions

View File

@ -584,32 +584,42 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
//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 == $object::STATUS_VALIDATED)
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
// Modify
if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
if ($object->status == $object::STATUS_DRAFT)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
else
{
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 ($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>';
}
if ($permissiontoadd)
{
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>';
}
}
}
// Close / Cancel

View File

@ -454,9 +454,12 @@ 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";
// Back to draft
if (! empty($user->rights->mymodule->myobject->write) && $object->status == $object::STATUS_VALIDATED)
if ($object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
if ($permissiontoadd)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
}
}
// Modify
@ -470,16 +473,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Validate
if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
if ($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>';
}
if ($permissiontoadd)
{
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

View File

@ -494,9 +494,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
// Modify
@ -510,16 +514,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Validate
if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
if ($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>';
}
if ($permissiontoadd)
{
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