From 8e06efd098d1d541c54e5aa8b0a1ab242c87ea80 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 --- 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 22eaceac948..ca708468301 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1733,6 +1733,19 @@ sub itemtype { return Koha::ItemTypes->find( $self->effective_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 11adad376f3..75ce267927d 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.43.0