Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC
Summary: Enable staff to deny message setting access to patrons on the OPAC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bouzid Fergani
QA Contact: Testopia
URL:
Keywords:
: 9254 (view as bug list)
Depends on:
Blocks: 16418
  Show dependency treegraph
 
Reported: 2014-07-03 17:49 UTC by simith.doliveira
Modified: 2017-06-14 22:15 UTC (History)
17 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (4.57 KB, patch)
2014-07-03 18:05 UTC, simith.doliveira
Details | Diff | Splinter Review
[Signed-off] Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (4.74 KB, patch)
2014-07-29 06:33 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (3.73 KB, patch)
2014-07-30 15:11 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (7.08 KB, patch)
2014-07-30 15:37 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (3.00 KB, patch)
2014-08-02 08:39 UTC, Chris Cormack
Details | Diff | Splinter Review
Patch with updatedatabase.pl included (1.09 KB, patch)
2014-08-21 12:53 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (4.92 KB, patch)
2015-03-04 19:48 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (3.06 KB, patch)
2015-03-04 19:49 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 12528 Patch with updatedatabase.pl included (1.11 KB, patch)
2015-03-04 19:49 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Fix koha plugin to access system pref. and EnhancedMessagingPreferences description (8.83 KB, patch)
2015-03-11 17:20 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (6.66 KB, patch)
2015-11-02 21:54 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (5.89 KB, patch)
2015-11-12 20:49 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (6.10 KB, patch)
2015-11-12 21:29 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (3.22 KB, patch)
2015-12-21 14:47 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (6.97 KB, patch)
2015-12-21 15:21 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (7.14 KB, patch)
2015-12-23 21:06 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences (2.23 KB, patch)
2015-12-28 14:01 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences (2.28 KB, patch)
2015-12-29 02:17 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 12528 - add check EnhancedMessagingPreference when call directly opac/opac-messaging.pl (1.46 KB, patch)
2015-12-30 13:46 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528 - Rename OPACEnhancedMessagingPreferences and add redirect to 404 if at least 1 pref is off (5.19 KB, patch)
2015-12-31 15:34 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC (6.53 KB, patch)
2016-01-04 09:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: redirect to 404 if at least 1 pref is off (903 bytes, patch)
2016-01-04 09:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (7.14 KB, patch)
2016-04-25 15:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences (2.28 KB, patch)
2016-04-25 15:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC (6.53 KB, patch)
2016-04-25 15:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: redirect to 404 if at least 1 pref is off (893 bytes, patch)
2016-04-25 15:34 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC (6.66 KB, patch)
2016-04-29 12:59 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 12528: redirect to 404 if at least 1 pref is off (1.01 KB, patch)
2016-04-29 13:00 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC (7.21 KB, patch)
2016-04-29 14:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences (2.35 KB, patch)
2016-04-29 14:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC (6.73 KB, patch)
2016-04-29 14:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: redirect to 404 if at least 1 pref is off (1.08 KB, patch)
2016-04-29 14:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12528: Add IGNORE to the INSERT statement (1.10 KB, patch)
2016-04-29 14:53 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description simith.doliveira 2014-07-03 17:49:31 UTC
Enable staff to deny message setting access to patrons on the OPAC

The problem:

The preference EnhancedMessagingPreferences control access to patron message setting in both intranet (Patrons -> Details or Patrons -> Edit) and OPAC ( user's settings - > your messaging).
Comment 1 simith.doliveira 2014-07-03 18:05:11 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2014-07-29 06:33:30 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-07-29 21:45:37 UTC
Simith, please remember to assign patches to yourself :)
Comment 4 Katrin Fischer 2014-07-29 21:58:12 UTC
I really like this, as I have been asked to hide the message settings quite often and right now there is no solution the user can't get around. 

But there is a problem with this patch there: it just deactivates the visibility of the tab in the templates, but it doesn't block accessing the message settings page if you know the URL. I know we have fixed that for other pages in patron account, could you take a look and try to fix this? 

