From 409962251b598cf5233e8b2ef57e1dfe0d1b5ac1 Mon Sep 17 00:00:00 2001 From: raviks789 Date: Fri, 26 Jul 2024 14:48:48 +0200 Subject: [PATCH] Fix sync rule preview in case of boolean properties --- library/Director/Db/Branch/BranchedObject.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Director/Db/Branch/BranchedObject.php b/library/Director/Db/Branch/BranchedObject.php index 0f276c211..0a930d673 100644 --- a/library/Director/Db/Branch/BranchedObject.php +++ b/library/Director/Db/Branch/BranchedObject.php @@ -3,10 +3,12 @@ namespace Icinga\Module\Director\Db\Branch; use Icinga\Exception\NotFoundError; +use Icinga\Module\Director\Data\Db\DbDataFormatter; use Icinga\Module\Director\Data\Db\DbObject; use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry; use Icinga\Module\Director\Data\Json; use Icinga\Module\Director\Db; +use Icinga\Module\Director\Objects\IcingaObject; use Ramsey\Uuid\UuidInterface; use stdClass; @@ -198,7 +200,17 @@ public function applyActivity(BranchActivity $activity, Db $connection) } } + $dummyObject = IcingaObject::createByType( + $this->objectTable, + [], + $connection + ); + foreach ($activity->getModifiedProperties()->jsonSerialize() as $key => $value) { + if ($dummyObject->propertyIsBoolean($key)) { + $value = DbDataFormatter::normalizeBoolean($value); + } + $this->changes[$key] = $value; }