Bugzilla – Attachment 112690 Details for
Bug 18595
Move C4::Members::Messaging to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18595: (follow-up) Disable transports if missing contact information
Bug-18595-follow-up-Disable-transports-if-missing-.patch (text/plain), 11.70 KB, created by
Lari Taskula
on 2020-10-30 11:35:49 UTC
(
hide
)
Description:
Bug 18595: (follow-up) Disable transports if missing contact information
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-10-30 11:35:49 UTC
Size:
11.70 KB
patch
obsolete
>From 9910f72fcd03388f6735cbeb13a5b028c1c34081 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 30 Oct 2020 09:53:46 +0000 >Subject: [PATCH] Bug 18595: (follow-up) Disable transports if missing contact > information > >To test: >Make sure you have enabled the following system preferences: >- opacuserlogin >- EnhancedMessagingPreferences >- EnhancedMessagingPreferencesOPAC >- SMSSendDriver > >---- GENERAL ---- >1. Apply patch > >---- PREREQUISITES ---- >1. Select a patron to test this patch with >2. Remove patron's primary email >3. Remove patron's SMS number > >---- OPAC ---- >1. Login to OPAC with your test patron. >2. Go to "your messaging" (cgi-bin/koha/opac-messaging.pl). >3. Observe two warnings "Your user account is missing email address" and > "Your user account is missing SMS number" >4. See that the SMS and Email checkboxes are disabled in the messaging > preferences table. >5. At the bottom of the page, set SMS number >6. Refresh page, observe only one warning "Your user account is missing > email address" and observe the SMS checkboxes are now clickable. >7. Give your test patron a primary email address >8. Refresh OPAC "your messaging" page >9. Observe all warnings are now gone and both SMS number and Email checkboxes > in the messaging preferences table are clickable. >10. Set patron some messaging preferences and make sure your change applies. > >---- INTRANET ---- >1. Repeat "OPAC" steps but instead of "your messaging" page, use the > "Modify patron" view. >--- > C4/Form/MessagingPreferences.pm | 16 ++++++++++- > .../en/includes/messaging-preference-form.inc | 27 +++++++++++++++---- > .../bootstrap/en/modules/opac-messaging.tt | 20 +++++++++++--- > 3 files changed, 53 insertions(+), 10 deletions(-) > >diff --git a/C4/Form/MessagingPreferences.pm b/C4/Form/MessagingPreferences.pm >index 01e2892304..7cfbe4a257 100644 >--- a/C4/Form/MessagingPreferences.pm >+++ b/C4/Form/MessagingPreferences.pm >@@ -142,6 +142,7 @@ sub set_form_values { > my ($target_params, $template) = @_; > # walk through the options and update them with these borrower_preferences > my $messaging_options = Koha::Patron::Message::Preferences->get_options; >+ my $patron = Koha::Patrons->find($target_params->{borrowernumber}); > PREF: foreach my $option ( @$messaging_options ) { > my $pref = Koha::Patron::Message::Preferences->find( { %{ $target_params }, message_attribute_id => $option->{'message_attribute_id'} } ); > $option->{ $option->{'message_name'} } = 1; >@@ -154,9 +155,22 @@ sub set_form_values { > selected => $_ == $days_in_advance } > } ( 0..MAX_DAYS_IN_ADVANCE ); > } >+ >+ if ($option->{'transport_email'} and !$patron->email) { >+ $option->{'transports_email'} = 0; >+ $option->{'transports_email_disabled'} = 1; >+ } >+ if ($option->{'transport_sms'} and !$patron->smsalertnumber) { >+ $option->{'transports_sms'} = 0; >+ $option->{'transports_sms_disabled'} = 1; >+ } >+ > next unless $pref; > foreach my $transport ( keys %{$pref->message_transport_types} ) { >- $option->{'transports_'.$transport} = 1; >+ if (!$option->{'transports_'.$transport.'_disabled'}) { >+ $option->{'transports_'.$transport.'_disabled'} = 0; >+ $option->{'transports_'.$transport} = 1; >+ } > } > $option->{'digest'} = 1 if $pref->wants_digest; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >index fd3c778356..ce873e9ddd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc >@@ -1,6 +1,23 @@ > [% USE Koha %] > <!-- snippet for form to set borrower and patron category messaging preferences --> >- >+<ol> >+[% IF !patron.email %] >+<li> >+ <div class="alert alert-warning"> >+ <h4>Patron is missing email address</h4> >+ <p>Because of this you will be unable to set them email messaging preferences. Please <a href="memberentry.pl?borrowernumber=[% patron.borrowernumber %]">modify patron</a> and set a primary email address.</p> >+ </div> >+</li> >+[% END %] >+[% IF SMSSendDriver and !SMSnumber %] >+<li> >+ <div class="alert alert-warning"> >+ <h4>Patron is missing SMS number</h4> >+ <p>Because of this you will be unable to set them SMS messaging preferences. Please see the bottom of this page and set an SMS number.</p> >+ </div> >+</li> >+[% END %] >+</ol> > <input type="hidden" name="modify" value="yes" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> > <table> >@@ -60,7 +77,7 @@ > value="sms" disabled="disabled" /> > [% END %] > [% ELSE %] >- [% IF ( messaging_preference.transports_sms ) %] >+ [% IF ( messaging_preference.transports_sms and !messaging_preference.transports_sms_disabled ) %] > <input type="checkbox" > id="sms[% messaging_preference.message_attribute_id | html %]" > name="[% messaging_preference.message_attribute_id | html %]" >@@ -69,7 +86,7 @@ > <input type="checkbox" > id="sms[% messaging_preference.message_attribute_id | html %]" > name="[% messaging_preference.message_attribute_id | html %]" >- value="sms" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" /> >+ value="sms" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]"[% IF messaging_preference.transports_sms_disabled %] disabled="disabled"[% END %] /> > [% END %] > [% END %] > </td> >@@ -127,7 +144,7 @@ > value="email" disabled="disabled" /> > [% END %] > [% ELSE %] >- [% IF ( messaging_preference.transports_email ) %] >+ [% IF ( messaging_preference.transports_email and !messaging_preference.transports_email_disabled ) %] > <input type="checkbox" > id="email[% messaging_preference.message_attribute_id | html %]" > name="[% messaging_preference.message_attribute_id | html %]" >@@ -136,7 +153,7 @@ > <input type="checkbox" > id="email[% messaging_preference.message_attribute_id | html %]" > name="[% messaging_preference.message_attribute_id | html %]" >- value="email" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" /> >+ value="email" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]"[% IF messaging_preference.transports_email_disabled %] disabled="disabled"[% END %] /> > [% END %] > [% END %] > </td> >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 ac959c14a3..f58b250c50 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -34,6 +34,18 @@ > [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) %] > <div id="usermessaging" class="maincontent"> > <h3>Your messaging settings</h3> >+ [% IF !logged_in_user.email %] >+ <div class="alert alert-warning"> >+ <h4>Your user account is missing email address</h4> >+ <p>Because of this you will be unable to receive email notifications. Please go to <a href="opac-memberentry.pl">your personal details</a> and set a primary email address.</p> >+ </div> >+ [% END %] >+ [% IF SMSSendDriver and !SMSnumber %] >+ <div class="alert alert-warning"> >+ <h4>Your user account is missing SMS number</h4> >+ <p>Because of this you will be unable to receive SMS notifications. Please see the bottom of this page and set an SMS number.</p> >+ </div> >+ [% END %] > [% IF ( settings_updated ) %] > <div class="alert alert-success"><h4>Settings updated</h4></div> > [% END %] >@@ -83,10 +95,10 @@ > [% IF ( SMSSendDriver ) %] > [% IF ( messaging_preference.transport_sms ) %] > <td> >- [% IF ( messaging_preference.transports_sms ) %] >+ [% IF ( messaging_preference.transports_sms and !messaging_preference.transports_sms_disabled ) %] > <input type="checkbox" id="sms[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="sms" checked="checked" /> > [% ELSE %] >- <input type="checkbox" id="sms[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="sms" /> >+ <input type="checkbox" id="sms[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="sms"[% IF messaging_preference.transports_sms_disabled %] disabled="disabled"[% END %] /> > [% END %] > </td> > [% ELSE %] >@@ -115,10 +127,10 @@ > > [% IF ( messaging_preference.transport_email ) %] > <td> >- [% IF ( messaging_preference.transports_email ) %] >+ [% IF ( messaging_preference.transports_email and !messaging_preference.transports_email_disabled ) %] > <input type="checkbox" id="email[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="email" checked="checked" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" /> > [% ELSE %] >- <input type="checkbox" id="email[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="email" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;" /> >+ <input type="checkbox" id="email[% messaging_preference.message_attribute_id | html %]" name="[% messaging_preference.message_attribute_id | html %]" value="email" onclick = "document.opacmessaging.none[% messaging_preference.message_attribute_id | html %].checked=false;"[% IF messaging_preference.transports_email_disabled %] disabled="disabled"[% END %] /> > [% END %] > </td> > [% ELSE %] >-- >2.17.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 18595
:
63435
|
63436
|
63437
|
63438
|
63439
|
63440
|
63441
|
63794
|
63795
|
63796
|
63797
|
63798
|
63799
|
63800
|
63813
|
63815
|
63816
|
63817
|
63818
|
63819
|
63820
|
63821
|
63822
|
63823
|
63824
|
63825
|
63826
|
63827
|
63828
|
63829
|
69441
|
69442
|
69443
|
69444
|
69445
|
69446
|
69447
|
69448
|
69449
|
69450
|
69451
|
69452
|
69453
|
69667
|
69668
|
69669
|
69670
|
69671
|
69672
|
69673
|
69674
|
93873
|
93874
|
93875
|
93876
|
93877
|
93878
|
93879
|
93880
|
93908
|
94753
|
94754
|
103444
|
103445
|
103446
|
103447
|
103448
|
103449
|
103450
|
103451
|
103452
|
110151
|
110152
|
110153
|
110154
|
110155
|
110156
|
110157
|
110158
|
110159
|
112147
|
112148
|
112149
|
112150
|
112151
|
112152
|
112153
|
112154
|
112155
|
112690
|
113126
|
113192
|
113221
|
113222
|
113769
|
146541
|
146542
|
146543
|
146544
|
146545
|
146546
|
146547
|
146548
|
146549
|
146550
|
146551
|
146552