From 55f56c09ddfac59967d21ad0a37e7c7686439642 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 13 Sep 2019 07:51:53 +0100 Subject: [PATCH] Bug 15497: (RM follow-up) Fix for new itemtype case When creating an entirely new itemtype the script would fail upon attempting to lookup existing itemtype branch limits. This patch adds a ternary to prevent the failure. Signed-off-by: Martin Renvoize --- admin/itemtypes.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 17ec3dc354..80b13c6888 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -59,7 +59,7 @@ undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$ if ( $op eq 'add_form' ) { my $itemtype = Koha::ItemTypes->find($itemtype_code); - my $selected_branches = $itemtype->get_library_limits; + my $selected_branches = $itemtype ? $itemtype->get_library_limits : undef; my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; my @branches_loop; foreach my $branch ( @$branches ) { -- 2.39.5