diff --git a/lib/Entity/DisplayEvent.php b/lib/Entity/DisplayEvent.php index 094bfc60dd..2c29000200 100644 --- a/lib/Entity/DisplayEvent.php +++ b/lib/Entity/DisplayEvent.php @@ -123,7 +123,7 @@ private function edit(): void * @param int $eventTypeId * @return void */ - public function eventEnd(int $displayId, int $eventTypeId = 1, ?int $date = null): void + public function eventEnd(int $displayId, int $eventTypeId = 1, string $detail = null, ?int $date = null): void { $this->getLog()->debug( sprintf( @@ -134,14 +134,15 @@ public function eventEnd(int $displayId, int $eventTypeId = 1, ?int $date = null ); $this->getStore()->update( - 'UPDATE `displayevent` SET `end` = :toDt + "UPDATE `displayevent` SET `end` = :toDt, `detail` = CONCAT_WS('. ', NULLIF(`detail`, ''), :detail) WHERE displayId = :displayId AND `end` IS NULL - AND eventTypeId = :eventTypeId', + AND eventTypeId = :eventTypeId", [ 'toDt' => $date ?? Carbon::now()->format('U'), 'displayId' => $displayId, 'eventTypeId' => $eventTypeId, + 'detail' => $detail, ] ); } @@ -154,7 +155,7 @@ public function eventEnd(int $displayId, int $eventTypeId = 1, ?int $date = null * @param int|null $date * @return void */ - public function eventEndByReference(int $displayId, int $eventTypeId, int $refId, ?int $date = null): void + public function eventEndByReference(int $displayId, int $eventTypeId, int $refId, string $detail = null, ?int $date = null): void { $this->getLog()->debug( sprintf( @@ -165,17 +166,21 @@ public function eventEndByReference(int $displayId, int $eventTypeId, int $refId ) ); + // When updating the event end, concatenate the end message to the current message $this->getStore()->update( - 'UPDATE `displayevent` SET `end` = :toDt + "UPDATE `displayevent` SET + `end` = :toDt, + `detail` = CONCAT_WS('. ', NULLIF(`detail`, ''), :detail) WHERE displayId = :displayId AND `end` IS NULL AND eventTypeId = :eventTypeId - AND refId = :refId', + AND refId = :refId", [ 'toDt' => $date ?? Carbon::now()->format('U'), 'displayId' => $displayId, 'eventTypeId' => $eventTypeId, 'refId' => $refId, + 'detail' => $detail, ] ); } diff --git a/lib/Xmds/Soap.php b/lib/Xmds/Soap.php index d84371f867..8c1f843abe 100644 --- a/lib/Xmds/Soap.php +++ b/lib/Xmds/Soap.php @@ -3201,8 +3201,8 @@ private function createDisplayAlert(\DomElement $alertNode) $displayEvent = $this->displayEventFactory->createEmpty(); $eventTypeId = $displayEvent->getEventIdFromString($eventType); empty($refId) - ? $displayEvent->eventEnd($this->display->displayId, $eventTypeId, $date) - : $displayEvent->eventEndByReference($this->display->displayId, $eventTypeId, $refId); + ? $displayEvent->eventEnd($this->display->displayId, $eventTypeId, $detail, $date) + : $displayEvent->eventEndByReference($this->display->displayId, $eventTypeId, $refId, $detail); } } }