From 12c0edc530fa8e8694119f00fc8900e272afe826 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 21 Sep 2023 18:25:15 +0200 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B06547=20-=20Fix=20flags=20init=20bein?= =?UTF-8?q?g=20an=20hard-coded=20int=20instead=20of=20the=20corresponding?= =?UTF-8?q?=20constant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php b/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php index dfc1522e3..a7f7b3b98 100644 --- a/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php +++ b/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php @@ -206,7 +206,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock */ private function InitIsAttEditable(): void { - $iFlags = 0; + $iFlags = OPT_ATT_NORMAL; if ($this->oDbObject->IsNew()) { From c5cb84f9769558a296bc15d3b66ed4ce5b4207b0 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 26 Sep 2023 10:55:48 +0200 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06733=20Fix=20some=20attributes=20imp?= =?UTF-8?q?l=20not=20prompted=20in=20transitions=20when=20mandatory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/attributedef.class.inc.php | 2 +- .../core/AttributeDefinitionTest.php | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index d9980100b..0d18a3e93 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -791,7 +791,7 @@ abstract class AttributeDefinition public function HasAValue($proposedValue): bool { // Default implementation, we don't really know what type $proposedValue will be - return is_null($proposedValue); + return !(is_null($proposedValue)); } /** diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php index ac5aff2a8..4c96e6e01 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php @@ -2,8 +2,10 @@ namespace Combodo\iTop\Test\UnitTest\Core; +use Change; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use MetaModel; +use UserRequest; class AttributeDefinitionTest extends ItopDataTestCase { const CREATE_TEST_ORG = true; @@ -55,6 +57,23 @@ class AttributeDefinitionTest extends ItopDataTestCase { { // Note: This is test is not great as we are datamodel dependent and don't have a class with all the attribute types return [ + 'AttributeDateTime' => [ + Change::class, + 'start_date', // no default value on this field + <<Set('start_date', '2023-09-06 12:26:00'); +PHP + , + false, + true, + ], + 'AttributeFrienlyName' => [ + UserRequest::class, + 'friendlyname', + '', + true, + true, + ], 'AttributeDashboard' => [ 'Organization', 'overview', @@ -158,9 +177,9 @@ PHP 'AttributeSubItem' => [ 'UserRequest', 'tto_escalation_deadline', - '', - true, - true, + '', // read-only attribute + false, + false, ], 'AttributeOneWayPassword' => [ 'UserLocal',