From 23192630d4660983505eafbe55a3d6ae6ca828b5 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 21 Mar 2025 13:58:24 +0000 Subject: [PATCH] Bug 39408: Don't attempt to send a message if one is not generated The routine to create the message can return nothing if there is no content, we should handle this case and not attempt to send. To test: 1 - Test plan from last patch 2 - Apply this patch 3 - POST to patron API again 4 - Success! Signed-off-by: Claire Hernandez Signed-off-by: Martin Renvoize --- Koha/REST/V1/Patrons.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index 3ed1081d898..1fb35b59e1e 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -139,7 +139,9 @@ sub add { message_transport_type => 'email' } ); - SendQueuedMessages( { message_id => $message_id } ); + + # Don't send a message if we didn't generate one for some reason + SendQueuedMessages( { message_id => $message_id } ) if $message_id; } } } -- 2.49.0