Database update looks good, the new condition could be added to the existing [%IF ...%], but not a blocker.
Comment 5 simith.doliveira 2014-07-30 15:11:35 UTC Comment hidden (obsolete)
Comment 6 simith.doliveira 2014-07-30 15:37:13 UTC Comment hidden (obsolete)
Comment 7 simith.doliveira 2014-07-30 15:46:01 UTC
Fix done, Url access blocked
Comment 8 Chris Cormack 2014-08-02 08:39:01 UTC Comment hidden (obsolete)
Comment 9 Chris Cormack 2014-08-02 08:39:56 UTC
Hi Simith

As your first patch was already signed off, I reformatted your second to only include the new changes and signed off on that.
Comment 10 Katrin Fischer 2014-08-17 19:58:58 UTC
I am sorry, those patches look ok, but the database update is missing.
Comment 11 simith.doliveira 2014-08-21 12:53:32 UTC Comment hidden (obsolete)
Comment 12 Mirko Tietgen 2015-03-04 19:48:57 UTC Comment hidden (obsolete)
Comment 13 Mirko Tietgen 2015-03-04 19:49:09 UTC Comment hidden (obsolete)
Comment 14 Mirko Tietgen 2015-03-04 19:49:23 UTC Comment hidden (obsolete)
Comment 15 Mirko Tietgen 2015-03-04 19:52:38 UTC
The description of EnhancedMessagingPreferences should probably be reworded as it does not make much sense in combination with OPACEnhancedMessagingPreferences.
Comment 16 Jonathan Druart 2015-03-05 09:37:33 UTC
Comment on attachment 36512 [details] [review]
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC

Review of attachment 36512 [details] [review]:
-----------------------------------------------------------------

::: opac/opac-messaging.pl
@@ +69,5 @@
>                    SMSnumber => defined $borrower->{'smsalertnumber'} ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'},
>                    SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
> +                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification"),
> +                  admin                        =>  C4::Context->preference('KohaAdminEmailAddress'),
> +                  Authorized                   =>  C4::Context->preference('OPACEnhancedMessagingPreferences'));

Please use the Koha plugin to access system preference values from the templates ([% IF Koha.Preference('OPACEnhancedMessagingPreferences') %]).
And maybe EnhancedMessagingPreferences should be checked too, according to the description of the syspref.
Comment 17 simith.doliveira 2015-03-11 17:20:05 UTC Comment hidden (obsolete)
Comment 18 Marc Véron 2015-10-20 19:14:44 UTC
Patch does not apply:


Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Auto-merging installer/data/mysql/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/sysprefs.sql
Failed to merge in the changes.
Comment 19 Bouzid Fergani 2015-11-02 21:54:52 UTC Comment hidden (obsolete)
Comment 20 Bouzid Fergani 2015-11-02 22:05:56 UTC
I redone all patch because it's necessary, I create one good patch work correctly.
Comment 21 Frédéric Demians 2015-11-12 07:54:02 UTC
In opac-messaging.pl, you should remove 'Authorized' parameter, and use in
opac-messaging.tt:

