diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 2bd6fbb8075..bccc6755332 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -584,32 +584,42 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
//print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
- if ($user->rights->bom->write && $object->status == $object::STATUS_VALIDATED)
+ // Back to draft
+ if ($object->status == $object::STATUS_VALIDATED)
{
- print ''.$langs->trans("SetToDraft").'';
+ if ($permissiontoadd)
+ {
+ print ''.$langs->trans("SetToDraft").'';
+ }
}
// Modify
- if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
+ if ($object->status == $object::STATUS_DRAFT)
{
- print 'id.'&action=edit">'.$langs->trans("Modify").''."\n";
- }
- else
- {
- print ''.$langs->trans('Modify').''."\n";
+ if ($permissiontoadd)
+ {
+ print 'id.'&action=edit">'.$langs->trans("Modify").''."\n";
+ }
+ else
+ {
+ print ''.$langs->trans('Modify').''."\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 '' . $langs->trans("Validate") . '';
- }
- else
- {
- print '' . $langs->trans("Validate") . '';
- }
+ if ($permissiontoadd)
+ {
+ if (is_array($object->lines) && count($object->lines) > 0)
+ {
+ print '' . $langs->trans("Validate") . '';
+ }
+ else
+ {
+ print '' . $langs->trans("Validate") . '';
+ }
+ }
}
// Close / Cancel
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index bb39ec6dbb4..e98d911f6a7 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -454,9 +454,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
// Back to draft
- if (! empty($user->rights->mymodule->myobject->write) && $object->status == $object::STATUS_VALIDATED)
+ if ($object->status == $object::STATUS_VALIDATED)
{
- print '' . $langs->trans("SetToDraft") . '';
+ if ($permissiontoadd)
+ {
+ print '' . $langs->trans("SetToDraft") . '';
+ }
}
// 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 ''.$langs->trans("Validate").'';
- }
- else
- {
- print ''.$langs->trans("Validate").'';
- }
+ if ($permissiontoadd)
+ {
+ if (is_array($object->lines) && count($object->lines) > 0)
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ else
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ }
}
// Clone
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index 91f119486f4..659f9100b45 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -494,9 +494,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
//print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
- if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
+ // Back to draft
+ if ($object->status == $object::STATUS_VALIDATED)
{
- print ''.$langs->trans("SetToDraft").'';
+ if ($permissiontoadd)
+ {
+ print ''.$langs->trans("SetToDraft").'';
+ }
}
// 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 ''.$langs->trans("Validate").'';
- }
- else
- {
- print ''.$langs->trans("Validate").'';
- }
+ if ($permissiontoadd)
+ {
+ if (is_array($object->lines) && count($object->lines) > 0)
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ else
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ }
}
// Clone