Bug 10468: Adding holds table to summary print

To test:
1) Add a hold to a patron
2) Go to patron page
3) Click Print Summary
4) Confirm that 'Pending Holds' table displays with correct information under appropriate headings (should be Title, Author, Placed on (reserve date), Expires on (expiration date), and Pick up library)

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
This commit is contained in:
Aleisha 2015-08-20 03:34:48 +00:00 committed by Jesse Weaver
parent 265761c353
commit d46f180b2e
2 changed files with 60 additions and 1 deletions

View File

@ -67,6 +67,29 @@
</table>
[% END %]
[% IF ( reserves ) %]
<table>
<caption>Pending holds</caption>
<tr>
<th>Title</th>
<th>Author</th>
<th>Placed on</th>
<th>Expires on</th>
<th>Pick up location</th>
</tr>
[% FOREACH reserve IN reserves %]
<tr>
<td>[% reserve.title %]</td>
<td>[% reserve.author %]</td>
<td>[% reserve.reservedate | $KohaDates %]</td>
<td>[% reserve.expirationdate | $KohaDates %]</td>
<td>[% reserve.waiting_at %]</td>
</tr>
[% END %]
</table>
[% END %]
[% IF ( accounts && ( totaldue != '0.00' ) ) %]
<table>
<caption>Account fines and payments</caption>

View File

@ -24,6 +24,9 @@ use C4::Output;
use C4::Members;
use C4::Koha qw( getitemtypeinfo );
use C4::Circulation qw( GetIssuingCharges );
use C4::Reserves;
use C4::Items;
use Koha::Holds;
my $input = CGI->new;
my $borrowernumber = $input->param('borrowernumber');
@ -56,13 +59,17 @@ foreach my $accountline (@$accts) {
}
my $roadtype =
C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} );
C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ) // '';
$roadtype = '' if ( ! $roadtype );
our $totalprice = 0;
my $total_format = '';
$total_format = sprintf( "%.2f", $total ) if ($total);
my $holds_rs = Koha::Holds->search(
{ borrowernumber => $borrowernumber },
);
$template->param(
%$data,
@ -74,6 +81,8 @@ $template->param(
issues => build_issue_data( GetPendingIssues($borrowernumber) ),
totalprice => $totalprice,
reserves => build_reserve_data( $holds_rs ),
);
output_html_with_http_headers $input, $cookie, $template->output;
@ -108,5 +117,32 @@ sub build_issue_data {
@{$return} = sort { $a->{date_due} eq $b->{date_due} } @{$return};
return $return;
}
sub build_reserve_data {
my $reserves = shift;
my $return = [];
my $today = DateTime->now( time_zone => C4::Context->tz );
$today->truncate( to => 'day' );
while ( my $reserve = $reserves->next() ) {
my $row = {
title => $reserve->biblio()->title(),
author => $reserve->biblio()->author(),
reservedate => $reserve->reservedate(),
expirationdate => $reserve->expirationdate(),
waiting_at => $reserve->branch()->branchname(),
};
push( @{$return}, $row );
}
@{$return} = sort { $a->{reservedate} <=> $b->{reservedate} } @{$return};
return $return;
}