Bugzilla – Attachment 194270 Details for
Bug 4858
Ability to Charge for Print Notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4858: (QA follow-up) Fix high-priority issues
eeab9cc.patch (text/plain), 11.87 KB, created by
Martin Renvoize (ashimema)
on 2026-03-02 09:27:58 UTC
(
hide
)
Description:
Bug 4858: (QA follow-up) Fix high-priority issues
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-02 09:27:58 UTC
Size:
11.87 KB
patch
obsolete
>From eeab9ccf77191c4a467817d33777a9dd437475a2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 2 Mar 2026 08:11:02 +0000 >Subject: [PATCH] Bug 4858: (QA follow-up) Fix high-priority issues > >- Remove duplicate 'use Scalar::Util' import introduced by this patch; > the import already existed at line 26 of Koha/Patron.pm. > >- Pass notice_code as the note field on the add_debit call in > add_print_notice_charge_if_needed. Previously the notice_code > parameter was accepted but silently dropped, meaning all print notice > charges looked identical in the account with no way to identify which > letter triggered the charge. > >- Add print transport column to the OPAC messaging preferences table > (opac-messaging.tt). The original patch added a print notice charging > warning in the OPAC that told patrons to "uncheck print notice options" > but never actually gave them a column to do so. This adds the print > column to the OPAC table header and body rows (mirroring the staff > messaging-preference-form.inc implementation), and adds a pmp_print > JS click handler for the toggle_digest function, so patrons can > opt out of print notices themselves. > >- Align PRINT_NOTICE debit type default_amount between fresh install and > upgrade: account_debit_types.yml correctly set this to NULL (charge > amount is per patron category, not a global default) but the > atomicupdate was inserting 0.50. Changed atomicupdate to NULL. > >Sponsored-by: OpenFifth <https://openfifth.co.uk\> >Signed-off-by: Jackie Usher <jackie.usher@westsussex.gov.uk> >--- > Koha/Patron.pm | 20 ++++--- > .../bug_4858-print-notice-charge.pl | 2 +- > .../bootstrap/en/modules/opac-messaging.tt | 55 ++++++++++++++++--- > 3 files changed, 60 insertions(+), 17 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 52532a45ead..7927c9a5108 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -21,7 +21,6 @@ package Koha::Patron; > use Modern::Perl; > > use List::MoreUtils qw( any none uniq notall zip6); >-use Scalar::Util qw( looks_like_number ); > use JSON qw( to_json ); > use Scalar::Util qw(looks_like_number); > use Unicode::Normalize qw( NFKD ); >@@ -1692,17 +1691,20 @@ sub add_print_notice_charge_if_needed { > return unless Scalar::Util::looks_like_number($charge_amount); > return unless $charge_amount > 0; > >- my $userenv = C4::Context->userenv; >- my $library_id = $params->{library_id} || ($userenv ? $userenv->{branch} : undef); >+ my $userenv = C4::Context->userenv; >+ my $library_id = $params->{library_id} || ( $userenv ? $userenv->{branch} : undef ); > > my $result; > try { >- $result = $self->account->add_debit({ >- amount => $charge_amount, >- type => 'PRINT_NOTICE', >- interface => C4::Context->interface, >- library_id => $library_id, >- }); >+ $result = $self->account->add_debit( >+ { >+ amount => $charge_amount, >+ type => 'PRINT_NOTICE', >+ interface => C4::Context->interface, >+ library_id => $library_id, >+ note => $params->{notice_code}, >+ } >+ ); > } catch { > return; > }; >diff --git a/installer/data/mysql/atomicupdate/bug_4858-print-notice-charge.pl b/installer/data/mysql/atomicupdate/bug_4858-print-notice-charge.pl >index d6f25bd7653..b6583a6b1bc 100755 >--- a/installer/data/mysql/atomicupdate/bug_4858-print-notice-charge.pl >+++ b/installer/data/mysql/atomicupdate/bug_4858-print-notice-charge.pl >@@ -20,7 +20,7 @@ return { > $dbh->do( > q{ > INSERT IGNORE INTO account_debit_types (code, description, can_be_invoiced, can_be_sold, default_amount, is_system, restricts_checkouts) >- VALUES ('PRINT_NOTICE', 'Print notice charge', 0, 0, 0.50, 1, 0) >+ VALUES ('PRINT_NOTICE', 'Print notice charge', 0, 0, NULL, 1, 0) > } > ); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >index bb6c2c6224f..5bb3499c809 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -47,8 +47,7 @@ > [% IF print_notice_charging && !patron_has_email %] > <div class="alert alert-warning"> > <h4><i class="fa fa-exclamation-triangle"></i> Print Notice Charges</h4> >- <p><strong>Important:</strong> Print notices incur a charge of >- [% print_notice_charge_amount | $Price %] each to cover postage and processing costs.</p> >+ <p><strong>Important:</strong> Print notices incur a charge of [% print_notice_charge_amount | $Price %] each to cover postage and processing costs.</p> > <p>To avoid these charges, please:</p> > <ul> > <li>Provide an email address in your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li> >@@ -63,6 +62,10 @@ > <input type="hidden" name="op" value="cud-modify" /> > > [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %] >+ [% SET has_print_transport = 0 %] >+ [% FOREACH pref IN messaging_preferences %] >+ [% IF pref.transport_print %][% SET has_print_transport = 1 %][% LAST %][% END %] >+ [% END %] > <table class="table table-bordered table-condensed table-striped"> > <caption class="sr-only">Your messaging settings</caption> > <thead> >@@ -73,6 +76,14 @@ > [% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %] > [% IF Koha.Preference('PhoneNotification') %]<th>Phone</th>[% END %] > <th>Email</th> >+ [% IF has_print_transport %] >+ <th >+ >Print >+ [% IF print_notice_charging %] >+ ([% print_notice_charge_amount | $Price %] charge) >+ [% END %] >+ </th> >+ [% END %] > <th > >Digests only > <i >@@ -256,6 +267,35 @@ > <td>-</td> > [% END %] > >+ [% IF has_print_transport %] >+ [% IF ( messaging_preference.transport_print ) %] >+ <td class="selectcol"> >+ [% IF ( messaging_preference.transports_print ) %] >+ <input >+ type="checkbox" >+ aria-label="Unselect print messaging" >+ class="pmp_print" >+ id="print[% messaging_preference.message_attribute_id | html %]" >+ name="[% messaging_preference.message_attribute_id | html %]" >+ value="print" >+ checked="checked" >+ /> >+ [% ELSE %] >+ <input >+ type="checkbox" >+ aria-label="Select print messaging" >+ class="pmp_print" >+ id="print[% messaging_preference.message_attribute_id | html %]" >+ name="[% messaging_preference.message_attribute_id | html %]" >+ value="print" >+ /> >+ [% END %] >+ </td> >+ [% ELSE %] >+ <td>-</td> >+ [% END %] >+ [% END %] >+ > [% IF ( messaging_preference.has_digest ) %] > <td class="selectcol"> > [% IF ( messaging_preference.digest ) %] >@@ -294,16 +334,14 @@ > [% IF print_notice_charging %] > <div class="alert alert-info"> > <h5><i class="fa fa-info-circle"></i> About Print Notice Charges</h5> >- <p>Print notices incur a charge of >- [% IF print_notice_charge_amount %][% print_notice_charge_amount | $Price %][% ELSE %]0.00[% END %] >- each to cover postage and processing costs.</p> >+ <p>Print notices incur a charge of [% IF print_notice_charge_amount %][% print_notice_charge_amount | $Price %][% ELSE %]0.00[% END %] each to cover postage and processing costs.</p> > <p><strong>To avoid these charges:</strong></p> > <ul> > [% IF !patron_has_email %] > <li><strong>Add an email address</strong> to your <a href="/cgi-bin/koha/opac-memberentry.pl">account details</a></li> > [% END %] >- <li>Select "Email" instead of any print options for your notice preferences above</li> >- <li>Ask library staff to disable print notices for your account</li> >+ <li>Select "Email" instead of "Print" for your notice preferences above</li> >+ <li>Uncheck any enabled print notice preferences above</li> > </ul> > [% IF patron_has_email %] > <p class="text-success">รข You have an email address on file. Make sure to select email delivery for notices to avoid print charges.</p> >@@ -427,6 +465,9 @@ > $(".pmp_phone").click(function(){ > toggle_digest(Number($(this).attr("id").replace("phone", ""))); > }); >+ $(".pmp_print").click(function(){ >+ toggle_digest(Number($(this).attr("id").replace("print", ""))); >+ }); > > }); > >-- >2.53.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 4858
:
186491
|
186492
|
186493
|
186494
|
186495
|
186496
|
186497
|
186498
|
186499
|
186500
|
186501
|
186502
|
194257
|
194258
|
194259
|
194260
|
194261
|
194262
|
194263
|
194264
|
194265
|
194266
|
194267
|
194268
|
194269
| 194270 |
194271
|
194272