From 96314c9c26ac9500f033308c9704b2af38228c7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Nov 2019 20:12:27 +0100 Subject: [PATCH] Debug BOM --- htdocs/bom/bom_card.php | 44 ++++++++++++------- .../modulebuilder/template/myobject_card.php | 28 +++++++----- htdocs/mrp/mo_card.php | 29 +++++++----- 3 files changed, 62 insertions(+), 39 deletions(-) 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 '' . $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 ''.$langs->trans("Modify").''."\n"; - } - else - { - print ''.$langs->trans('Modify').''."\n"; + if ($permissiontoadd) + { + print ''.$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 '' . $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 '' . $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