Bugzilla – Attachment 172906 Details for
Bug 23415
Notify patron fines when renewing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23415: Notify patron fines when renewing
Bug-23415-Notify-patron-fines-when-renewing.patch (text/plain), 9.67 KB, created by
Martin Renvoize (ashimema)
on 2024-10-17 16:07:27 UTC
(
hide
)
Description:
Bug 23415: Notify patron fines when renewing
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-17 16:07:27 UTC
Size:
9.67 KB
patch
obsolete
>From cd2d259e987598052f9b151bb7c52daffb1224cc Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 17 Sep 2024 10:54:32 +0300 >Subject: [PATCH] Bug 23415: Notify patron fines when renewing > >It is possible to renew items for patron who has fines over accepted >limit on renew page or from checkout list. This patch adds confirmation >alerts to these renew actions when patron has fines over >"noissuescharge" syspref. > >Test plan: >1. Have patron with checkouts and fines over allowed limit >2. Renew checkouts either from renew page or checkout list >=> renew is successful >3. Apply patch >4. Repeat steps 1 and 2 >=> On renew page an alert is displayed and user has to confirm >renew >=> When renew is done from checkout list confirmation pop-up >is displayed > >Sponsored-by: Koha-Suomi Oy >Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > circ/circulation.pl | 2 +- > circ/renew.pl | 18 +++++++++++++++++- > .../en/modules/admin/preferences/opac.pref | 1 + > .../prog/en/modules/circ/circulation.tt | 4 ++++ > .../prog/en/modules/circ/renew.tt | 9 +++++++++ > .../prog/en/modules/members/moremember.tt | 4 ++++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 19 ++++++++++++++++--- > 7 files changed, 52 insertions(+), 5 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 9230347ce01..98e239b2c40 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -287,7 +287,7 @@ if ($patron) { > $template->param( > overduecount => $overdues->count, > issuecount => $issues->count, >- finetotal => $balance, >+ fines => $balance, > ); > > if ( $patron and $patron->is_debarred ) { >diff --git a/circ/renew.pl b/circ/renew.pl >index 52b38ddb8ca..3af29c8072e 100755 >--- a/circ/renew.pl >+++ b/circ/renew.pl >@@ -27,6 +27,7 @@ use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate Ad > use Koha::DateUtils qw( dt_from_string ); > use Koha::Database; > use Koha::BiblioFrameworks; >+use Koha::Patrons; > > my $cgi = CGI->new; > >@@ -47,11 +48,12 @@ my $unseen = $cgi->param('unseen') || 0; > $barcode = barcodedecode($barcode) if $barcode; > my $override_limit = $cgi->param('override_limit'); > my $override_holds = $cgi->param('override_holds'); >+my $override_debt = $cgi->param('override_debt'); > my $hard_due_date = $cgi->param('hard_due_date'); > > my ( $item, $checkout, $patron ); > my $error = q{}; >-my ( $soonest_renew_date, $latest_auto_renew_date ); >+my ( $soonest_renew_date, $latest_auto_renew_date, $balance ); > > if ($op eq 'cud-renew' && $barcode) { > $barcode = barcodedecode($barcode) if $barcode; >@@ -65,6 +67,9 @@ if ($op eq 'cud-renew' && $barcode) { > > $patron = $checkout->patron; > >+ $balance = $patron->account->balance; >+ my $amountlimit = C4::Context->preference("OPACFineNoRenewals"); >+ > if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) { > my $can_renew; > my $info; >@@ -90,6 +95,16 @@ if ($op eq 'cud-renew' && $barcode) { > $checkout, > ); > } >+ >+ if ( $balance > $amountlimit ) { >+ $error = "too_much_debt"; >+ $can_renew = 0; >+ if ($override_debt) { >+ $can_renew = 1; >+ $error = undef; >+ } >+ } >+ > if ($can_renew) { > my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; > my $date_due = >@@ -128,6 +143,7 @@ if ($op eq 'cud-renew' && $barcode) { > error => $error, > soonestrenewdate => $soonest_renew_date, > latestautorenewdate => $latest_auto_renew_date, >+ balance => $balance, > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 1be562220e0..c88f10744e0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -617,6 +617,7 @@ OPAC: > - pref: OPACFineNoRenewals > class: currency > - '[% local_currency %] in charges (leave blank to disable).' >+ - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.' > - > - pref: OPACFineNoRenewalsIncludeCredits > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index c31e66bd869..5e19600a1a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1045,6 +1045,10 @@ > > [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %] > >+ var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]"; >+ var fines = "[% fines | $Price %]"; >+ var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines); >+ > // On-site checkout > function toggle_onsite_checkout(){ > const duedatespec = document.querySelector("#duedatespec"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >index e587225f4b1..4a3cfba85c1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE Price %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -186,6 +187,14 @@ > [% ELSIF error == 'recalled' %] > <p>This item has been recalled.</p> > >+ [% ELSIF error == "too_much_debt" %] >+ >+ <li>The patron has a debt of [% balance | $Price %].</li> >+ <form method="post" action="/cgi-bin/koha/circ/renew.pl"> >+ <input type="hidden" name="barcode" value="[% item.barcode | html %]"/> >+ <input type="hidden" name="override_debt" value="1" /> >+ <button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button> >+ </form> > [% ELSE %] > > [% error | html %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 99d09c27078..f902db24c0a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -782,6 +782,10 @@ > CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %] > patron_borrowernumber = [% patron.borrowernumber | $raw %] > >+ var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]"; >+ var fines = "[% fines | $Price %]"; >+ var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines); >+ > function uncheck_sibling(me){ > nodename=me.getAttribute("name"); > if (nodename =="barcodes[]"){ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index a27fd722cfb..d7ca029ceea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -482,6 +482,8 @@ $(document).ready(function() { > > var onHoldDueDateSet = false; > >+ var show_confirm = true; >+ > var onHoldChecked = function() { > var isChecked = false; > $('input[data-on-reserve]').each(function() { >@@ -655,11 +657,19 @@ $(document).ready(function() { > $("#RenewChecked").on("click",function(e){ > e.preventDefault(); > let refresh_table = true; >+ >+ if(show_confirm && parseFloat(fines) > parseFloat(amountlimit) ) { >+ var result = confirm(MSG_CONFIRM_RENEW); >+ if(!result){ >+ return false; >+ } >+ // Prevent displaying confirm box again >+ show_confirm = false; >+ } >+ > function renew(item_id){ > var override_limit = $("#override_limit").is(':checked') ? 1 : 0; > >- $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); >- > var params = { > item_id, > patron_id: borrowernumber, >@@ -679,6 +689,9 @@ $(document).ready(function() { > params.date_due = dueDate > } > >+ >+ $(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); >+ > const client = APIClient.circulation; > return client.checkouts.renew(params).then( > success => { >@@ -715,7 +728,7 @@ $(document).ready(function() { > $(id).replaceWith( content ); > }, > error => { >- console.warn("Something wrong happened: %s".format(error)); >+ console.warn("Something wrong happened: %s".format(error)); > } > ); > } >-- >2.47.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 23415
:
92039
|
92541
|
98442
|
98634
|
98996
|
98997
|
105893
|
105894
|
108392
|
109871
|
109872
|
109876
|
109880
|
116919
|
116920
|
116921
|
116922
|
118175
|
118176
|
118177
|
118178
|
118183
|
119300
|
119301
|
119302
|
119303
|
121472
|
139670
|
139671
|
139672
|
139673
|
139674
|
146415
|
148198
|
148199
|
148200
|
148201
|
148202
|
152776
|
152777
|
152778
|
152779
|
152780
|
152781
|
154595
|
154596
|
154597
|
154598
|
154599
|
154600
|
158302
|
158303
|
158304
|
158305
|
158306
|
158307
|
161964
|
161965
|
161966
|
161967
|
161968
|
161969
|
162171
|
162172
|
162173
|
162174
|
162175
|
162176
|
162177
|
162178
|
162179
|
162180
|
171620
|
171621
|
171622
|
171623
|
171983
|
171984
|
171985
|
171986
| 172906 |
172907
|
172908
|
172909
|
172910