From db30b1d2de29363b9c9da9e973cd9ab8f5122432 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 13 Jun 2024 17:07:27 -0400 Subject: [PATCH] Fix multiple message --- src/ProcessMaker/Nayra/Bpmn/ActivityTrait.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ProcessMaker/Nayra/Bpmn/ActivityTrait.php b/src/ProcessMaker/Nayra/Bpmn/ActivityTrait.php index 162beee1..b6ee29c5 100755 --- a/src/ProcessMaker/Nayra/Bpmn/ActivityTrait.php +++ b/src/ProcessMaker/Nayra/Bpmn/ActivityTrait.php @@ -235,8 +235,14 @@ function ($transition, $tokens) { foreach ($tokens as $token) { foreach ($boundaryEvents as $boundaryEvent) { $caughtEventDefinition = $token->getProperty(TokenInterface::BPMN_PROPERTY_EVENT_DEFINITION_CAUGHT); + $caughtEventId = $token->getProperty(TokenInterface::BPMN_PROPERTY_EVENT_ID); foreach ($boundaryEvent->getEventDefinitions() as $eventDefinition) { - if ($caughtEventDefinition === $eventDefinition->getId()) { + $payload = $eventDefinition->getPayload(); + $eventDefinitionId = $payload ? $payload->getId() : null; + $hasPayloadId = !empty($caughtEventId) && !empty($eventDefinitionId); + $matchPayload = $hasPayloadId && ($caughtEventId === $eventDefinitionId); + $matchEventDefinition = !$hasPayloadId && ($caughtEventDefinition === $eventDefinition->getId()); + if ($matchEventDefinition || $matchPayload) { $boundaryEvent->notifyInternalEvent($token); break 3; }