diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt index 631880c53e..779d82fcde 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt @@ -47,74 +47,60 @@
Staff members are not allowed to access patron's holds history
[% ELSIF is_anonymous %]
This is the anonymous patron, so no holds history is displayed.
- [% ELSIF ( !holds ) %] -
This patron has no holds history.
[% ELSE %] [% SET show_itemtype_column = Koha.Preference('AllowHoldItemTypeSelection') %]
- - - - - - - - - - - - - [% IF show_itemtype_column %] - - [% END %] - - - - - [% FOREACH hold IN holds %] +

Current holds

+ [% IF patron.holds.count %] +
TitleAuthorBarcodeCall numberLibraryHold dateExpiration dateWaiting dateCancellation dateRequested item typeStatus
+ - - - - - - - - - + + + + + + + + + [% IF show_itemtype_column %] - + [% END %] - + - [% END %] - -
[% INCLUDE 'biblio-title.inc' biblio=hold.biblio link = 1 %][% hold.biblio.author | html %][% hold.item.barcode | html %][% hold.item.itemcallnumber | html %][% Branches.GetName( hold.branchcode ) | html %][% hold.reservedate | $KohaDates %] [% hold.expirationdate | $KohaDates %] [% hold.waitingdate | $KohaDates %] [% hold.cancellationdate | $KohaDates %] TitleAuthorBarcodeCall numberLibraryHold dateExpiration dateWaiting dateCancellation date - [% IF hold.itemtype %] - [% ItemTypes.GetDescription( hold.itemtype ) | html %] - [% ELSE %] - Any item type - [% END %] - Requested item type - [% IF hold.found == 'F' %] - Fulfilled - [% ELSIF hold.cancellationdate %] - Cancelled - [% IF hold.cancellation_reason %] - ([% AuthorisedValues.GetByCode('HOLD_CANCELLATION', hold.cancellation_reason) | html %]) - [% END %] - [% ELSIF hold.found == 'W' %] - Waiting - [% ELSIF hold.found == 'P' %] - Processing - [% ELSIF hold.found == 'T' %] - In transit - [% ELSE %] - Pending - [% END %] - Status
+ + + [% ELSE %] +
This patron has no current holds.
+ [% END %] + +

Historical holds

+ [% IF patron.old_holds.count %] + + + + + + + + + + + + + [% IF show_itemtype_column %] + + [% END %] + + + +
TitleAuthorBarcodeCall numberLibraryHold dateExpiration dateWaiting dateCancellation dateRequested item typeStatus
+ [% ELSE %] +
This patron has no historical holds.
+ [% END %]
[% END %] [% END %] @@ -123,6 +109,7 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %] + [% INCLUDE 'js-biblio-format.inc' %] [% END %] diff --git a/members/holdshistory.pl b/members/holdshistory.pl index 538614ac34..9980542f0e 100755 --- a/members/holdshistory.pl +++ b/members/holdshistory.pl @@ -26,10 +26,6 @@ use Koha::Patrons; my $input = CGI->new; -my $borrowernumber; -my $cardnumber; -my @all_holds; - my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "members/holdshistory.tt", @@ -39,47 +35,25 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $patron; - -if ( $input->param('cardnumber') ) { - $cardnumber = $input->param('cardnumber'); - $patron = Koha::Patrons->find( { cardnumber => $cardnumber } ); -} -if ( $input->param('borrowernumber') ) { - $borrowernumber = $input->param('borrowernumber'); - $patron = Koha::Patrons->find($borrowernumber); -} +my $cardnumber = $input->param('cardnumber'); +my $borrowernumber = $input->param('borrowernumber'); +my $patron = Koha::Patrons->find( $cardnumber ? { cardnumber => $cardnumber } : $borrowernumber ); unless ($patron) { print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); exit; } -my $holds; -my $old_holds; - if ( $borrowernumber eq C4::Context->preference('AnonymousPatron') ) { # use of 'eq' in the above comparison is intentional -- the # system preference value could be blank $template->param( is_anonymous => 1 ); -} else { - $holds = $patron->holds; - $old_holds = $patron->old_holds; - - while ( my $hold = $holds->next ) { - push @all_holds, $hold; - } - - while ( my $hold = $old_holds->next ) { - push @all_holds, $hold; - } } $template->param( holdshistoryview => 1, patron => $patron, - holds => \@all_holds, ); output_html_with_http_headers $input, $cookie, $template->output;