From 8fa48bc9c9a3a2bd150bd3844bf79df596d1650c Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 28 Sep 2018 02:23:58 +0000 Subject: [PATCH] Bug 19532: Stop item status='Available' for waiting recalls This patch alters the display of the item status in the staff client and OPAC so items which are waiting recalls are not shown in these interfaces with the status of 'available'. Waiting recalls are not available they are only available to the patron who recalled them. Sponsored-By: Toi Ohomai Institute of Technology, New Zealand --- C4/Search.pm | 12 +++++++++++- C4/XSLT.pm | 3 ++- opac/opac-detail.pl | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 46fafcd..cd46b92 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2146,6 +2146,9 @@ sub searchResults { # is item on the reserve shelf? my $reservestatus = ''; + # is item a waiting recall? + my $recallstatus = ''; + unless ($item->{withdrawn} || $item->{itemlost} || $item->{damaged} @@ -2167,6 +2170,7 @@ sub searchResults { # ($transfertwhen, $transfertfrom, $transfertto) = C4::Circulation::GetTransfers($item->{itemnumber}); $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); + $recallstatus = Koha::Recalls->find({ itemnumber => $itemnumber->{itemnumber}, status => 'W' }); } # item is withdrawn, lost, damaged, not for loan, reserved or in transit @@ -2175,13 +2179,14 @@ sub searchResults { || $item->{damaged} || $item->{notforloan} || $reservestatus eq 'Waiting' + || (defined $recallstatus) || ($transfertwhen ne '')) { $withdrawn_count++ if $item->{withdrawn}; $itemlost_count++ if $item->{itemlost}; $itemdamaged_count++ if $item->{damaged}; $item_in_transit_count++ if $transfertwhen ne ''; - $item_onhold_count++ if $reservestatus eq 'Waiting'; + $item_onhold_count++ if (($reservestatus eq 'Waiting') || (defined $recallstatus)); $item->{status} = $item->{withdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; # can place a hold on a item if @@ -2204,6 +2209,11 @@ sub searchResults { } $other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; $other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; + if (defined $recallstatus) { + $recallstatus = 'W'; + } + $other_items->{$key}->{onhold} = ($recallstatus) ? 1 : 0; + $other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan}; $other_items->{$key}->{count}++ if $item->{$hbranch}; $other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; diff --git a/C4/XSLT.pm b/C4/XSLT.pm index bf2647a..c540b3d 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -291,6 +291,7 @@ sub buildKohaItemsNamespace { my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); + my $recallstatus = Koha::Recalls->find({ itemnumber => $item->{itemnumber}, status => 'W'}); if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} || (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ @@ -315,7 +316,7 @@ sub buildKohaItemsNamespace { if (defined $transfertwhen && $transfertwhen ne '') { $status = 'In transit'; } - if (defined $reservestatus && $reservestatus eq "Waiting") { + if ((defined $reservestatus && $reservestatus eq "Waiting") || (defined $recallstatus)) { $status = 'Waiting'; } } else { diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 3d300b4..082f5d4 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -694,7 +694,8 @@ if ( not $viewallitems and @items > $max_items_to_display ) { } my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); - if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; } + my $waiting_recall_status = Koha::Recalls->find({ itemnumber => $itm->{itemnumber}, status => 'W' }); + if( $reserve_status eq "Waiting" || defined($waiting_recall_status) ){ $itm->{'waiting'} = 1; } if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; } my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); -- 2.1.4