Bug 28762: Move notforloan fallback into object

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2021-09-24 10:25:53 +01:00
parent 8ff4d3740e
commit 294447d07e
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
2 changed files with 15 additions and 3 deletions

View file

@ -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();

View file

@ -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 %]
<span class="item-status notforloan">[% notforloan_description | html %]</span>
[% ELSE %]