diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 09d2b2bcb9d..926797d1f07 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -704,7 +704,7 @@ if (empty($reshook)) {
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").''."\n";
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=bom', 'clone', $permissiontoadd);
}
// Close / Cancel
@@ -726,11 +726,8 @@ if (empty($reshook)) {
}
*/
- if ($permissiontodelete) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
- }
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 16a471ac51d..d7d91414788 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -535,7 +535,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
+ if ($permissiontoadd) {
+ print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
+ }
/*
if ($permissiontoadd) {
@@ -554,8 +556,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
*/
- // Delete (need delete permission, or if draft, just need create/modify permission)
- print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
+ // Delete
+ $params = array();
+ print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params);
}
print ''."\n";
}
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index fde5811547a..4142693b172 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -678,7 +678,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").'';
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=mo', 'clone', $permissiontoadd);
}
// Cancel - Reopen
@@ -703,12 +703,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
- }
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 6e1bb1e8a2e..fb9803dd23b 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -417,17 +417,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- /*if ($permissiontoadd)
- {
- print ''.$langs->trans("ToClone").''."\n";
- }*/
-
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
+ if ($permissiontoadd) {
+ //print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=inventory', 'clone', $permissiontoadd);
}
+
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
index ce8b045a6cd..54384ae0b3f 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
@@ -84,7 +84,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
$permissiontoread = $user->rights->stocktransfer->stocktransfer->read;
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
-$permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
+$permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete || ($permissiontoadd && isset($object->status) && $object->status < $object::STATUS_TRANSFERED);
$permissiondellink = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $object->entity : 1];
@@ -964,7 +964,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").''."\n";
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=stocktransfer', 'clone', $permissiontoadd);
}
/*
@@ -992,14 +992,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
*/
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($object->status < $object::STATUS_TRANSFERED && $permissiontodelete) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- }
- /*else
- {
- print ''.$langs->trans('Delete').''."\n";
- }*/
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
index b5b32fc26db..4226e016e73 100644
--- a/htdocs/recruitment/recruitmentcandidature_card.php
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -526,7 +526,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
- print ''.$langs->trans("SetToDraft").'';
+ print ''.$langs->trans("SetToDraft").'';
}
}
@@ -565,7 +565,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").''."\n";
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature', 'clone', $permissiontoadd);
}
// Button to convert into a user
@@ -592,12 +592,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
- }
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php
index a23888fd8a9..88424f1b06d 100644
--- a/htdocs/recruitment/recruitmentjobposition_card.php
+++ b/htdocs/recruitment/recruitmentjobposition_card.php
@@ -435,7 +435,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").''."\n";
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentjobposition', 'clone', $permissiontoadd);
}
/*
@@ -452,12 +452,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
- }
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}
diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php
index 280478c2977..87ee470dce7 100644
--- a/htdocs/workstation/workstation_card.php
+++ b/htdocs/workstation/workstation_card.php
@@ -451,10 +451,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd) {
- print ''.$langs->trans("ToClone").''."\n";
+ print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=workstation', 'clone', $permissiontoadd);
}
-
+ // Disable / Enable
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ENABLED) {
print 'id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").''."\n";
@@ -463,13 +463,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
-
- // Delete (need delete permission, or if draft, just need create/modify permission)
- if ($permissiontodelete) {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').''."\n";
- } else {
- print ''.$langs->trans('Delete').''."\n";
- }
+ // Delete
+ print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print ''."\n";
}