Skip to content

Commit 4bba3c0

Browse files
committed
Bug 35329: Handle duplicate without 500
This is not perfect but way better than before! Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
1 parent da5605c commit 4bba3c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

serials/routing.pl

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ =head1 Routing.pl
2626
=cut
2727

2828
use Modern::Perl;
29+
use Try::Tiny;
2930
use CGI qw ( -utf8 );
3031
use C4::Koha;
3132
use C4::Auth qw( get_template_and_user );
@@ -68,7 +69,13 @@ =head1 Routing.pl
6869

6970
if ( $op eq 'cud-add_new_recipients' ) {
7071
for my $borrowernumber ( split ':', $borrowernumbers ) {
71-
addroutingmember( $borrowernumber, $subscriptionid );
72+
try {
73+
addroutingmember( $borrowernumber, $subscriptionid );
74+
} catch {
75+
if ( $_ !~ m{Duplicate entry .* for key 'subscriptionid'} ) {
76+
warn $_;
77+
}
78+
};
7279
}
7380
}
7481
if($op eq 'cud-save'){

0 commit comments

Comments
 (0)