From 5879968e600a6ed74a48e89cf8fda63f55013bb1 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 23 Sep 2025 18:15:40 +0200 Subject: [PATCH 1/2] Clean code --- htdocs/core/class/doleditor.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 800471ad2a6..adb474cb416 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -207,7 +207,10 @@ class DolEditor $fullpage = false; - $extraAllowedContent = 'a[target];section[contenteditable,id];div{background-color,color,display,float,height,margin,margin-top,margin-bottom,padding,width,border-top-left-radius,border-top-right-radius,border-bottom-left-radius,border-bottom-right-radius,box-shadow}'; + $extraAllowedContent = 'a[target];'; + $extraAllowedContent .= 'section[contenteditable,id];'; + $extraAllowedContent .= 'div{background-color,color,display,float,height,margin,margin-top,margin-bottom,padding,width,border-top-left-radius,border-top-right-radius,border-bottom-left-radius,border-bottom-right-radius,box-shadow}'; + if (is_string($restrictContent)) { $extraAllowedContent = $restrictContent; } From 35f6a986659f50928b4ddc9a65f142fa76ec16e0 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 23 Sep 2025 22:00:54 +0200 Subject: [PATCH 2/2] Fix CI --- htdocs/accountancy/admin/accountmodel.php | 6 +++--- htdocs/compta/facture/card.php | 5 ++--- htdocs/holiday/card.php | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 35ab8395132..fc2ee51e986 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -302,7 +302,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } } -if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart) { // delete +if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart) { // @phpstan-ignore-line if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { @@ -323,7 +323,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart) } // activate -if ($action == 'activate' && $permissiontoeditchart) { +if ($action == 'activate' && $permissiontoeditchart) { // @phpstan-ignore-line $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE rowid = ".((int) $rowid); $result = $db->query($sql); if (!$result) { @@ -332,7 +332,7 @@ if ($action == 'activate' && $permissiontoeditchart) { } // disable -if ($action == $acts[1] && $permissiontoeditchart) { +if ($action == $acts[1] && $permissiontoeditchart) { // @phpstan-ignore-line $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE rowid = ".((int) $rowid); $result = $db->query($sql); if (!$result) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 71244fd33f2..c05eeb4996b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -167,7 +167,7 @@ $usercancreatecontract = $user->hasRight("contrat", "creer"); // Advanced Permissions $usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'validate'))); -$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'send'))); +$usercansend = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercanread) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'send'))); $usercanreopen = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('facture', 'invoice_advance', 'reopen'))); if (getDolGlobalString('INVOICE_DISALLOW_REOPEN')) { $usercanreopen = false; @@ -311,8 +311,7 @@ if (empty($reshook)) { $isErasable = $object->is_erasable(); - if (($usercandelete && $isErasable > 0) - || ($usercancreate && $isErasable == 1)) { + if (($isErasable > 0) || ($usercancreate && $isErasable == 1)) { $result = $object->delete($user, 0, (int) $idwarehouse); if ($result > 0) { header('Location: '.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index e8da4db587f..f9756097d93 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -622,7 +622,7 @@ if (empty($reshook)) { $object->fetch($id); // If status is waiting approval and approver is also user - if ($object->status == Holiday::STATUS_VALIDATED && ($user->id == $object->fk_validator || $permissiontoaddall) && $permissiontoapprove) { + if ($object->status == Holiday::STATUS_VALIDATED && ($user->id == $object->fk_validator || $permissiontoaddall)) { $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty $object->date_approval = dol_now(); @@ -731,7 +731,7 @@ if (empty($reshook)) { $object->fetch($id); // If status pending validation and validator = user - if ($object->status == Holiday::STATUS_VALIDATED && ($user->id == $object->fk_validator || $permissiontoaddall) && $permissiontoapprove) { + if ($object->status == Holiday::STATUS_VALIDATED && ($user->id == $object->fk_validator || $permissiontoaddall)) { $object->date_refuse = dol_now(); $object->fk_user_refuse = $user->id; $object->statut = Holiday::STATUS_REFUSED; @@ -1625,7 +1625,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } if ($object->status == Holiday::STATUS_APPROVED) { // If validated and approved if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $permissiontoadd || $permissiontoaddall || $permissiontoapprove) { - if (($object->date_fin > dol_now()) || $permissiontoapprove || $user->id == $object->fk_user_approve) { + if ((($object->date_fin > dol_now()) && $permissiontoapprove) || $user->id == $object->fk_user_approve) { print ''.$langs->trans("ActionCancelCP").''; } else { if ($object->date_fin <= dol_now() && $permissiontoapprove) {