From c65680dbcf7f29a59d7cc00a83f0bc98e3d80ad2 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 24 Feb 2022 11:48:10 +0100 Subject: [PATCH 1/5] WIP dolGetButtonAction on Product --- htdocs/product/card.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 64c6b6817bd..05475563e17 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2539,6 +2539,11 @@ print $formconfirm; * Action bar */ if ($action != 'create' && $action != 'edit') { + $cloneProductUrl = $_SERVER["PHP_SELF"].'?action=clone&token='.newToken(); + $cloneButtonId = 'action-clone-no-ajax'; + $deleteProductUrl = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id; + $deleteButtonId = 'action-delete-no-ajax'; + print "\n".'
'."\n"; $parameters = array(); @@ -2547,14 +2552,16 @@ if ($action != 'create' && $action != 'edit') { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { print 'id.'">'.$langs->trans("Modify").''; + print dolGetButtonAction('', $langs->trans('ModifyGREG'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print ''.$langs->trans('ToClone').''."\n"; - } else { - print 'id.'">'.$langs->trans("ToClone").''; + //print ''.$langs->trans('ToClone').''."\n"; + $cloneProductUrl = ''; + $cloneButtonId = 'action-clone'; } + print dolGetButtonAction($langs->trans('ToCloneGREG'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); } } $object_is_used = $object->isObjectUsed($object->id); @@ -2563,6 +2570,8 @@ if ($action != 'create' && $action != 'edit') { if (empty($object_is_used) && (!isset($object->no_button_delete) || $object->no_button_delete <> 1)) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { print ''.$langs->trans('Delete').''."\n"; + //$deleteProductUrl = ''; + //$cloneButtonId = 'action-delete'; } else { print 'id.'">'.$langs->trans("Delete").''; } @@ -2572,6 +2581,8 @@ if ($action != 'create' && $action != 'edit') { } else { print ''.$langs->trans("Delete").''; } + print dolGetButtonAction($langs->trans('deleteGREG'), '', 'danger', $deleteProductUrl, $deleteButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('DeleteNEW'), '', 'danger', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->creer); } print "\n
\n"; From a761afe5ed69680da78ce1ff97d24dbe61acb043 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 10:14:39 +0100 Subject: [PATCH 2/5] FIX add dolGetButtonAction on Product --- htdocs/product/card.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 05475563e17..15a6f6e82f9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2551,17 +2551,15 @@ if ($action != 'create' && $action != 'edit') { if (empty($reshook)) { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { - print 'id.'">'.$langs->trans("Modify").''; - print dolGetButtonAction('', $langs->trans('ModifyGREG'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - //print ''.$langs->trans('ToClone').''."\n"; $cloneProductUrl = ''; $cloneButtonId = 'action-clone'; } - print dolGetButtonAction($langs->trans('ToCloneGREG'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); } } $object_is_used = $object->isObjectUsed($object->id); @@ -2569,20 +2567,16 @@ if ($action != 'create' && $action != 'edit') { if ($usercandelete) { if (empty($object_is_used) && (!isset($object->no_button_delete) || $object->no_button_delete <> 1)) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { - print ''.$langs->trans('Delete').''."\n"; - //$deleteProductUrl = ''; - //$cloneButtonId = 'action-delete'; + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', 'action-delete', true); } else { - print 'id.'">'.$langs->trans("Delete").''; + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction($langs->trans("ProductIsUsed"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); } } else { - print ''.$langs->trans("Delete").''; + print dolGetButtonAction($langs->trans("NotEnoughPermissions"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); } - print dolGetButtonAction($langs->trans('deleteGREG'), '', 'danger', $deleteProductUrl, $deleteButtonId, $user->rights->societe->creer); - print dolGetButtonAction($langs->trans('DeleteNEW'), '', 'danger', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->creer); } print "\n\n"; From 22aae26f71d28f1f17416d2ce715d8a7bf1ffa37 Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 10:27:26 +0100 Subject: [PATCH 3/5] update product card --- htdocs/product/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 15a6f6e82f9..4de5e0406e0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2541,8 +2541,6 @@ print $formconfirm; if ($action != 'create' && $action != 'edit') { $cloneProductUrl = $_SERVER["PHP_SELF"].'?action=clone&token='.newToken(); $cloneButtonId = 'action-clone-no-ajax'; - $deleteProductUrl = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id; - $deleteButtonId = 'action-delete-no-ajax'; print "\n".'
'."\n"; From 79a0aa816fedfd2630a367716b8d5c0be4fe913a Mon Sep 17 00:00:00 2001 From: GregM Date: Fri, 25 Feb 2022 16:42:25 +0100 Subject: [PATCH 4/5] DolGetButtonAction add $usercancreate --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4de5e0406e0..bedeae3264a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2549,7 +2549,7 @@ if ($action != 'create' && $action != 'edit') { if (empty($reshook)) { if ($usercancreate) { if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) { - print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $user->rights->societe->creer); + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $usercancreate); } if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { @@ -2557,7 +2557,7 @@ if ($action != 'create' && $action != 'edit') { $cloneProductUrl = ''; $cloneButtonId = 'action-clone'; } - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $user->rights->societe->creer); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $usercancreate); } } $object_is_used = $object->isObjectUsed($object->id); From f141eee00574b068d43b194fec77ca3f8ce82795 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2022 18:08:52 +0200 Subject: [PATCH 5/5] Update card.php --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index bedeae3264a..beb2e015fc4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2570,10 +2570,10 @@ if ($action != 'create' && $action != 'edit') { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } } else { - print dolGetButtonAction($langs->trans("ProductIsUsed"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); + print dolGetButtonAction($langs->trans("ProductIsUsed"), $langs->trans('Delete'), 'delete', '#', '', false); } } else { - print dolGetButtonAction($langs->trans("NotEnoughPermissions"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '', false); + print dolGetButtonAction($langs->trans("NotEnoughPermissions"), $langs->trans('Delete'), 'delete', '#', '', false); } }