From 294447d07e1a880e58dc28a458a1229dddf20767 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Sep 2021 10:25:53 +0100 Subject: [PATCH] Bug 28762: Move notforloan fallback into object Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- Koha/Item.pm | 13 +++++++++++++ .../intranet-tmpl/prog/en/includes/item-status.inc | 5 ++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 247fae7cde..12283c1bc2 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1835,6 +1835,19 @@ sub item_type { return shift->itemtype; } +=head3 not_for_loan + + my $nfl = $item->not_for_loan; + +Returns the effective not for loan status of the item + +=cut + +sub not_for_loan { + my ($self) = @_; + return $self->notforloan ? $self->notforloan : $self->itemtype->notforloan; +} + =head3 orders my $orders = $item->orders(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc index 11adad376f..75ce267927 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc @@ -43,10 +43,9 @@ [% END %] [% END %] -[% IF ( item.notforloan || item.effective_itemtype.notforloan ) %] +[% IF ( item.not_for_loan ) %] [% SET itemavailable = 0 %] - [% SET notforloan = item.notforloan || item.effective_itemtype.notforloan %] - [% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => notforloan ) %] + [% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.not_for_loan ) %] [% IF notforloan_description %] [% notforloan_description | html %] [% ELSE %] -- 2.39.5