From 4bba3c0380c4662ff8c9b89acac57a0d3cc4c497 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Feb 2024 15:34:52 +0100 Subject: [PATCH] Bug 35329: Handle duplicate without 500 This is not perfect but way better than before! Signed-off-by: Jonathan Druart --- serials/routing.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/serials/routing.pl b/serials/routing.pl index acf88a7e8d..b8cd66e880 100755 --- a/serials/routing.pl +++ b/serials/routing.pl @@ -26,6 +26,7 @@ printed out =cut use Modern::Perl; +use Try::Tiny; use CGI qw ( -utf8 ); use C4::Koha; use C4::Auth qw( get_template_and_user ); @@ -68,7 +69,13 @@ if($op eq 'cud-delete'){ if ( $op eq 'cud-add_new_recipients' ) { for my $borrowernumber ( split ':', $borrowernumbers ) { - addroutingmember( $borrowernumber, $subscriptionid ); + try { + addroutingmember( $borrowernumber, $subscriptionid ); + } catch { + if ( $_ !~ m{Duplicate entry .* for key 'subscriptionid'} ) { + warn $_; + } + }; } } if($op eq 'cud-save'){ -- 2.39.5