From d12f10ea44f873b238d982f8ee22c49bd9855e2c Mon Sep 17 00:00:00 2001 From: Aleisha Date: Thu, 20 Aug 2015 03:34:48 +0000 Subject: [PATCH] [PASSED QA] 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 Works as advertised Signed-off-by: Katrin Fischer --- .../prog/en/modules/members/moremember-print.tt | 23 +++++++++++++ members/summary-print.pl | 38 +++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt index 92526e8..3c2fe04 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -67,6 +67,29 @@ [% END %] + [% IF ( reserves ) %] + + + + + + + + + + + [% FOREACH reserve IN reserves %] + + + + + + + + [% END %] +
Pending holds
TitleAuthorPlaced onExpires onPick up location
[% reserve.title %][% reserve.author %][% reserve.reservedate | $KohaDates %][% reserve.expirationdate | $KohaDates %][% reserve.waiting_at %]
+ [% END %] + [% IF ( accounts && ( totaldue != '0.00' ) ) %] diff --git a/members/summary-print.pl b/members/summary-print.pl index 7bed793..d2d3210 100755 --- a/members/summary-print.pl +++ b/members/summary-print.pl @@ -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; @@ -109,4 +118,31 @@ 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; } -- 1.9.1
Account fines and payments