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/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()) { 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',