diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index ea3aba8b7e7..2bd6fbb8075 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -584,13 +584,13 @@ 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 == BOM::STATUS_VALIDATED)
+ if ($user->rights->bom->write && $object->status == $object::STATUS_VALIDATED)
{
print ''.$langs->trans("SetToDraft").'';
}
// Modify
- if ($permissiontoadd)
+ if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
{
print 'id.'&action=edit">'.$langs->trans("Modify").''."\n";
}
@@ -600,7 +600,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// 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)
{
@@ -613,13 +613,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Close / Cancel
- if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
+ if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{
print '' . $langs->trans("Disable") . '';
}
// Re-open
- if ($user->rights->bom->write && $object->status == BOM::STATUS_CANCELED)
+ if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{
print '' . $langs->trans("ReOpen") . '';
}
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 4752439c830..bb39ec6dbb4 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -454,7 +454,7 @@ 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 == BOM::STATUS_VALIDATED)
+ if (! empty($user->rights->mymodule->myobject->write) && $object->status == $object::STATUS_VALIDATED)
{
print '' . $langs->trans("SetToDraft") . '';
}
@@ -469,6 +469,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ''.$langs->trans('Modify').''."\n";
}
+ // Validate
+ if ($permissiontoadd && $object->status == $object::STATUS_DRAFT)
+ {
+ if (is_array($object->lines) && count($object->lines) > 0)
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ else
+ {
+ print ''.$langs->trans("Validate").'';
+ }
+ }
+
// Clone
if ($permissiontoadd)
{
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index a881e23ff5a..91f119486f4 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -323,7 +323,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}*/
$formquestion = array();
- if (!empty($conf->bom->enabled))
+ if (!empty($conf->mrp->enabled))
{
$langs->load("mrp");
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
//print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ''."\n";
- if ($user->rights->bom->write && $object->status == MO::STATUS_VALIDATED)
+ if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{
print ''.$langs->trans("SetToDraft").'';
}
@@ -510,7 +510,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// 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)
{