From 78cf8dd8eb3bcbb8299bba150d9eb3c134ef555f Mon Sep 17 00:00:00 2001 From: Jyhere Date: Fri, 17 Mar 2023 11:42:06 +0100 Subject: [PATCH] FIX : fatal error when margin enable (missing check on element), fix User::hasRight() when checking a margin right --- htdocs/core/class/html.formmargin.class.php | 2 +- htdocs/user/class/user.class.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index b59ea822731..9c02341a489 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -98,7 +98,7 @@ class FormMargin } $pv = $line->total_ht; - $pa_ht = (($pv < 0 || ($pv == 0 && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + $pa_ht = (($pv < 0 || ($pv == 0 && $object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1186cf7a914..0eded67a603 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -715,7 +715,8 @@ class User extends CommonObject 'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'position@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" - 'facturerec' => 'facture' + 'facturerec' => 'facture', + 'margins' => 'margin', ); if (!empty($moduletomoduletouse[$module])) {