From 17f4b05d23cb19cebeedb361005bf411a5f25c60 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Apr 2017 10:31:49 -0300 Subject: [PATCH] Bug 14932: Do not call can_edit_subscription with an empty value ref($sub) eq 'ARRAY' should always be true, what we want is to call can_edit_subscription if there is at least 1 serial for this subscription. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- C4/Serials.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 040fe61b7b..c1316f22e9 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -343,7 +343,7 @@ sub GetFullSubscription { my $sth = $dbh->prepare($query); $sth->execute($subscriptionid); my $subscriptions = $sth->fetchall_arrayref( {} ); - my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if ref($subscriptions) eq 'ARRAY'; + my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if scalar @$subscriptions; for my $subscription ( @$subscriptions ) { $subscription->{cannotedit} = $cannotedit; } @@ -503,7 +503,7 @@ sub GetFullSubscriptionsFromBiblionumber { my $sth = $dbh->prepare($query); $sth->execute($biblionumber); my $subscriptions = $sth->fetchall_arrayref( {} ); - my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if ref($subscriptions) eq 'ARRAY'; + my $cannotedit = not can_edit_subscription( $subscriptions->[0] ) if scalar @$subscriptions; for my $subscription ( @$subscriptions ) { $subscription->{cannotedit} = $cannotedit; } -- 2.39.5