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 'control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas.'">'.$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/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php
index 3626eec4455..d01ac5a93e9 100644
--- a/htdocs/admin/bank_extrafields.php
+++ b/htdocs/admin/bank_extrafields.php
@@ -65,18 +65,21 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
-$textobject = $langs->transnoentitiesnoconv("Bank");
+$help_url = '';
+$page_name = "BankSetupModule";
llxHeader('', $langs->trans("BankSetupModule"), $help_url);
$linkback = ''.$langs->trans("BackToModuleList").'';
-print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup');
+print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bank_admin_prepare_head(null);
-print dol_get_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), -1, 'account');
+print dol_get_fiche_head($head, 'attributes', $langs->trans($page_name), -1, 'account');
+
+$textobject = $langs->transnoentitiesnoconv("Bank");
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
diff --git a/htdocs/admin/bankline_extrafields.php b/htdocs/admin/bankline_extrafields.php
index 06f1267343a..7e451275f8d 100644
--- a/htdocs/admin/bankline_extrafields.php
+++ b/htdocs/admin/bankline_extrafields.php
@@ -22,7 +22,7 @@
*/
/**
- * \file admin/bankline_extrafields.php
+ * \file htdocs/admin/bankline_extrafields.php
* \ingroup bank
* \brief Page to setup extra fields of bankline
*/
@@ -41,7 +41,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
-$type2label = [];
+$type2label = array();
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
@@ -80,6 +80,8 @@ $head = bank_admin_prepare_head(null);
print dol_get_fiche_head($head, 'bankline_extrafields', $langs->trans($page_name), -1, 'account');
+$textobject = $langs->transnoentitiesnoconv("BankTransaction");
+
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
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/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php
index 797bffa187a..d5258ba26f1 100644
--- a/htdocs/bookmarks/bookmarks.lib.php
+++ b/htdocs/bookmarks/bookmarks.lib.php
@@ -60,7 +60,7 @@ function printDropdownBookmarksList()
if ($sortorder) {
$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
}
- if (is_array($_POST)) {
+ if (!empty($_POST) && is_array($_POST)) {
foreach ($_POST as $key => $val) {
if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var))
&& $val != ''
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 'id.'&action=delete&token='.newToken().'"';
- 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 '
';
- }
+ // 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 'id.'&action=delete&token='.newToken().'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$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/conf/conf.php.example b/htdocs/conf/conf.php.example
index 05c29459ee2..1cc028ff137 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -409,7 +409,6 @@ $dolibarr_cron_allow_cli='0';
//#################################
// Value to overwrite path to use shared libraries instead of embedded one
-//$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$dolibarr_lib_TCPDF_PATH='/usr/share/php/tcpdf';
//$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
//$dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf';
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/contact/list.php b/htdocs/contact/list.php
index d165a0a4cc1..572bf85da3f 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -1222,7 +1222,7 @@ while ($i < min($num, $limit)) {
if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
- print ''.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).' | ';
+ print ''.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
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/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 8eb357a3908..7224949a70b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4345,7 +4345,7 @@ abstract class CommonObject
}
/**
- * Set status of an object
+ * Set status of an object.
*
* @param int $status Status to set
* @param int $elementId Id of element to force (use this->id by default if null)
diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php
index c6a6826251f..ed4b56be831 100644
--- a/htdocs/core/class/html.formwebsite.class.php
+++ b/htdocs/core/class/html.formwebsite.class.php
@@ -231,6 +231,8 @@ class FormWebsite
*/
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
{
+ global $conf, $langs;
+
$this->num = 0;
$atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
@@ -239,13 +241,18 @@ class FormWebsite
if ($atleastonepage && $action != 'editsource') {
$out .= '