From 7387d77b2023eb848453a46cd356ae6cb03d04c2 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! --- serials/routing.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/serials/routing.pl b/serials/routing.pl index acf88a7e8dc..b8cd66e8800 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.34.1