[% IF Koha.Preference( 'OPACEnhancedMessagingPreferences' ) %]
Comment 22 Bouzid Fergani 2015-11-12 20:49:20 UTC Comment hidden (obsolete)
Comment 23 Bouzid Fergani 2015-11-12 21:00:33 UTC
I removed 'Authorized' parameter in opac-messaging.pl
and used  in opac-messaging.tt  [% IF Koha.Preference( 'OPACEnhancedMessagingPreferences' ) %].
Comment 24 Frédéric Demians 2015-11-12 21:25:18 UTC
(In reply to Bouzid from comment #23)
> I removed 'Authorized' parameter in opac-messaging.pl
> and used  in opac-messaging.tt  [% IF Koha.Preference(
> 'OPACEnhancedMessagingPreferences' ) %].

Thanks. The code seems OK now.

I realize that the wording of the 2 sysprefs are not that clear. The two
together. And it's not your syspref which sound strange bug the initial:

  EnhancedMessagingPreferences: Allow/Don't allow patrons to choose which
  notices they receive and when they receive them. Note that this only applies
  to certain kinds of notices.

This give the feeling that the patron will be allowed to change their
notifications themselves.

Anyway your patch works.
Comment 25 Frédéric Demians 2015-11-12 21:29:03 UTC Comment hidden (obsolete)
Comment 26 Jonathan Druart 2015-12-02 09:38:02 UTC
Comment on attachment 44826 [details] [review]
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC

Review of attachment 44826 [details] [review]:
-----------------------------------------------------------------

The description for EnhancedMessagingPreferences is "allow/don't allow patrons to choose which notices they receive and when they receive them.
I think it could be updated to highlight that it's for the staff interface only, or at least a reference to the new pref?

Why don't you want the patrons to show the type of messages they receive?
I could understand not to let the patrons change the settings, but I don't see the point to hide them completely.

::: installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql
@@ +1,3 @@
> +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo')
> +;

It would be better to set the value of the other pref, to avoid any confusion.

::: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt
@@ +131,5 @@
>                      </form>
>                  </div> <!-- / #usermessaging -->
> +                [% ELSE %]
> +                    <h4>You are not allowed to call this page directly</h4>
> +                    <span> To report this problem, you can <a href="mailto:[% admin %]">email the Koha Administrator</a>.</span>

"admin" does not seem to be sent to the template.
Comment 27 Francois Charbonnier 2015-12-02 21:46:10 UTC
(In reply to Jonathan Druart from comment #26)
> Comment on attachment 44826 [details] [review] [review]
> Bug 12528 - Enable staff to deny message setting access to patrons on the
> OPAC
> 
> Review of attachment 44826 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> The description for EnhancedMessagingPreferences is "allow/don't allow
> patrons to choose which notices they receive and when they receive them.
> I think it could be updated to highlight that it's for the staff interface
> only, or at least a reference to the new pref?

You're right. We will change the preference description.
It will be :

[Allow/Don't allow] staff to manage which notices patrons will receive and when they will receive them. Note : this only applies to courtesy notices. To manage if patrons have also access to these settings, use OPACEnhancedMessagingPreferences.


> Why don't you want the patrons to show the type of messages they receive?
> I could understand not to let the patrons change the settings, but I don't
> see the point to hide them completely.

By hiding them, you avoid the question : "Why can't I change my settings by myself?" ;^)

> ::: installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql
> @@ +1,3 @@
> > +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> > +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo')
> > +;
> 
> It would be better to set the value of the other pref, to avoid any
> confusion.

EnhancedMessagingPreference is already setup by updatedatabase so I don't think this should be change by the atomicupdate here. Moreover, we don't want to change the current setting when the library will run this update.

> ::: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt
> @@ +131,5 @@
> >                      </form>
> >                  </div> <!-- / #usermessaging -->
> > +                [% ELSE %]
> > +                    <h4>You are not allowed to call this page directly</h4>
> > +                    <span> To report this problem, you can <a href="mailto:[% admin %]">email the Koha Administrator</a>.</span>
> 
> "admin" does not seem to be sent to the template.

We are currently working on this. :^)
Comment 28 Jonathan Druart 2015-12-03 08:43:47 UTC
(In reply to Francois Charbonnier from comment #27)
> > Why don't you want the patrons to show the type of messages they receive?
> > I could understand not to let the patrons change the settings, but I don't
> > see the point to hide them completely.
> 
> By hiding them, you avoid the question : "Why can't I change my settings by
> myself?" ;^)

But can answer the question "Why am I receiving email for that?"
We can imagine a quick sentence "Contact your library if you want to change them"

> > ::: installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql
> > @@ +1,3 @@
> > > +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> > > +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo')
> > > +;
> > 
> > It would be better to set the value of the other pref, to avoid any
> > confusion.
> 
> EnhancedMessagingPreference is already setup by updatedatabase so I don't
> think this should be change by the atomicupdate here. Moreover, we don't
> want to change the current setting when the library will run this update.

OPACEnhancedMessagingPreferences is added (for existing install, so in updatedatabase.pl) and enabled.
It does not hurt if EnhancedMessagingPreference is disabled, because in the code both are checked.
But it would be better to enable OPACEnhancedMessagingPreferences only if EnhancedMessagingPreference is enabled too.
It will avoid to have
"OPACEnhancedMessagingPreference is enabled but not really because EnhancedMessagingPreference is not" on the admin pref page.
Comment 29 Frédéric Demians 2015-12-03 09:13:48 UTC
Suggestion for OPACEnhancedMessagingPreferences. It could have 3 values rather
than 2:

  0- Not displayed
  1- Displayed
  2- Modifiable 

When updating an existing DB (see Jonathan comment):

  my $emp = C4::Context->preference('EnhancedMessagingPreferences')
            ? 2 : 0;
  INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES
  ('OPACEnhancedMessagingPreferences', $emp, NULL,
    'Not display/display/modify patrons messaging setting on the OPAC.', 'YesNo')
Comment 30 Marc Véron 2015-12-03 15:40:31 UTC
For the sake of better translatability (no string spltting by html tags), I propose to change
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt line 135:

<span> To report this problem, you can <a href="mailto:[% admin %]">email the Koha Administrator</a>.</span>

... to something like:

<span> To report this problem, please contact the Koha Administrator: <a href="mailto:[% admin %]">Email.</a></span>
Comment 31 Francois Charbonnier 2015-12-03 20:56:27 UTC
(In reply to Jonathan Druart from comment #28)
> > > ::: installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql
> > > @@ +1,3 @@
> > > > +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> > > > +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo')
> > > > +;
> > > 
> > > It would be better to set the value of the other pref, to avoid any
> > > confusion.
> > 
> > EnhancedMessagingPreference is already setup by updatedatabase so I don't
> > think this should be change by the atomicupdate here. Moreover, we don't
> > want to change the current setting when the library will run this update.
> 
> OPACEnhancedMessagingPreferences is added (for existing install, so in
> updatedatabase.pl) and enabled.
> It does not hurt if EnhancedMessagingPreference is disabled, because in the
> code both are checked.
> But it would be better to enable OPACEnhancedMessagingPreferences only if
> EnhancedMessagingPreference is enabled too.
> It will avoid to have
> "OPACEnhancedMessagingPreference is enabled but not really because
> EnhancedMessagingPreference is not" on the admin pref page.

I agree. We will change the atomic update to enable the OPACEnhancedMessagingPreferences only if EnhancedMessagingPreference is enable as well.
Comment 32 Francois Charbonnier 2015-12-03 21:39:06 UTC
(In reply to Jonathan Druart from comment #28)
> (In reply to Francois Charbonnier from comment #27)
> > > Why don't you want the patrons to show the type of messages they receive?
> > > I could understand not to let the patrons change the settings, but I don't
> > > see the point to hide them completely.
> > 
> > By hiding them, you avoid the question : "Why can't I change my settings by
> > myself?" ;^)
> 
> But can answer the question "Why am I receiving email for that?"
> We can imagine a quick sentence "Contact your library if you want to change
> them"

I like Frederic's option but we will not do it. :^) If anyone want his third option, I'll suggest to open a new ticket for the enhancement.

My thoughts on this are : this patch does not change the current behaviour if not activated. For libraries who can see how useful it is (like the one who sponsored it, use it for more than a year now and hasn't got any complaint so far), it's there. For libraries who doesn't see it, they just don't activate it. Everybody's happy! :^)

In the end, I'll just take the opportunity to say that I know how developers don't like new system preferences (I understand their points) but us, librarians, do like them a lot. They allow us to be even more in control of our ILS which I think is fantastic. We can all agree Koha is all about empowering librarians with new features, right? But, the difficulty is to find the better way do it. I think we should always see it as a step by step process.

This patch is the first step for a better courtesy notices management. Once this patch is pushed, it will benefit the libraries who see its usefullness and change nothing for libraries who can't see it. AND it will let anybody who want to enhanced it to go further.

So please, lets not abandoned this patch in the small enhancement patches limbo of bugzilla because we want to move two steps at a time. Let's do it step by step! 

Thanks!!! :^)
Comment 33 David Cook 2015-12-03 23:24:28 UTC
No idea where this is at now (even after reading most of the comments), but it's exciting nonetheless!

I usually hide these using jQuery, which isn't really the best solution, so it would be great to have a system preference for this...
Comment 34 Marc Véron 2015-12-03 23:46:08 UTC
(In reply to Francois Charbonnier from comment #32)
(...) 
> So please, lets not abandoned this patch in the small enhancement patches
> limbo of bugzilla because we want to move two steps at a time. Let's do it
> step by step! 

Step by step ++
Comment 35 Frédéric Demians 2015-12-04 06:25:24 UTC
(In reply to Francois Charbonnier from comment #32)

> So please, lets not abandoned this patch in the small enhancement patches
> limbo of bugzilla because we want to move two steps at a time. Let's do it
> step by step! 

I agree. You have to strike while the iron is hot. I'd be pleased to re-sign-off this patch as soon as issue rightly raised by Jonathan will be addressed.
Comment 36 Jonathan Druart 2015-12-07 09:59:26 UTC
(In reply to Frédéric Demians from comment #35)
> (In reply to Francois Charbonnier from comment #32)
> 
> > So please, lets not abandoned this patch in the small enhancement patches
> > limbo of bugzilla because we want to move two steps at a time. Let's do it
> > step by step! 
> 
> I agree. You have to strike while the iron is hot. I'd be pleased to
> re-sign-off this patch as soon as issue rightly raised by Jonathan will be
> addressed.

And I will be happy to re-qa it ;)
Comment 37 Bouzid Fergani 2015-12-21 14:47:49 UTC Comment hidden (obsolete)
Comment 38 Bouzid Fergani 2015-12-21 15:21:13 UTC Comment hidden (obsolete)
Comment 39 Chris Cormack 2015-12-23 21:06:26 UTC Comment hidden (obsolete)
Comment 40 Jonathan Druart 2015-12-26 11:41:51 UTC
Comment on attachment 45962 [details] [review]
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC

Review of attachment 45962 [details] [review]:
-----------------------------------------------------------------

Please provide a quick fix, it's easy :)

::: installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql
@@ +1,4 @@
> +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo') ON DUPLICATE KEY UPDATE value ='1';
> +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES
> +('EnhancedMessagingPreferences', '1', NULL, 'If ON, allows patrons to select to receive additional messages about items due or nearly due.', 'YesNo') ON DUPLICATE KEY UPDATE value ='1';

Why do you want to modify the values on duplicate?
You just need to insert the new pref OPACEnhancedMessagingPreferences with the same value as EnhancedMessagingPreferences.

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
@@ +157,5 @@
> +         - pref: OPACEnhancedMessagingPreferences
> +           choices:
> +               yes: Show
> +               no: "Don't show"
> +         - "patron messaging setting on the OPAC (NOTE: EnhancedMessagingPreferences must be enabled)."

No need to uppercase NOTE.
Comment 41 Bouzid Fergani 2015-12-28 14:01:35 UTC Comment hidden (obsolete)
Comment 42 Aleisha Amohia 2015-12-29 02:17:39 UTC Comment hidden (obsolete)
Comment 43 Jonathan Druart 2015-12-30 11:52:09 UTC
Actually, this bug is a duplicate of bug 12528, sorry not to have see that before.
Comment 44 Jonathan Druart 2015-12-30 11:52:29 UTC
(In reply to Jonathan Druart from comment #43)
> Actually, this bug is a duplicate of bug 12528, sorry not to have see that
> before.

Read bug 9254.
Comment 45 Jonathan Druart 2015-12-30 11:53:44 UTC
See Kyle's followup bug 9254 comment 4
Comment 46 Jonathan Druart 2015-12-30 11:57:59 UTC
Another issue is that there is no check in the opac/opac-messaging.pl script to forbid the user to modify the messaging changes, see my quick patch on bug 9254 comment 16.

The correct way to continue here would be to mark this one as a duplicate of bug 9254 and work on it.
Comment 47 Bouzid Fergani 2015-12-30 13:46:25 UTC Comment hidden (obsolete)
Comment 48 Jonathan Druart 2015-12-30 13:57:48 UTC
(In reply to Bouzid from comment #47)

Please answer before switching back to Needs Signoff.
Comment 49 Francois Charbonnier 2015-12-30 14:05:18 UTC
Hi Jonathan,
We should work on this patch because we have someone to work on it right now.
The other one will be an enhancement of this one.
Thanks et bonne année! ;)
Comment 50 Jonathan Druart 2015-12-30 15:08:51 UTC
(In reply to Francois Charbonnier from comment #49)
> Hi Jonathan,
> We should work on this patch because we have someone to work on it right now.
> The other one will be an enhancement of this one.
> Thanks et bonne année! ;)

Have you read the comments on bug 9254 I have pointed out?
It's not an enhancement, both bug reports have the same goal.
There is no need to ask for a signoff, it will fail QA.
Comment 51 Eric Bégin 2015-12-30 19:28:55 UTC
Howdy !

> There is no need to ask for a signoff, it will fail QA.
The latest commit by Bouzid fixed the problem from accessing the page when disabled (BTW, I asked him to change the code to have a single IF / ELSE statement in the .tt and change the pref name for EnhancedMessagingPreferencesOPAC which he will commit soon).

Concerning bug 9254, it basically add another option to the EnhancedMessagingPreferencesOPAC, so, from my understanding it's not quite a duplicate, but an enhancement of this one, as Francois pointed out.

@Jonathan : Just want to check with you that this bug will move forward if we fix the behaviour when accessing the URL and changing the pref name.

Cheers !
Comment 52 Jonathan Druart 2015-12-31 09:39:31 UTC
(In reply to Eric Bégin from comment #51)
> Howdy !
> 
> > There is no need to ask for a signoff, it will fail QA.
> The latest commit by Bouzid fixed the problem from accessing the page when
> disabled (BTW, I asked him to change the code to have a single IF / ELSE
> statement in the .tt and change the pref name for
> EnhancedMessagingPreferencesOPAC which he will commit soon).

No, it's not. Please see, read and follow link on comment 46:
"Another issue is that there is no check in the opac/opac-messaging.pl script to forbid the user to modify the messaging changes, see my quick patch on bug 9254 comment 16."
It's not because a page is not accessible that a user cannot call it and pass parameters via POST or GET.

> Concerning bug 9254, it basically add another option to the
> EnhancedMessagingPreferencesOPAC, so, from my understanding it's not quite a
> duplicate, but an enhancement of this one, as Francois pointed out.

We already discussed about that here, and we all on that.
The discussions are exactly the same on both bug report, that's why I said it's a duplicate.

> @Jonathan : Just want to check with you that this bug will move forward if
> we fix the behaviour when accessing the URL and changing the pref name.

Yes.
Comment 53 Bouzid Fergani 2015-12-31 15:34:37 UTC Comment hidden (obsolete)
Comment 54 Jonathan Druart 2016-01-04 09:27:14 UTC Comment hidden (obsolete)
Comment 55 Jonathan Druart 2016-01-04 09:27:20 UTC Comment hidden (obsolete)
Comment 56 Jonathan Druart 2016-01-04 09:28:03 UTC
Please keep authorship
Comment 57 Marc Véron 2016-04-17 13:49:17 UTC
Does not apply:

Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Auto-merging installer/data/mysql/sysprefs.sql
Applying: Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences
Applying: Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC
fatal: sha1 information is lacking or useless (installer/data/mysql/sysprefs.sql).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC
Comment 58 Jonathan Druart 2016-04-22 20:15:51 UTC
Bouzid, why did you want me to rebase this patchset?
Comment 59 Bouzid Fergani 2016-04-25 12:46:14 UTC
Jonathan,
I rebase you this patchset, because you are author of --Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC--, when apply this patch, it fail at this, it show a message:
    Applying: Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC
fatal: sha1 information is lacking or useless (installer/data/mysql/sysprefs.sql).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC
Bouzid.
Comment 60 Jonathan Druart 2016-04-25 15:32:47 UTC
(In reply to Bouzid from comment #59)
> Jonathan,
> I rebase you this patchset, because you are author of --Bug 12528: Bug 9254:
> Followup - Rename pref to EnhancedMessagingPreferencesOPAC

I am not, Kyle is the author of this patch.
Rebased patches are coming.
Comment 61 Jonathan Druart 2016-04-25 15:33:44 UTC Comment hidden (obsolete)
Comment 62 Jonathan Druart 2016-04-25 15:33:50 UTC Comment hidden (obsolete)
Comment 63 Jonathan Druart 2016-04-25 15:33:55 UTC Comment hidden (obsolete)
Comment 64 Jonathan Druart 2016-04-25 15:34:01 UTC Comment hidden (obsolete)
Comment 65 Marc Véron 2016-04-29 12:59:28 UTC Comment hidden (obsolete)
Comment 66 Marc Véron 2016-04-29 13:00:32 UTC Comment hidden (obsolete)
Comment 67 Jonathan Druart 2016-04-29 14:53:14 UTC
Created attachment 51000 [details] [review]
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC

- Change the preference Enhancedmessagingpreference description.
  - Enable default EnhancedMessagingPreferences and OPACEnhancedMessagingPreferences.
  - not sent e-mail it's necessary, when user call opac-messaging.pl directly..

Testing:

I Apply the patch
II Run updatedatabase.pl

0) Search OPACEnhancedMessagingPreferences preference;
1) Validate "OPACEnhancedMessagingPreferences show patron messaging
   setting on the OPAC (NOTE: EnhancedMessagingPreferences must be
   enabled).";

2) Disable OPACEnhancedMessagingPreferences preference;
3) Enable EnhancedMessagingPreferences preference;
4) On the OPAC -> user's settings, validate "your messaging" is not
   showed.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  Works as expected. With the new syspref, patrons can be forbidden to
  modify themselves their own messaging preferences.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Also, I like sysprefs
http://www.quickmeme.com/img/d9/d99723bc544e8d33572dc92f242a6f6e2dbe0126a2e35fe3de073d30d62002e6.jpg

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 68 Jonathan Druart 2016-04-29 14:53:19 UTC
Created attachment 51001 [details] [review]
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 69 Jonathan Druart 2016-04-29 14:53:27 UTC
Created attachment 51002 [details] [review]
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC

If the new pref is named EnhancedMessagingPreferencesOPAC, it will show
up adjacent to EnhancedMessagingPreferences

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 70 Jonathan Druart 2016-04-29 14:53:39 UTC
Created attachment 51003 [details] [review]
Bug 12528: redirect to 404 if at least 1 pref is off

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 71 Jonathan Druart 2016-04-29 14:53:44 UTC
Created attachment 51004 [details] [review]
Bug 12528: Add IGNORE to the INSERT statement

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 72 Kyle M Hall 2016-04-29 17:59:56 UTC
Pushed to master for Koha 16.05, thanks Bouzid!
Comment 73 Katrin Fischer 2016-09-26 04:41:05 UTC
*** Bug 9254 has been marked as a duplicate of this bug. ***