From 5be386d03ea0e775d1aa917a5488a930e994c658 Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Fri, 8 Mar 2024 17:03:51 +0100 Subject: [PATCH 1/5] =?UTF-8?q?N=C2=B04894=20-=20Improve=20AttributeDecima?= =?UTF-8?q?l=20validation=20during=20CSV=20import=20(#248)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update AttributeDecimal validation pattern * Update phpdoc Co-authored-by: Molkobain * Reduce unneeded sprintf flags --------- Co-authored-by: Molkobain --- core/attributedef.class.inc.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 77d679f74..0a5af24a8 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -3201,9 +3201,19 @@ class AttributeDecimal extends AttributeDBField { $iNbDigits = $this->Get('digits'); $iPrecision = $this->Get('decimals'); - $iNbIntegerDigits = $iNbDigits - $iPrecision - 1; // -1 because the first digit is treated separately in the pattern below + $iNbIntegerDigits = $iNbDigits - $iPrecision; - return "^[\-\+]?[0-9]\d{0,$iNbIntegerDigits}(\.\d{0,$iPrecision})?$"; + return "^[\-\+]?\d{1,$iNbIntegerDigits}(\.\d{0,$iPrecision})?$"; + } + + /** + * @inheritDoc + * @since 3.2.0 + */ + public function CheckFormat($value) + { + $sRegExp = $this->GetValidationPattern(); + return preg_match("/$sRegExp/", $value); } public function GetBasicFilterOperators() @@ -3298,7 +3308,7 @@ class AttributeDecimal extends AttributeDBField if (!is_null($value) && ($value !== '')) { - $value = sprintf("%01.".$this->Get('decimals')."F", $value); + $value = sprintf("%1.".$this->Get('decimals')."F", $value); } return $value; // null or string } From 0c3e839381fb70ad7856576de4fc1da17278dfa2 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 8 Mar 2024 17:17:50 +0100 Subject: [PATCH 2/5] =?UTF-8?q?N=C2=B07303=20-=20Fix=20failure=20to=20add?= =?UTF-8?q?=20attachment=20in=20portal=20due=20to=20regression=20from=20e8?= =?UTF-8?q?30c903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml index 6e0acee09..ea60cee98 100755 --- a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml +++ b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml @@ -115,7 +115,7 @@ $this->SetIfNull('user_id', $iUserId); // Get Contact from user - $oUser = MetaModel::GetObject('User', $iUserId); + $oUser = MetaModel::GetObject('User', $iUserId, true, true); $this->SetIfNull('contact_id', $oUser->Get('contactid')); } return parent::DBInsertNoReload(); From 5e4f76bde9dfa6f7890e6087ac708db0fb0c8e72 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Mon, 11 Mar 2024 09:22:31 +0100 Subject: [PATCH 3/5] =?UTF-8?q?N=C2=B02039=20-=20Fix=20button=20margins=20?= =?UTF-8?q?in=20view=20all=20notifications=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/backoffice/pages/_notifications.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/css/backoffice/pages/_notifications.scss b/css/backoffice/pages/_notifications.scss index a968bcec1..1f79e3fd0 100644 --- a/css/backoffice/pages/_notifications.scss +++ b/css/backoffice/pages/_notifications.scss @@ -57,8 +57,10 @@ $ibo-notifications--view-all--empty--svg--max-width: 30% !default; background-color: $ibo-notifications--view-all--item--unread--highlight--background-color; } -.ibo-notifications--view-all--read-action, .ibo-notifications--view-all--unread-action { - margin-left: 0 !important; +.ibo-content-block ibo-block ibo-notifications--view-all--container { + .ibo-notifications--view-all--read-action, .ibo-notifications--view-all--unread-action { + margin-left: 0 !important; + } } .ibo-notifications--view-all--item--read .ibo-notifications--view-all--read-action { From 0176905c2027bb05e0b66559ec439e806d32231e Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Mon, 11 Mar 2024 10:09:21 +0100 Subject: [PATCH 4/5] =?UTF-8?q?N=C2=B02039=20-=20Fix=20button=20margins=20?= =?UTF-8?q?in=20view=20all=20notifications=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/backoffice/pages/_notifications.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/backoffice/pages/_notifications.scss b/css/backoffice/pages/_notifications.scss index 1f79e3fd0..1a0cc9753 100644 --- a/css/backoffice/pages/_notifications.scss +++ b/css/backoffice/pages/_notifications.scss @@ -57,7 +57,7 @@ $ibo-notifications--view-all--empty--svg--max-width: 30% !default; background-color: $ibo-notifications--view-all--item--unread--highlight--background-color; } -.ibo-content-block ibo-block ibo-notifications--view-all--container { +.ibo-notifications--view-all--container { .ibo-notifications--view-all--read-action, .ibo-notifications--view-all--unread-action { margin-left: 0 !important; } From af2c6d9ab80603e490a0ea4e1bd7d53b306d26e9 Mon Sep 17 00:00:00 2001 From: Benjamin Dalsass <95754414+bdalsass@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:03:38 +0100 Subject: [PATCH 5/5] =?UTF-8?q?N=C2=B07279=20-=20AttributeClass=20defined?= =?UTF-8?q?=20in=20XML=20datamodel=20compilation=20issue=20-=20make=20more?= =?UTF-8?q?=5Fvalues=20property=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/compiler.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 26ce295c4..adb59303e 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -2258,7 +2258,7 @@ EOF $this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, ''); $this->CompileCommonProperty('allowed_values', $oField, $aParameters, $sModuleRelativeDir); $aParameters['class_category'] = $this->GetPropString($oField, 'class_category'); - $aParameters['more_values'] = $this->GetPropString($oField, 'more_values'); + $aParameters['more_values'] = $this->GetPropString($oField, 'more_values', ''); $aParameters['depends_on'] = $sDependencies; }else { $this->CompileCommonProperty('sql', $oField, $aParameters, $sModuleRelativeDir);