diff --git a/application/controllers/BranchController.php b/application/controllers/BranchController.php index cdbab3a80..3b36e83b5 100644 --- a/application/controllers/BranchController.php +++ b/application/controllers/BranchController.php @@ -72,7 +72,8 @@ protected function leftFromActivity(BranchActivity $activity) return null; } $object = DbObjectTypeRegistry::newObject($activity->getObjectTable(), [], $this->db()); - foreach ($activity->getFormerProperties()->jsonSerialize() as $key => $value) { + $properties = $this->objectTypeFirst($activity->getFormerProperties()->jsonSerialize()); + foreach ($properties as $key => $value) { $object->set($key, $value); } @@ -90,13 +91,26 @@ protected function rightFromActivity(BranchActivity $activity) $object->set($key, $value); } } - foreach ($activity->getModifiedProperties()->jsonSerialize() as $key => $value) { + $properties = $this->objectTypeFirst($activity->getModifiedProperties()->jsonSerialize()); + foreach ($properties as $key => $value) { $object->set($key, $value); } return $object; } + protected function objectTypeFirst($properties) + { + $properties = (array) $properties; + if (isset($properties['object_type'])) { + $type = $properties['object_type']; + unset($properties['object_type']); + $properties = ['object_type' => $type] + $properties; + } + + return $properties; + } + protected function showActivity(BranchActivity $activity) { $left = $this->leftFromActivity($activity); diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index c70b55ed7..686afaf3c 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -18,6 +18,7 @@ v1.10.2 (unreleased) ### Import and Sync * FIX: triggering Sync manually produced an error on PostgreSQL (#2636) * FIX: purge stopped working for objects with uppercase characters (#2627) +* FIX: Notification Apply rule is now possible (wasn't since v1.8) (#2142, #2634) ### Configuration Baskets * FEATURE: more details shown in error messages related to invalid characters (#2646)