Bug 13918 - Add waiting expiration date to opac list of holds for user
Waiting holds for patrons in the opac should display the hold expiration date based on the max pickup delay if it is set. Test Plan: 1) Ensure ReservesMaxPickUpDelay is set 2) Place a hold on a record 3) Check in the item, use it to fill the hold 4) Log into the opac as that user 5) View the holds list, note the 'until <date>' addition to the waiting hold line. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
0aa6ba1599
commit
3ff76f3357
|
|
@ -21,6 +21,8 @@ use Modern::Perl;
|
|||
|
||||
use Carp;
|
||||
|
||||
use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode );
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
|
@ -35,6 +37,17 @@ Koha::Biblio - Koha Biblio Object class
|
|||
|
||||
=cut
|
||||
|
||||
=head3 subtitle
|
||||
|
||||
=cut
|
||||
|
||||
sub subtitle {
|
||||
my ( $self ) = @_;
|
||||
|
||||
return GetRecordValue( 'subtitle', GetMarcBiblio( $self->id() ), GetFrameworkCode( $self->id() ) );
|
||||
}
|
||||
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
|
|
|||
25
Koha/Hold.pm
25
Koha/Hold.pm
|
|
@ -105,6 +105,31 @@ sub is_in_transit {
|
|||
return $self->found() eq 'T';
|
||||
}
|
||||
|
||||
=head3 is_cancelable
|
||||
|
||||
Returns true if hold is a cancelable hold
|
||||
|
||||
=cut
|
||||
|
||||
sub is_cancelable {
|
||||
my ($self) = @_;
|
||||
|
||||
return ( $self->is_waiting() && !$self->is_found() )
|
||||
|| ( !$self->is_waiting() && !$self->is_in_transit() );
|
||||
}
|
||||
|
||||
=head3 is_at_destination
|
||||
|
||||
Returns true if hold is a in_transit hold
|
||||
|
||||
=cut
|
||||
|
||||
sub is_at_destination {
|
||||
my ($self) = @_;
|
||||
|
||||
return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() );
|
||||
}
|
||||
|
||||
=head3 biblio
|
||||
|
||||
Returns the related Koha::Biblio object for this hold
|
||||
|
|
|
|||
|
|
@ -521,9 +521,9 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH RESERVE IN RESERVES %]
|
||||
[% IF ( RESERVE.wait ) %]
|
||||
[% IF ( RESERVE.atdestination ) %]
|
||||
[% IF ( RESERVE.found ) %]
|
||||
[% IF ( RESERVE.is_waiting ) %]
|
||||
[% IF ( RESERVE.is_at_destination ) %]
|
||||
[% IF ( RESERVE.is_found ) %]
|
||||
<tr class="reserved">
|
||||
[% ELSE %]
|
||||
<tr>
|
||||
|
|
@ -536,13 +536,13 @@
|
|||
[% END %]
|
||||
<td class="title">
|
||||
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
|
||||
[% RESERVE.reserves_title %]
|
||||
[% FOREACH subtitl IN RESERVE.subtitle %]
|
||||
[% RESERVE.biblio.title %]
|
||||
[% FOREACH subtitl IN RESERVE.biblio.subtitle %]
|
||||
[% subtitl.subfield %]
|
||||
[% END %]
|
||||
[% RESERVE.enumchron %]
|
||||
[% RESERVE.item.enumchron %]
|
||||
</a>
|
||||
[% RESERVE.author %]
|
||||
[% RESERVE.biblio.author %]
|
||||
</td>
|
||||
<td class="reservedate">
|
||||
<span title="[% RESERVE.reservedate %]">
|
||||
|
|
@ -551,19 +551,23 @@
|
|||
</span>
|
||||
</td>
|
||||
<td class="expirationdate">
|
||||
[% IF ( RESERVE.expirationdate ) %]
|
||||
<span>
|
||||
[% IF ! RESERVE.found %]
|
||||
[% IF ( RESERVE.expirationdate ) %]
|
||||
<span>
|
||||
<span class="tdlabel">Expiration:</span>
|
||||
[% RESERVE.expirationdate | $KohaDates %]
|
||||
</span>
|
||||
[% ELSE %]
|
||||
<span class="tdlabel">Expiration:</span>
|
||||
[% RESERVE.expirationdate | $KohaDates %]
|
||||
</span>
|
||||
Never expires
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<span class="tdlabel">Expiration:</span>
|
||||
Never expires
|
||||
-
|
||||
[% END %]
|
||||
</td>
|
||||
<td class="branch">
|
||||
<span class="tdlabel">Pick up location:</span>
|
||||
[% RESERVE.branch %]
|
||||
[% RESERVE.branch.branchname %]
|
||||
</td>
|
||||
[% IF ( showpriority ) %]
|
||||
<td class="priority">
|
||||
|
|
@ -573,11 +577,17 @@
|
|||
[% END %]
|
||||
<td class="status">
|
||||
<span class="tdlabel">Status:</span>
|
||||
[% IF ( RESERVE.wait ) %]
|
||||
[% IF ( RESERVE.atdestination ) %]
|
||||
[% IF ( RESERVE.is_waiting ) %]
|
||||
[% IF ( RESERVE.is_at_destination ) %]
|
||||
[% IF ( RESERVE.found ) %]
|
||||
Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
|
||||
<input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
|
||||
Item waiting at <b> [% RESERVE.branch.branchname %]</b>
|
||||
[% IF ( RESERVE.waitingdate ) %]
|
||||
since [% RESERVE.waitingdate | $KohaDates %]
|
||||
[% IF RESERVE.waiting_expires_on %]
|
||||
until [% RESERVE.waiting_expires_on | $KohaDates %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
<input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
|
||||
[% ELSE %]
|
||||
Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
|
||||
[% END %]
|
||||
|
|
@ -585,7 +595,7 @@
|
|||
Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% IF ( RESERVE.intransit ) %]
|
||||
[% IF ( RESERVE.is_in_transit ) %]
|
||||
Item in transit from <b> [% RESERVE.frombranch %]</b> since
|
||||
[% RESERVE.datesent | $KohaDates %]
|
||||
[% ELSIF ( RESERVE.suspend ) %]
|
||||
|
|
@ -597,7 +607,7 @@
|
|||
</td>
|
||||
[% IF SuspendHoldsOpac %]
|
||||
<td>
|
||||
[% IF ( RESERVE.cancelable ) %]
|
||||
[% IF ( RESERVE.is_cancelable ) %]
|
||||
[% IF RESERVE.suspend %]
|
||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
|
|
@ -638,11 +648,11 @@
|
|||
</form>
|
||||
[% END # / IF AutoResumeSuspendedHolds %]
|
||||
[% END # / IF RESERVE.suspend %]
|
||||
[% END # / IF ( RESERVE.cancelable )%]
|
||||
[% END # / IF ( RESERVE.is_cancelable )%]
|
||||
</td>
|
||||
[% END # / IF SuspendHoldsOpac %]
|
||||
<td class="modify">
|
||||
[% IF ( RESERVE.cancelable ) %]
|
||||
[% IF ( RESERVE.is_cancelable ) %]
|
||||
<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
|
||||
<input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use C4::Letters;
|
|||
use C4::Branch; # GetBranches
|
||||
use Koha::DateUtils;
|
||||
use Koha::Borrower::Debarments qw(IsDebarred);
|
||||
use Koha::Holds;
|
||||
|
||||
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
|
||||
|
||||
|
|
@ -275,79 +276,14 @@ for my $branch_hash ( sort keys %{$branches} ) {
|
|||
$template->param( branchloop => \@branch_loop );
|
||||
|
||||
# now the reserved items....
|
||||
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
|
||||
foreach my $res (@reserves) {
|
||||
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
|
||||
|
||||
if ( $res->{'expirationdate'} eq '0000-00-00' ) {
|
||||
$res->{'expirationdate'} = '';
|
||||
}
|
||||
$res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'}));
|
||||
$res->{'waiting'} = 1 if $res->{'found'} eq 'W';
|
||||
$res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
|
||||
my $biblioData = GetBiblioData($res->{'biblionumber'});
|
||||
$res->{'reserves_title'} = $biblioData->{'title'};
|
||||
$res->{'author'} = $biblioData->{'author'};
|
||||
|
||||
if ($show_priority) {
|
||||
$res->{'priority'} ||= '';
|
||||
}
|
||||
if ( $res->{'suspend_until'} ) {
|
||||
$res->{'suspend_until'} = output_pref({ dt => dt_from_string( $res->{'suspend_until'} , 'iso' ), dateonly => 1 });
|
||||
}
|
||||
}
|
||||
|
||||
# use Data::Dumper;
|
||||
# warn Dumper(@reserves);
|
||||
|
||||
$template->param( RESERVES => \@reserves );
|
||||
$template->param( reserves_count => $#reserves+1 );
|
||||
$template->param( showpriority=>$show_priority );
|
||||
|
||||
my @waiting;
|
||||
my $wcount = 0;
|
||||
foreach my $res (@reserves) {
|
||||
if ( $res->{'itemnumber'} ) {
|
||||
my $item = GetItem( $res->{'itemnumber'});
|
||||
$res->{'holdingbranch'} =
|
||||
$branches->{ $item->{'holdingbranch'} }->{'branchname'};
|
||||
$res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
|
||||
$res->{'enumchron'} = $item->{'enumchron'} if $item->{'enumchron'};
|
||||
# get document reserve status
|
||||
my $biblioData = GetBiblioData($res->{'biblionumber'});
|
||||
$res->{'waiting_title'} = $biblioData->{'title'};
|
||||
if ( ( $res->{'found'} eq 'W' ) ) {
|
||||
my $item = $res->{'itemnumber'};
|
||||
$item = GetBiblioFromItemNumber($item,undef);
|
||||
$res->{'wait'}= 1;
|
||||
$res->{'holdingbranch'}=$item->{'holdingbranch'};
|
||||
$res->{'biblionumber'}=$item->{'biblionumber'};
|
||||
$res->{'barcode'} = $item->{'barcode'};
|
||||
$res->{'wbrcode'} = $res->{'branchcode'};
|
||||
$res->{'itemnumber'} = $res->{'itemnumber'};
|
||||
$res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
|
||||
if($res->{'holdingbranch'} eq $res->{'wbrcode'}){
|
||||
$res->{'atdestination'} = 1;
|
||||
}
|
||||
# set found to 1 if reserve is waiting for patron pickup
|
||||
$res->{'found'} = 1 if $res->{'found'} eq 'W';
|
||||
} else {
|
||||
my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
|
||||
if ($transfertwhen) {
|
||||
$res->{intransit} = 1;
|
||||
$res->{datesent} = $transfertwhen;
|
||||
$res->{frombranch} = GetBranchName($transfertfrom);
|
||||
}
|
||||
}
|
||||
push @waiting, $res;
|
||||
$wcount++;
|
||||
}
|
||||
# can be cancelled
|
||||
#$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
|
||||
$res->{'cancelable'} = 1 if ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
|
||||
|
||||
}
|
||||
|
||||
$template->param( WAITING => \@waiting );
|
||||
$template->param(
|
||||
RESERVES => $reserves,
|
||||
reserves_count => $reserves->count(),
|
||||
showpriority => $show_priority,
|
||||
WAITING => $reserves->waiting()
|
||||
);
|
||||
|
||||
# current alert subscriptions
|
||||
my $alerts = getalert($borrowernumber);
|
||||
|
|
|
|||
Loading…
Reference in New Issue