diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 36b9f3a8b93..e70bc39bfd0 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -426,11 +426,9 @@ if ($action == 'create') { print ''.$langs->trans('Modify').''; } - if ($user->hasRight('accounting', 'chartofaccount')) { - print 'id.'">'.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } + // Delete + $permissiontodelete = $user->hasRight('accounting', 'chartofaccount'); + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); print ''; } diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 89ed7b538ba..38330a37e13 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -305,7 +305,7 @@ if ($action == 'create') { print ''.$langs->trans('Modify').''; - // print '' . $langs->trans('Delete') . ''; + //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); print ''; } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 4b0eed154c0..14da758457f 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -133,7 +133,7 @@ if (empty($user->socid)) { } if ($user->rights->adherent->supprimer) { - echo ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer); } echo '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 76cc9b23f27..f835ae3ae29 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2933,10 +2933,7 @@ if ($action == 'create') { } // Delete - if ($usercandelete) { - print ''.$langs->trans('Delete').''; - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $usercandelete); } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9428f76dd8e..2afc01914e0 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2899,7 +2899,7 @@ if ($action == 'create' && $usercancreate) { // Delete order if ($usercandelete) { if ($numshipping == 0) { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index f8e5f3ba03b..e7929a12697 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -492,11 +492,8 @@ if ($action == 'create') { } } - if ($user->rights->deplacement->supprimer) { - print ''.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } + $permissiontodelete = $user->rights->deplacement->supprimer; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); print ''; } diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 33b85f707e9..2a15c74c948 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1677,10 +1677,8 @@ if ($action == 'create') { } } - //if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer) - if ($user->rights->facture->supprimer) { - print '
'.$langs->trans('Delete').'
'; - } + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->supprimer); print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b5e756ebb19..3e3ada6e8cf 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5744,8 +5744,7 @@ if ($action == 'create') { } print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); } else { - $params['attr']['title'] = $langs->trans('NotAllowed'); - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false); } } print ''; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 89ee368b7d5..58a27c94974 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -520,13 +520,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { } if ($user->socid == 0 && $action == '') { - if ($user->rights->facture->paiement) { - if (!$disable_delete) { - print ''.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->paiement && !$disable_delete); } print ''; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 7b3eaceab3a..f28ebf2ebcf 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -82,6 +82,7 @@ $usercanread = $user->rights->banque->cheque; $usercancreate = $user->rights->banque->cheque; $usercandelete = $user->rights->banque->cheque; +$permissiontodelete = $user->rights->banque->cheque; /* @@ -750,7 +751,7 @@ if ($user->socid == 0 && !empty($object->id) && $object->statut == 0 && $user->r } if ($user->socid == 0 && !empty($object->id) && $user->rights->banque->cheque) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } print ''; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 1d93075bc5b..39bac75ba0c 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -253,9 +253,9 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if ($action == '') { if ($user->rights->tax->charges->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } } diff --git a/htdocs/compta/payment_vat/card.php b/htdocs/compta/payment_vat/card.php index 8beeaa1f229..6089f9dbcb5 100644 --- a/htdocs/compta/payment_vat/card.php +++ b/htdocs/compta/payment_vat/card.php @@ -308,9 +308,9 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if ($action == '') { if ($user->rights->tax->charges->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("CantRemovePaymentVATPaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 11aebc8fc29..fbe8b4d0c04 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1579,7 +1579,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Delete if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($backtopage ? '&backtopage='.urlencode($backtopage) : ''), 'delete', $user->rights->societe->contact->supprimer); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 93d33565143..0b8ec8d1ad6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -97,6 +97,7 @@ $extralabelslines = $extrafields->fetch_name_optionals_label($object->table_elem $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php +$permissiontodelete = ($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer; $error = 0; @@ -2172,15 +2173,8 @@ if ($action == 'create') { print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } - // On peut supprimer entite si - // - Droit de creer + mode brouillon (erreur creation) - // - Droit de supprimer - if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params); - } else { - $params['attr']['title'] = $langs->trans("NotAllowed"); - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params); - } + // Delete + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete, $params); } print ""; diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index f5507e5e6c7..19f40bc984e 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -214,9 +214,9 @@ print '
'; if (empty($action)) { if ($user->rights->don->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1); } } } diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 01a1cfb63a9..3f20188db56 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -283,11 +283,10 @@ if (empty($action) || $action == 'delete_section') { // Actions buttons print '
'; - if ($user->rights->ecm->setup) { - print ''.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } + + // Delete + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->ecm->setup); + print '
'; } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index c36cebfc80c..42607aa0dab 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -464,21 +464,8 @@ if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') { print ''.$langs->trans('ECMAddSection').''; } - //if (count($filearrayall) == 0) - //{ - if ($permtoadd) { - print ''.$langs->trans('Delete').''; - } else { - print ''.$langs->trans('Delete').''; - } - /*} - else - { - if (count($filearray) > 0) - print ''.$langs->trans('Delete').''; - else - print ''.$langs->trans('Delete').''; - }*/ + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($module ? '&module='.urlencode($module) : '').'§ion='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permtoadd); + print '
'; } diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 1b572e44eb8..8202335fbc3 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -424,16 +424,9 @@ if ($action != 'edit') { if ($user->rights->ecm->setup) { print ''.$langs->trans('Edit').''; } - /* - if ($user->rights->ecm->setup) - { - print ''.$langs->trans('Delete').''; - } - else - { - print ''.$langs->trans('Delete').''; - } - */ + + //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->ecm->setup); + print ''; } diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 316dccd91d8..db6c21e202f 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -238,12 +238,13 @@ if ($resql) { */ print '
'; +// Delete if ($action == '') { if ($user->rights->expensereport->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($title_button, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } } diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 6c07ec6837d..2f82b16e1ad 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -741,11 +741,9 @@ if ($action == 'create') { print $langs->trans("AddIntervention").'
'; } - if ($user->rights->ficheinter->supprimer) { - print '
'; - print ''; - print $langs->trans('Delete').'
'; - } + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->ficheinter->supprimer); + print ''; } else { print $langs->trans("ErrorRecordNotFound"); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 8b3868bf195..cef3f737c53 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -104,6 +104,7 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $permissionnote = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->ficheinter->creer; // Used by the include of actions_dellink.inc.php +$permissiontodelete = (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer); /* @@ -1688,10 +1689,7 @@ if ($action == 'create') { } // Delete - if (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print '
'.$langs->trans('Delete').'
'; - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } } } diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 71ba4f6928a..ead5a5f8ea8 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1621,10 +1621,8 @@ if ($action == 'create') { } } - //if ($object->statut == Facture::STATUS_DRAFT && ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)) - if (($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)) { - print '
' . $langs->trans('Delete') . '
'; - } + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=ask_deleteinvoice&token='.newToken(), 'delete', ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)); print ''; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index c7c1297e0e8..a11cf769204 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -374,9 +374,9 @@ if ($result > 0) { if ($user->socid == 0 && $action == '') { if ($user->rights->fournisseur->facture->supprimer) { if ($allow_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($title_button, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } } diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index f1bddce44e4..8e00473bca2 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -420,8 +420,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Action bar */ print '
'; + + // Modify print ''.$langs->trans('Modify').''; - print ''.$langs->trans('Delete').''; + + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + print '
'; } diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 6c302feddac..309e0d99f4a 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -223,9 +223,9 @@ print '
'; if (empty($action) && !empty($user->rights->loan->delete)) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 2fa2f6d9f31..b243b8c8342 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -61,6 +61,10 @@ $hookmanager->initHooks(array('surveycard', 'globalcard')); $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); +$permissiontoread = $user->rights->opensurvey->read; +$permissiontoadd = $user->rights->opensurvey->write; +// permission delete doesn't exists +$permissiontodelete = $user->rights->opensurvey->write; /* @@ -364,26 +368,25 @@ print ''."\n"; -/* - * Action bar - */ +// Action bar + print '
'; if ($action != 'edit' && $user->rights->opensurvey->write) { - //Modify button + // Modify button print ''.$langs->trans("Modify").''; if ($object->status == Opensurveysondage::STATUS_VALIDATED) { - //Close button + // Close button print ''.$langs->trans("Close").''; } if ($object->status == Opensurveysondage::STATUS_CLOSED) { - //Opened button + // Re-Open print ''.$langs->trans("ReOpen").''; } - //Delete button - print ''.$langs->trans('Delete').''; + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.urlencode($numsondage).'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } print '
'; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 5219897ed61..acf2f526773 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -540,10 +540,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.$langs->trans("Modify").'
'."\n"; } - if ($user->rights->stock->supprimer) - { - print '
'.$langs->trans('Delete').'
'."\n"; - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->stock->supprimer); */ } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index a308476ae50..17d5c042389 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1401,7 +1401,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Delete if ($user->rights->projet->supprimer || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) { if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) { - print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); + print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); } else { print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index ef00a85a0d4..77cd9f09c9e 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -674,14 +674,15 @@ if ($id > 0 || !empty($ref)) { } // Delete - if ($user->rights->projet->supprimer) { + $permissiontodelete = $user->hasRight('projet', 'supprimer'); + if ($permissiontodelete) { if (!$object->hasChildren() && !$object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', $permissiontodelete); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("TaskHasChild"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', 0); } } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', $permissiontodelete); } print '
'; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index cf4b4b8e110..1816528b854 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $result = restrictedArea($user, 'resource', $object->id, 'resource'); $permissiontoadd = $user->rights->resource->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php - +$permissiontodelete = $user->rights->resource->delete; /* @@ -349,12 +349,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { } } if ($action != "delete" && $action != "create" && $action != "edit") { - // Delete resource - if ($user->rights->resource->delete) { - print '
'; - print ''.$langs->trans('Delete').''; - print '
'; - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } } print ''; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 2d295a23131..c9f0a151901 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -251,9 +251,9 @@ print '
'; if ($action == '') { if ($user->rights->salaries->delete) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1); } else { - print ''.$langs->trans('Delete').''; + print dolGetButtonAction($langs->trans("CantRemovePaymentSalaryPaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0); } } } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index a75a194a0e8..b4e60cf0051 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -158,7 +158,7 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs'); } else { - setEventMessages($langs->trans('Delete'), null, 'errors'); + setEventMessages($langs->trans('RecordDeleted'), null, 'errors'); } $action = ''; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 49f0fc408ce..76c4784b013 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -2003,10 +2003,7 @@ if ($action == 'create') { } // Delete - if (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete) { - print '
'.$langs->trans('Delete').'
'; - } + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete); } } diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index f7536cc15b0..35e18a9cdbc 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -501,7 +501,7 @@ 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)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); } print '
'."\n"; } diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 39e6e10e3d7..a9fabffba3c 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -63,19 +63,22 @@ if (empty($action) && empty($id) && empty($ref)) { $action = 'view'; } +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. + // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); +if (empty($user->rights->websiteaccount->read)) { + accessforbidden('NotAllowed'); +} // Permissions $permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. - +$permissiontodelete = $user->rights->websiteaccount->delete; /* @@ -320,8 +323,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ - if ($user->rights->website->delete) { - print '
'.$langs->trans('Delete').'
'."\n"; + if ($permissiontodelete) { + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } } print ''."\n";