Bugzilla – Attachment 147165 Details for
Bug 31735
Avoid re-fetching objects from database by passing them down instead of object ids
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31735: Optimize OPAC checkouts view
Bug-31735-Optimize-OPAC-checkouts-view.patch (text/plain), 4.18 KB, created by
Nick Clemens (kidclamp)
on 2023-02-22 15:07:21 UTC
(
hide
)
Description:
Bug 31735: Optimize OPAC checkouts view
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-02-22 15:07:21 UTC
Size:
4.18 KB
patch
obsolete
>From b5a5896f5d07cd0ddf5b502525833b45dfe22915 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 10 Oct 2022 17:18:03 +0200 >Subject: [PATCH] Bug 31735: Optimize OPAC checkouts view > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../bootstrap/en/modules/opac-user.tt | 2 +- > opac/opac-renew.pl | 20 ++++++++++++------- > opac/opac-user.pl | 2 +- > 3 files changed, 15 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index c52ec4cd7b..c6008787a1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -411,7 +411,7 @@ > [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %] > [% IF ( ISSUE.status ) %] > [% IF ( canrenew ) %] >- <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% ISSUE.itemnumber | uri %]&borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a> >+ <input type="checkbox" name="issue" value="[% ISSUE.issue_id | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&issue=[% ISSUE.issue_id | uri %]&borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a> > [% END %] > [% IF ISSUE.renewalfee > 0 %] > <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span> >diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl >index 9e8efa0c5e..cb7f253290 100755 >--- a/opac/opac-renew.pl >+++ b/opac/opac-renew.pl >@@ -38,8 +38,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > query => $query, > type => "opac", > } >-); >-my @items = $query->multi_param('item'); >+); >+my @issues = $query->multi_param('issue'); > > my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); > >@@ -55,13 +55,19 @@ if ( $patron->category->effective_BlockExpiredPatronOpacActions > } > else { > my @renewed; >- for my $itemnumber (@items) { >- my $item = Koha::Items->find($itemnumber); >+ my $issues = Koha::Checkouts->search( >+ { >+ issue_id => { -in => @issues } >+ }, { >+ prefetch => 'item' >+ } >+ ); >+ while( my $issue = $issues->next) { > my ( $status, $error ) = >- CanBookBeRenewed( $patron, $item->checkout ); #TODO: Pass issue numbers instead >+ CanBookBeRenewed( $patron, $issue ); > if ( $status == 1 && $opacrenew == 1 ) { >- AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef, undef, 0 ); >- push( @renewed, $itemnumber ); >+ AddRenewal( $borrowernumber, $issue->itemnumber, undef, undef, undef, undef, 0 ); >+ push( @renewed, $issue->itemnumber ); > } > else { > $errorstring .= $error . "|"; >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index b39b7493c0..0564a1df90 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -240,7 +240,7 @@ if ( $pending_checkouts->count ) { # Useless test > $issue->{'unseencount'}, > $issue->{'unseenallowed'}, > $issue->{'unseenleft'} >- ) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); >+ ) = GetRenewCount($patron, $c->item); > ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber ); > $issue->{itemtype_object} = Koha::ItemTypes->find( $c->item->effective_itemtype ); > if($status && C4::Context->preference("OpacRenewalAllowed")){ >-- >2.30.2
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 31735
:
141603
|
141604
|
141605
|
141606
|
141607
|
141608
|
141609
|
141610
|
141795
|
141796
|
141797
|
141798
|
141799
|
141800
|
141819
|
141820
|
141821
|
142865
|
142866
|
142867
|
142868
|
142869
|
142870
|
144628
|
144629
|
144630
|
144631
|
144632
|
144635
|
144721
|
144724
|
144784
|
144790
|
144791
|
144792
|
144798
|
144799
|
144800
|
144801
|
144802
|
144803
|
145028
|
145029
|
145030
|
145032
|
145033
|
145034
|
145035
|
146735
|
146736
|
146737
|
147124
|
147125
|
147126
|
147127
|
147128
|
147164
|
147165
|
147166
|
150611
|
150612
|
150613
|
150676
|
150677
|
150678
|
150699
|
150700
|
150701