Bugzilla – Attachment 193654 Details for
Bug 26355
Allow patrons to self-renew through the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26355: (follow-up) Allow the setting of multiple information messages
Bug-26355-follow-up-Allow-the-setting-of-multiple-.patch (text/plain), 12.91 KB, created by
Matt Blenkinsop
on 2026-02-23 16:57:41 UTC
(
hide
)
Description:
Bug 26355: (follow-up) Allow the setting of multiple information messages
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2026-02-23 16:57:41 UTC
Size:
12.91 KB
patch
obsolete
>From 00033734402e2978aa3ac7db3ea3e03966a770cc Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Mon, 23 Feb 2026 16:24:23 +0000 >Subject: [PATCH] Bug 26355: (follow-up) Allow the setting of multiple > information messages > >--- > Koha/REST/V1/Patrons/SelfRenewal.pm | 7 +-- > admin/categories.pl | 26 ++++++++-- > .../prog/en/modules/admin/categories.tt | 47 +++++++++++++++---- > .../PatronSelfRenewal/PatronSelfRenewal.vue | 14 ++++-- > .../PatronSelfRenewal/VerificationChecks.vue | 28 ++++++++--- > 5 files changed, 94 insertions(+), 28 deletions(-) > >diff --git a/Koha/REST/V1/Patrons/SelfRenewal.pm b/Koha/REST/V1/Patrons/SelfRenewal.pm >index 00f3a66cf48..7aa75329bc9 100644 >--- a/Koha/REST/V1/Patrons/SelfRenewal.pm >+++ b/Koha/REST/V1/Patrons/SelfRenewal.pm >@@ -49,10 +49,11 @@ sub start { > > return try { > my $category = $patron->category; >+ my @information_messages = split( /\|/, $category->self_renewal_information_message ); > my $self_renewal_settings = { >- self_renewal_failure_message => $category->self_renewal_failure_message, >- self_renewal_information_message => $category->self_renewal_information_message, >- opac_patron_details => C4::Context->preference('OPACPatronDetails') >+ self_renewal_failure_message => $category->self_renewal_failure_message, >+ self_renewal_information_messages => \@information_messages, >+ opac_patron_details => C4::Context->preference('OPACPatronDetails') > }; > > return $c->render( >diff --git a/admin/categories.pl b/admin/categories.pl >index cee0f9e2d10..ec2b66e4847 100755 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -47,8 +47,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > if ( $op eq 'add_form' ) { > >+ my $category = Koha::Patron::Categories->find($categorycode); > $template->param( >- category => scalar Koha::Patron::Categories->find($categorycode), >+ category => scalar $category, >+ self_renewal_information_messages => parse_renewal_info_message( $category->self_renewal_information_message ) > ); > > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >@@ -83,7 +85,7 @@ if ( $op eq 'add_form' ) { > my $self_renewal_availability_start = $input->param('self_renewal_availability_start'); > my $self_renewal_fines_block = $input->param('self_renewal_fines_block'); > my $self_renewal_failure_message = $input->param('self_renewal_failure_message'); >- my $self_renewal_information_message = $input->param('self_renewal_information_message'); >+ my @self_renewal_information_message = $input->multi_param('self_renewal_information_message'); > my $self_renewal_if_expired = $input->param('self_renewal_if_expired'); > > my @branches = grep { $_ ne q{} } $input->multi_param('branches'); >@@ -130,7 +132,7 @@ if ( $op eq 'add_form' ) { > $category->self_renewal_availability_start($self_renewal_availability_start); > $category->self_renewal_fines_block($self_renewal_fines_block); > $category->self_renewal_failure_message($self_renewal_failure_message); >- $category->self_renewal_information_message($self_renewal_information_message); >+ $category->self_renewal_information_message( parse_renewal_info_message( \@self_renewal_information_message ) ); > $category->self_renewal_if_expired($self_renewal_if_expired); > eval { > $category->store; >@@ -174,8 +176,8 @@ if ( $op eq 'add_form' ) { > self_renewal_availability_start => $self_renewal_availability_start, > self_renewal_fines_block => $self_renewal_fines_block, > self_renewal_failure_message => $self_renewal_failure_message, >- self_renewal_information_message => $self_renewal_information_message, >- self_renewal_if_expired => $self_renewal_if_expired, >+ self_renewal_information_message => parse_renewal_info_message( \@self_renewal_information_message ), >+ self_renewal_if_expired => $self_renewal_if_expired, > } > ); > eval { >@@ -246,3 +248,17 @@ $template->param( > output_html_with_http_headers $input, $cookie, $template->output; > > exit 0; >+ >+sub parse_renewal_info_message { >+ my ($message) = @_; >+ >+ if ( ref($message) eq 'ARRAY' ) { >+ my $info_message = join( '|', @$message ); >+ return $info_message; >+ } else { >+ my @info_messages = split( /\|/, $message ); >+ return scalar(@info_messages) > 0 ? \@info_messages : [""]; >+ } >+ >+ return $message; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index 24dcf3e6c18..9d8247bdc63 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -554,14 +554,22 @@ > the [%- pref_noissuescharge_link | $raw | $KohaSpan -%] system preference.</div > > > </li> >- <li> >- <label for="self_renewal_information_message">Self-renewal information message: </label> >- [% IF (category.self_renewal_information_message) %] >- <textarea type="text" name="self_renewal_information_message" id="self_renewal_information_message" cols="40" rows="2">[% category.self_renewal_information_message | html %]</textarea> >- [% ELSE %] >- <textarea type="text" name="self_renewal_information_message" id="self_renewal_information_message" cols="40" rows="4"></textarea> >- [% END %] >- </li> >+ [% FOREACH info_message IN self_renewal_information_messages %] >+ <li> >+ <label for="self_renewal_information_message_[% loop.index %]">Self-renewal information message[% IF(loop.index > 0) %][% loop.index + 1 %][% END %]: </label> >+ [% IF (info_message) %] >+ <textarea type="text" name="self_renewal_information_message" id="self_renewal_information_message_[% loop.index %]" cols="40" rows="2">[% info_message | html %]</textarea> >+ [% ELSE %] >+ <textarea type="text" name="self_renewal_information_message" id="self_renewal_information_message_[% loop.index %]" cols="40" rows="4"></textarea> >+ [% END %] >+ <a href="#" class="clear_message"><i class="fa fa-fw fa-trash-can"></i> Clear</a> >+ <a href="#" class="clone_message"><i class="fa fa-fw fa-plus"></i> New</a> >+ </li> >+ [% END %] >+ <div class="hint" >+ >Information to be displayed to the patron at the start of the renewal process. This will be displayed as a Yes/No question and you can add multiple questions - an answer of 'Yes' proceeds to the next question, 'No' >+ exits the process and displays the Self-renewal failure message.</div >+ > > <li> > <label for="self_renewal_failure_message">Self-renewal failure message: </label> > [% IF (category.self_renewal_failure_message) %] >@@ -922,6 +930,29 @@ > [% INCLUDE 'select2.inc' %] > <script> > var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'categories', 'patron_categories', 'json' ) | $raw %]; >+ $(document).ready(function () { >+ $("#category_form").on( >+ "click", >+ ".clone_message", >+ function (e) { >+ e.preventDefault(); >+ var original = $(this).parent(); >+ var clone = $(this).parent().clone(); >+ $(clone).children("div.hint").remove() >+ $(original).after(clone); >+ return false; >+ } >+ ); >+ $("#category_form").on( >+ "click", >+ ".clear_message", >+ function (e) { >+ e.preventDefault(); >+ var original = $(this).parent(); >+ $("input", original).val(""); >+ } >+ ); >+ }); > </script> > [% Asset.js("js/categories.js") | $raw %] > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/PatronSelfRenewal.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/PatronSelfRenewal.vue >index c5484a43711..cfdc2e69fe7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/PatronSelfRenewal.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/PatronSelfRenewal.vue >@@ -28,10 +28,14 @@ > /> > <VerificationChecks > v-if="activeStep === 'confirmation'" >- :informationMessage=" >- $__('Are you sure you want to renew your account?') >- " >- :renewalSettings="renewalSettings" >+ :renewalSettings="{ >+ ...renewalSettings, >+ self_renewal_information_messages: [ >+ $__( >+ 'Are you sure you want to renew your account?' >+ ), >+ ], >+ }" > @verification-successful="submitRenewal" > /> > <div v-if="activeStep === 'detailsCheck'"> >@@ -96,7 +100,7 @@ export default { > ...response.self_renewal_settings, > }; > activeStep.value = response.self_renewal_settings >- .self_renewal_information_message >+ .self_renewal_information_messages?.length > ? "verification" > : response.self_renewal_settings.opac_patron_details === > "1" >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/VerificationChecks.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/VerificationChecks.vue >index 74d8c06b31e..0284af2ed1f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/VerificationChecks.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/PatronSelfRenewal/VerificationChecks.vue >@@ -1,6 +1,6 @@ > <template> > <fieldset class="rows" v-if="!verificationFailure"> >- <span class="verification_question">{{ verificationCheck }}</span> >+ <span class="verification_question">{{ activeCheck }}</span> > <div class="verification_actions"> > <button class="btn btn-success" @click="verificationPassed()"> > {{ $__("Yes") }} >@@ -20,18 +20,30 @@ import { $__ } from "@koha-vue/i18n"; > export default { > props: { > renewalSettings: Object, >- informationMessage: String, >+ confirmation: Boolean, > }, > emits: ["verification-successful"], > setup(props, { emit }) { >+ const checkCount = ref( >+ props.renewalSettings.self_renewal_information_messages.length >+ ); >+ const completedCount = ref(0); > const verificationFailure = ref(false); >- const verificationCheck = ref( >- props.informationMessage || >- props.renewalSettings.self_renewal_information_message >+ >+ const activeCheck = ref( >+ props.renewalSettings.self_renewal_information_messages[0] > ); > > const verificationPassed = () => { >- emit("verification-successful"); >+ if (completedCount.value === checkCount.value - 1) { >+ emit("verification-successful"); >+ } else { >+ completedCount.value++; >+ activeCheck.value = >+ props.renewalSettings.self_renewal_information_messages[ >+ completedCount.value >+ ]; >+ } > }; > const verificationFailed = () => { > verificationFailure.value = true; >@@ -44,11 +56,13 @@ export default { > }); > > return { >- verificationCheck, >+ checkCount, >+ activeCheck, > verificationPassed, > verificationFailed, > verificationFailure, > errorMessage, >+ completedCount, > }; > }, > }; >-- >2.50.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 26355
:
191781
|
191782
|
191783
|
191784
|
191785
|
191786
|
191787
|
191788
|
191789
|
192440
|
192441
|
192442
|
192443
|
192444
|
192445
|
192446
|
192447
|
192448
|
193065
|
193066
|
193067
|
193068
|
193069
|
193070
|
193071
|
193072
|
193073
|
193074
|
193249
|
193250
|
193251
|
193252
|
193253
|
193521
|
193522
|
193523
|
193524
|
193525
|
193526
|
193527
|
193528
|
193529
|
193581
|
193635
|
193654
|
193699
|
193756
|
193757
|
193758
|
193759
|
193760
|
193761
|
193762
|
193763
|
193764
|
193765
|
193921
|
194435
|
194464
|
194465
|
194466
|
194467
|
194468
|
194469
|
194470
|
194471
|
194472
|
194473
|
194474