From d46f180b2e4e6da7732fdc561e710fb0b9e18ea6 Mon Sep 17 00:00:00 2001 From: Aleisha Date: Thu, 20 Aug 2015 03:34:48 +0000 Subject: [PATCH] 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 Signed-off-by: Jesse Weaver --- .../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 92526e8a9a..3c2fe0463f 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 7bed793d5f..d2d3210b29 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; @@ -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; } -- 2.20.1
Account fines and payments