Bugzilla – Attachment 133966 Details for
Bug 23838
Add ability to view item renew history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23838: Add renewals modal
Bug-23838-Add-renewals-modal.patch (text/plain), 7.00 KB, created by
Owen Leonard
on 2022-04-26 16:59:24 UTC
(
hide
)
Description:
Bug 23838: Add renewals modal
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2022-04-26 16:59:24 UTC
Size:
7.00 KB
patch
obsolete
>From 9325b36cfd7e2edee848ee7fc38f83d1b7519f2d Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 18 Oct 2019 08:56:21 +0100 >Subject: [PATCH] Bug 23838: Add renewals modal > >This patch adds the display of the renewals modal when appropriate. A >"View" link is displayed next to renewals count where appropriate. >Clicking the link opens the modal that displays the logged renewals. > >Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk> > >Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >I rescued this patchset by squashing previous work and updating it to >utilise the new renewals API routes introduced in bug 30275. >--- > .../includes/patron-renewal-modal-strings.inc | 4 +++ > .../prog/en/includes/patron-renewal-modal.inc | 18 +++++++++++++ > .../prog/en/modules/members/readingrec.tt | 10 +++++++- > .../prog/js/patron-renewal-modal.js | 25 +++++++++++++++++++ > members/readingrec.pl | 5 ++-- > 5 files changed, 59 insertions(+), 3 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal-strings.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/patron-renewal-modal.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal-strings.inc >new file mode 100644 >index 0000000000..dde6014c0d >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal-strings.inc >@@ -0,0 +1,4 @@ >+<script> >+ var renewed_prop = _("Note: %s out of %s renewals have been logged"); >+ var renewed = _("Renewed by"); >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal.inc >new file mode 100644 >index 0000000000..d77875f6b4 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-renewal-modal.inc >@@ -0,0 +1,18 @@ >+<div id="patronRenewals" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="patronRenewalsLabel" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h3 id="patronRenewalsLabel"> Item renewals</h3> >+ </div> >+ <div class="modal-body"> >+ <div id="retrieving" class="alert" style="display:none">Retrieving renewals...</div> >+ <div id="incomplete" class="alert" style="display:none"></div> >+ <ul id="results" style="display:none"></ul> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> >+ </div> >+ </div> >+ </div> >+</div> >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 6d348fb2e8..088da10000 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -109,7 +109,12 @@ > </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>[% issue.renewals_count | html %]</td> >+ <td> >+ [% issue.renewals_count | html %] >+ [% IF issue.renewals_count > 0 %] >+ [ <a class="patron_renewals_view" data-renewals="[% issue.renewals_count | html %]" data-issueid="[% issue.issue_id %]" href="#">View</a> ] >+ [% END %] >+ </td> > <td data-order="[% issue.issuedate | html %]"> > [% issue.issuedate |$KohaDates with_hours => 1 %] > </td> >@@ -154,6 +159,9 @@ > [% Asset.js("js/members-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'patron-renewal-modal.inc' %] >+ [% INCLUDE 'patron-renewal-modal-strings.inc' %] >+ [% Asset.js("js/patron-renewal-modal.js") | $raw %] > <script id="js"> > $(document).ready(function() { > var columns_settings = [% TablesSettings.GetColumns('members', 'checkouthistory', 'checkouthistory-table', 'json') %]; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-renewal-modal.js b/koha-tmpl/intranet-tmpl/prog/js/patron-renewal-modal.js >new file mode 100644 >index 0000000000..1c4cc81a95 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-renewal-modal.js >@@ -0,0 +1,25 @@ >+$(document).ready(function(){ >+ // Display the modal containing patron renewals details >+ $('.patron_renewals_view').on('click', function(e) { >+ e.preventDefault(); >+ $('#patronRenewals #incomplete').html('').hide(); >+ $('#patronRenewals #results').html('').hide(); >+ $('#patronRenewals').modal({show:true}); >+ var renewals = $(this).data('renewals'); >+ var checkoutID = $(this).data('issueid'); >+ $('#patronRenewals #retrieving').show(); >+ $.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) { >+ if (data.length < renewals) { >+ $('#patronRenewals #incomplete').append(renewed_prop.format(data.length, renewals)).show(); >+ } >+ var items = data.map(function(item) { >+ return createLi(item); >+ }); >+ $('#patronRenewals #retrieving').hide(); >+ $('#patronRenewals #results').append(items).show(); >+ }); >+ }); >+ function createLi(renewal) { >+ return '<li><span style="font-weight:bold">' + renewal.timestamp + '</span> ' + renewed + ' <span style="font-weight:bold">' + renewal.renewer.firstname + ' ' + renewal.renewer.surname + '</li>'; >+ } >+}); >diff --git a/members/readingrec.pl b/members/readingrec.pl >index b0e2a5b9a1..0dcdab25ce 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -27,8 +27,9 @@ 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( uniq ); >+use List::MoreUtils qw( any uniq ); > use Koha::DateUtils qw( dt_from_string ); >+use Koha::ActionLogs; > > use Koha::Patrons; > use Koha::Patron::Categories; >@@ -97,7 +98,7 @@ if (! $limit){ > $template->param( > patron => $patron, > readingrecordview => 1, >- loop_reading => $issues, >+ loop_reading => $issues > ); > output_html_with_http_headers $input, $cookie, $template->output; > >-- >2.20.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 23838
:
94394
|
94395
|
94635
|
94636
|
94663
|
94664
|
94676
|
94681
|
94682
|
94683
|
94684
|
94685
|
95466
|
95467
|
95468
|
95469
|
95470
|
95471
|
95472
|
96186
|
96187
|
96188
|
96189
|
96190
|
131892
|
131914
|
131915
|
133945
|
133946
|
133966
|
133967
|
133968
|
134890
|
134891
|
134892
|
137167
|
137168
|
137169
|
138007
|
138019
|
138020
|
138021
|
138022
|
138039
|
138040
|
138041
|
138042
|
138043