From 1a54af20e200e8805990c19dcb6759379ee60aa9 Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Mon, 30 Jun 2025 13:36:01 +0100 Subject: [PATCH] Bug 4858: Add OPAC interface updates for print notice charging - Enhanced opac-messaging.pl to provide print notice charging context - Added warnings in OPAC messaging preferences for patrons without email - Implemented helpful information section about avoiding print charges - Updated OPAC account page with explanatory information about print charges --- .../prog/en/modules/members/memberentrygen.tt | 5 +-- .../bootstrap/en/modules/opac-account.tt | 14 +++++++ .../bootstrap/en/modules/opac-messaging.tt | 37 +++++++++++++++++++ opac/opac-messaging.pl | 9 +++++ 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 7091d09b382..9dc502753e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1603,9 +1603,8 @@ [% IF print_notice_charging && !patron_has_email %]
- Notice: This patron has no email address. - Print notices will incur a charge of [% print_notice_charge_amount | $Price %] each. - Consider encouraging the patron to provide an email address to avoid these charges. + Notice: This patron has no email address. Print notices will incur a charge of [% print_notice_charge_amount | $Price %] each. Consider encouraging the patron to provide an email + address to avoid these charges.
[% END %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt index e80a6b54936..680eb6fb2b3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -69,6 +69,20 @@ [% END %] [% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %] + + [% IF logged_in_user.category.print_notice_charge > 0 %] +
+
About Print Notice Charges
+

Print notice charges of [% logged_in_user.category.print_notice_charge | $Price %] + each help cover postage and processing costs when notices are sent by mail.

+

To avoid future print notice charges:

+ +
+ [% END %]
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 eceef2707bd..d7ee84e8a0a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Koha %] +[% USE Price %] [% USE AdditionalContents %] [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] @@ -36,6 +37,20 @@ >

Settings updated

[% END %] + [% IF print_notice_charging && !patron_has_email %] +
+

Print Notice Charges

+

Important: Print notices incur a charge of + [% print_notice_charge_amount | $Price %] each to cover postage and processing costs.

+

To avoid these charges, please:

+ +
+ [% END %] +
[% INCLUDE 'csrf-token.inc' %] @@ -269,6 +284,28 @@ [% END %] + [% IF print_notice_charging %] +
+
About Print Notice Charges
+

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.

+

To avoid these charges:

+
    + [% IF !patron_has_email %] +
  • Add an email address to your account details
  • + [% END %] +
  • Select "Email" instead of any print options for your notice preferences above
  • +
  • Ask library staff to disable print notices for your account
  • +
+ [% IF patron_has_email %] +

✓ You have an email address on file. Make sure to select email delivery for notices to avoid print charges.

+ [% ELSE %] +

⚠ Important: You don't have an email address on file. Print notices may be automatically selected for your account.

+ [% END %] +
+ [% END %] + [% IF ( SMSSendDriver || Koha.Preference('TranslateNotices') ) %]
    diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 399451790a2..c802dc66f95 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -87,6 +87,15 @@ $template->param( enforce_expiry_notice => $patron->category->enforce_expiry_notice, ); +# Print notice charging context - category-based +if ($patron && $patron->category && $patron->category->print_notice_charge > 0) { + $template->param( + print_notice_charging => 1, + print_notice_charge_amount => $patron->category->print_notice_charge, + patron_has_email => $patron->notice_email_address, + ); +} + if ( $opac_messaging && C4::Context->preference("SMSSendDriver") eq 'Email' ) { my @providers = Koha::SMS::Providers->search( {}, { order_by => 'name' } )->as_list; $template->param( -- 2.39.5