From c592b075f424af1795e49dcaa9eb900d67d7cf68 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 26 May 2023 12:58:22 +0000 Subject: [PATCH] Bug 33844: Fix is_denied_renewal Going via result_set->has_column does cost actually nothing if the object is already there. Test plan: Run again t/db_dependent/Koha/Item.t Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a215087a6af5852a76eea86246a76eb7d0741315) Signed-off-by: Pedro Amorim --- Koha/Item.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Item.pm b/Koha/Item.pm index d3cd8d4599..5e2e9f77a5 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2044,6 +2044,8 @@ sub is_denied_renewal { my $denyingrules = C4::Context->yaml_preference('ItemsDeniedRenewal'); return 0 unless $denyingrules; foreach my $field (keys %$denyingrules) { + # Silently ignore bad column names; TODO we should validate elsewhere + next if !$self->_result->result_source->has_column($field); my $val = $self->$field; if( !defined $val) { if ( any { !defined $_ } @{$denyingrules->{$field}} ){ -- 2.39.5