Bugzilla – Attachment 125837 Details for
Bug 29083
Update article requests-related Koha::Patron methods to use relationships
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29083: Fix OPAC listing of article requests
Bug-29083-Fix-OPAC-listing-of-article-requests.patch (text/plain), 5.18 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-06 16:19:14 UTC
(
hide
)
Description:
Bug 29083: Fix OPAC listing of article requests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-06 16:19:14 UTC
Size:
5.18 KB
patch
obsolete
>From c06eb24642172dcaaf449d45d943b3e82f23d260 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 23 Sep 2021 08:52:50 -0300 >Subject: [PATCH] Bug 29083: Fix OPAC listing of article requests > >This patch makes the OPAC template reuse a precalculated value for the >active article requests for the patron (and its count). > >The original code relied on the methods returning a list, which is not >the case for _new_from_dbic until bug 28883 is pushed. > >This patch fixes that. > >Note: there was an odd behavior when ArticleRequests was enabled but no >active article requests were present: the tab wasn't rendered but the >'empty table' with the 'You have no article requests currently.' message >was displayed below the Checkouts tab. I'm not sure that was caused by >this patches, or other. Fixed on this patch. > >To test: >1. In the OPAC, go to 'your summary' >=> FAIL: Things don't show for article requests >2. Add some article requests and repeat 1 >=> FAIL: Something's wrong there >3. Apply this patch and repeat 1 >=> Yes! Things show correctly! >4. Cancel all your article requests >=> SUCCESS: Things render as they should >5. Re-enter the 'your summary' page (to force re-rendering) >=> SUCCESS: Things render correctly for empty article requests >6. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 8 ++++---- > opac/opac-user.pl | 7 +++++++ > 2 files changed, 11 insertions(+), 4 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 730400e7e1..ece7aee244 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -230,7 +230,7 @@ > [% END %] > > [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %] >- [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %] >+ [% IF Koha.Preference('ArticleRequests') %]<li><a href="#opac-user-article-requests">Article requests ([% current_article_requests_count || 0 | html %])</a></li>[% END %] > [% IF ( OverDriveCirculation ) %] > <li><a href="#opac-user-overdrive">OverDrive account</a></li> > [% END %] >@@ -765,7 +765,7 @@ > > [% IF Koha.Preference('ArticleRequests') %] > <div id="opac-user-article-requests"> >- [% IF logged_in_user.article_requests_current.count %] >+ [% IF current_article_requests_count %] > <table id="article-requests-table" class="table table-bordered table-striped"> > <caption>Article requests <span class="count"></span></caption> > <thead> >@@ -788,7 +788,7 @@ > </thead> > > <tbody> >- [% FOREACH ar IN logged_in_user.article_requests_current %] >+ [% FOREACH ar IN current_article_requests %] > <td class="article-request-record-title"> > <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber | html %]"> > [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %] >@@ -904,7 +904,7 @@ > } > } > $(document).ready(function(){ >- $('#opac-user-article-requests caption .count').html(AR_CAPTION_COUNT.format('[% logged_in_user.article_requests_current.count | html %]')); >+ $('#opac-user-article-requests caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests_count | html %]')); > $('#opac-user-views').tabs(); > $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs"); > $(".suspend-until").prop("readonly",1); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 8deb054e72..1cd97b628e 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -386,6 +386,13 @@ if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') > $template->param( relatives_with_fines => \@relatives_with_fines ); > } > >+if ( C4::Context->preference("ArticleRequests") ) { >+ my @current_article_requests = $patron->article_requests_current->as_list; >+ $template->param( >+ current_article_requests => \@current_article_requests, >+ current_article_requests_count => scalar @current_article_requests, >+ ); >+} > > $template->param( > patron_messages => $patron_messages, >-- >2.32.0
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 29083
:
125160
|
125161
|
125162
|
125186
|
125240
|
125241
|
125242
|
125243
|
125268
|
125269
|
125270
|
125271
|
125640
|
125641
|
125642
|
125643
|
125833
|
125834
|
125835
|
125836
| 125837 |
125838
|
125840
|
125862