diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index a872b6f79f..b45cf35308 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -43,13 +43,14 @@ [% INCLUDE 'members-toolbar.inc' %]

Circulation history

+[% SET all_checkouts = checkouts.merge(old_checkouts) %] [% UNLESS Koha.Preference('intranetreadinghistory') %]
Staff members are not allowed to access patron's checkout history
[% ELSIF is_anonymous %]
This is the anonymous patron, so no circulation history is displayed. To get a list of anonymized loans, please run a report.
[% ELSIF ( patron.privacy == 2) %]
This patron has set the privacy rules to never keeping a circulation history.
-[% ELSIF ( !loop_reading ) %] +[% ELSIF ( !all_checkouts.size ) %]
This patron has no circulation history.
[% ELSE %]
@@ -76,57 +77,56 @@ - [% FOREACH issue IN loop_reading %] - [% IF issue.returndate %][% ELSE %][% END %] + [% FOREACH checkout IN all_checkouts %] + [% SET item = checkout.item %] + [% SET biblio = item.biblio %] + [% IF checkout.returndate %][% ELSE %][% END %] - [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' | html %] + [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' | html %] [% ELSE %][% issuetype = 'standard_checkout' | html %] [% END %] [% issuetype | html %] - - [% issue.issuestimestamp | $KohaDates with_hours => 1 %] + + [% checkout.timestamp | $KohaDates with_hours => 1 %] - [% INCLUDE 'biblio-title.inc' biblio=issue link = 1 %] + [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %] - [% issue.author | html %] + [% biblio.author | html %] - [% IF issue.classification %] - [% issue.classification | html %] - [% ELSE %] - [% issue.itemcallnumber | html %] + [% item.itemcallnumber | html %] + + + + [% IF item.enumchron %] + [% item.enumchron | html %] [% END %] + [% item.barcode | html %] - [% IF issue.enumchron %] - [% issue.enumchron | html %] + [% checkout.renewals_count | html %] + [% IF checkout.renewals_count > 0 %] + [ View ] [% END %] - - [% issue.barcode | html %] - - [% issue.renewals_count | html %] - [% IF issue.renewals_count > 0 %] - [ View ] - [% END %] + + [% checkout.issuedate | $KohaDates with_hours => 1 %] - - [% issue.issuedate |$KohaDates with_hours => 1 %] - - [% Branches.GetName( issue.branchcode ) | html %] + [% Branches.GetName( checkout.branchcode ) | html %] [% IF Koha.Preference('RecordStaffUserOnCheckout') %] - [% issue.firstname | html %] [% issue.surname | html %] + [% SET issuer = checkout.issuer %] + [% issuer.firstname | html %] [% issuer.surname | html %] [% END %] - - [% issue.date_due | $KohaDates as_due_date => 1 %] + + [% checkout.date_due | $KohaDates as_due_date => 1 %] - [% IF issue.returndate %] - - [% issue.returndate |$KohaDates with_hours => 1 %] + [% IF checkout.returndate %] + + [% checkout.returndate | $KohaDates with_hours => 1 %] [% ELSE %] Checked out diff --git a/members/readingrec.pl b/members/readingrec.pl index 0dcdab25ce..08eff9f010 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -26,7 +26,6 @@ use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); -use C4::Members qw( GetAllIssues ); use List::MoreUtils qw( any uniq ); use Koha::DateUtils qw( dt_from_string ); use Koha::ActionLogs; @@ -79,26 +78,39 @@ if ( $op eq 'export_barcodes' ) { } } -my $order = 'date_due desc'; -my $limit = 0; -my $issues = (); # Do not request the old issues of anonymous patron if ( $patron->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 { - $issues = GetAllIssues($patron->borrowernumber,$order,$limit); -} - -if (! $limit){ - $limit = 'full'; + $template->param( + checkouts => [ + $patron->checkouts( + {}, + { + order_by => 'date_due desc', + prefetch => { item => { biblio => 'biblioitems' } }, + } + )->as_list + ] + ); + $template->param( + old_checkouts => [ + $patron->old_checkouts( + {}, + { + order_by => 'date_due desc', + prefetch => { item => { biblio => 'biblioitems' } }, + } + )->as_list + ] + ); } $template->param( patron => $patron, readingrecordview => 1, - loop_reading => $issues ); output_html_with_http_headers $input, $cookie, $template->output;