Bugzilla – Attachment 152154 Details for
Bug 33948
Replace GetAllIssues with Koha::Checkouts - staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33948: Replace GetAllIssues with Koha::Checkouts - staff
Bug-33948-Replace-GetAllIssues-with-KohaCheckouts-.patch (text/plain), 9.78 KB, created by
Jonathan Druart
on 2023-06-08 11:02:15 UTC
(
hide
)
Description:
Bug 33948: Replace GetAllIssues with Koha::Checkouts - staff
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-06-08 11:02:15 UTC
Size:
9.78 KB
patch
obsolete
>From 9ea52798e12d420fced0ed65df651f9df91037ad Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 8 Jun 2023 09:36:35 +0200 >Subject: [PATCH] Bug 33948: Replace GetAllIssues with Koha::Checkouts - staff > >This patch replace GetAllIssues in readingrec.pl which is the only >occurrence in the staff code. > >To test this patch you will need several items in your checkout history >in order to confirm that the display is the same before and after the >patch. > >However there is one change! And it's a bug fix (or an enhancement, it >depends on how you see things). It includes checkouts with deleted items, which is >a long standing bug (see bug 8483). > >Performance will be compared as well. >--- > .../prog/en/modules/members/readingrec.tt | 56 +++++++++---------- > members/readingrec.pl | 32 +++++++---- > 2 files changed, 50 insertions(+), 38 deletions(-) > >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 ec4c5dfdb98..6073b2bb578 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -38,13 +38,14 @@ > [% INCLUDE 'members-toolbar.inc' %] > <h1>Circulation history</h1> > >+[% SET all_checkouts = checkouts.merge(old_checkouts) %] > [% UNLESS Koha.Preference('intranetreadinghistory') %] > <div class="dialog alert">Staff members are not allowed to access patron's checkout history</div> > [% ELSIF is_anonymous %] > <div class="dialog alert">This is the anonymous patron, so no circulation history is displayed. To get a list of anonymized loans, please run a report.</div> > [% ELSIF ( patron.privacy == 2) %] > <div class="dialog message">This patron has set the privacy rules to never keeping a circulation history.</div> >-[% ELSIF ( !loop_reading ) %] >+[% ELSIF ( !all_checkouts.size ) %] > <div class="dialog message">This patron has no circulation history.</div> > [% ELSE %] > <form action="/cgi-bin/koha/members/readingrec.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form> >@@ -71,57 +72,56 @@ > </tr> > </thead> > <tbody> >- [% FOREACH issue IN loop_reading %] >- [% IF issue.returndate %]<tr>[% ELSE %]<tr class="onissue">[% END %] >+ [% FOREACH checkout IN all_checkouts %] >+ [% SET item = checkout.item %] >+ [% SET biblio = item.biblio %] >+ [% IF checkout.returndate %]<tr>[% ELSE %]<tr class="onissue">[% END %] > <td style="display:none;"> >- [% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' | html %] >+ [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' | html %] > [% ELSE %][% issuetype = 'standard_checkout' | html %] > [% END %] > [% issuetype | html %] > </td> >- <td data-order="[% issue.issuestimestamp | html %]"> >- [% issue.issuestimestamp | $KohaDates with_hours => 1 %] >+ <td data-order="[% checkout.timestamp | html %]"> >+ [% checkout.timestamp | $KohaDates with_hours => 1 %] > </td> > <td> >- [% INCLUDE 'biblio-title.inc' biblio=issue link = 1 %] >+ [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %] > </td> > >- <td>[% issue.author | html %]</td> >+ <td>[% biblio.author | html %]</td> > > <td> >- [% IF issue.classification %] >- [% issue.classification | html %] >- [% ELSE %] >- [% issue.itemcallnumber | html %] >- [% END %] >+ [% item.itemcallnumber | html %] > </td> > > <td> >- [% IF issue.enumchron %] >- [% issue.enumchron | html %] >+ [% IF item.enumchron %] >+ [% item.enumchron | html %] > [% END %] > </td> > >- <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% issue.itemnumber | uri %]&biblionumber=[% issue.biblionumber | uri %]&bi=[% issue.biblioitemnumber | uri %]#item[% issue.itemnumber | uri %]">[% issue.barcode | html %]</a></td> >+ <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber | uri %]&biblionumber=[% biblio.biblionumber | uri %]&bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td> > <td> >- [% issue.renewals_count | html %] >- [% IF issue.renewals_count > 0 %] >- [ <a class="checkout_renewals_view" data-renewals="[% issue.renewals_count | html %]" data-issueid="[% issue.issue_id | html %]" href="#">View</a> ] >+ [% checkout.renewals_count | html %] >+ [% IF checkout.renewals_count > 0 %] >+ [ <a class="checkout_renewals_view" data-renewals="[% checkout.renewals_count | html %]" data-issueid="[% checkout.issue_id | html %]" href="#">View</a> ] > [% END %] > </td> >- <td data-order="[% issue.issuedate | html %]"> >- [% issue.issuedate |$KohaDates with_hours => 1 %] >+ <td data-order="[% checkout.issuedate | html %]"> >+ [% checkout.issuedate | $KohaDates with_hours => 1 %] > </td> >- <td>[% Branches.GetName( issue.branchcode ) | html %]</td> >+ <td>[% Branches.GetName( checkout.branchcode ) | html %]</td> > [% IF Koha.Preference('RecordStaffUserOnCheckout') %] >- <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issue.issuer_id | uri %]">[% issue.firstname | html %] [% issue.surname | html %]</a></td> >+ [% SET issuer = checkout.issuer %] >+ <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issuer.issuer_id | uri %]">[% issuer.firstname | html %] [% issuer.surname | html %]</a></td> > [% END %] >- <td data-order="[% issue.date_due | html %]"> >- [% issue.date_due | $KohaDates as_due_date => 1 %] >+ <td data-order="[% checkout.date_due | html %]"> >+ [% checkout.date_due | $KohaDates as_due_date => 1 %] > </td> >- [% IF issue.returndate %] >- <td data-order="[% issue.returndate | html %]"> >- [% issue.returndate |$KohaDates with_hours => 1 %] >+ [% IF checkout.returndate %] >+ <td data-order="[% checkout.returndate | html %]"> >+ [% checkout.returndate |$KohaDates with_hours => 1 %] > [% ELSE %] > <td data-order="checked out"> > <small>Checked out</small> >diff --git a/members/readingrec.pl b/members/readingrec.pl >index 0dcdab25ce8..08eff9f0106 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; > >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33948
:
152154
|
154005
|
156091