@@ -, +, @@ --- Koha/Item.pm | 21 +++++++++++++++++++ .../en/includes/item-status-schema-org.inc | 2 +- .../bootstrap/en/includes/item-status.inc | 9 ++++---- .../bootstrap/en/modules/opac-detail.tt | 2 +- opac/opac-detail.pl | 12 +---------- t/db_dependent/Koha/Item.t | 5 ++++- 6 files changed, 33 insertions(+), 18 deletions(-) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -44,6 +44,7 @@ use Koha::ItemTypes; use Koha::Libraries; use Koha::Patrons; use Koha::Plugins; +use Koha::Recalls; use Koha::Result::Boolean; use Koha::SearchEngine::Indexer; use Koha::StockRotationItem; @@ -925,6 +926,26 @@ sub has_pending_hold { return $pending_hold->count ? 1: 0; } +=head3 has_pending_recall { + + my $has_pending_recall + +Return if whether has pending recall of not. + +=cut + +sub has_pending_recall { + my ( $self ) = @_; + + # FIXME Must be moved to $self->recalls + return Koha::Recalls->search( + { + item_id => $self->itemnumber, + status => 'waiting', + } + )->count; +} + =head3 as_marc_field my $field = $item->as_marc_field; --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc @@ -1,4 +1,4 @@ -[% IF ( item.damaged or item.datedue or item.itemlost or item.transfertwhen or item.waiting ) %] +[% IF ( item.damaged or item.checkout.date_due or item.itemlost or item.transfertwhen or item.waiting ) %] [% ELSIF ( item.withdrawn ) %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -18,8 +18,8 @@ [% END %] [% IF item.isa('Koha::Item') %] - [% SET datedue = issue.date_due %] - [% SET onsite_checkout = issue.onsite_checkout %] + [% SET datedue = item.checkout.date_due %] + [% SET onsite_checkout = item.checkout.onsite_checkout %] [% ELSE %] [% SET datedue = item.datedue || issue.date_due %] [% SET onsite_checkout = item.onsite_checkout %] @@ -39,7 +39,8 @@ Checked out [% END %] [% END %] - [% IF item.avail_for_recall %]Recall[% END %] + [%# FIXME We should move avail_for_recall to a Koha::Item method %] + [% IF !item.isa('Koha::Item') AND item.avail_for_recall %]Recall[% END %] [% END %] [% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %] @@ -100,7 +101,7 @@ Pending hold [% END %] -[% IF item.has_pending_recall %] +[% IF Koha.Preference('UseRecalls') && item.has_pending_recall %] [% SET itemavailable = 0 %] Pending recall [% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1342,7 +1342,7 @@ [% END # /IF itemdata_uri %] [% IF ( itemdata_copynumber ) %]