From 1e077b6f1b01724f03ed7c770eb53e4fe3124b80 Mon Sep 17 00:00:00 2001 From: Vitor FERNANDES Date: Wed, 19 Dec 2012 18:39:10 +0000 Subject: [PATCH] Bug 9254: Problem with EnhancedMessagingPreferences First I don't know the right component to this bug. The problem is the following: - when enabling EnhancedMessagingPreferences, the staff client if able to set the messaging preferences for the patrons categories, and then for the patron (normally the messaging preferences are the same for everyone) - when enabling EnhancedMessagingPreferences, the patrons can set in the OPAC their messaging preferences, which can be against the library rules Solution: - enabling EnhancedMessagingPreferences, should allow the the staff client to set the patrons messaging preferences - enabling EnhancedMessagingPreferences, should't allow patrons to set their messaging preferences (the link doesn't appear in the usermenu.inc) - should be another preference to allow the patrons to set their messaging preferences. Test plan: - apply the patch - enable EnhancedMessagingPreferences, the messaging page should appear in OPAC - disable OPACEnhancedMessagingPreferences, the messaging page shouldn't appear in OPAC - disable EnhancedMessagingPreferences, the messaging page shouldn't appear in OPAC Sponsored-by: KEEP SOLUTIONS Signed-off-by: Kyle M Hall Signed-off-by: Bernardo Gonzalez Kriegel Rebased on master (2013-02-01) --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 6 ++++++ .../prog/en/modules/admin/preferences/patrons.pref | 8 +++++++- koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index efe1200..29bda39 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -317,6 +317,7 @@ sub get_template_and_user { $template->param( "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'), + OPACEnhancedMessagingPreferences => C4::Context->preference('OPACEnhancedMessagingPreferences'), GoogleJackets => C4::Context->preference("GoogleJackets"), OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"), KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ca9b6bd..7284d98 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -416,3 +416,5 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalSendNotices','0', NULL, '', 'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACEnhancedMessagingPreferences',1, 'Show the patrons messaging preferences page in the OPAC', NULL, 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a44e4e8..95d4cff 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6437,6 +6437,12 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACEnhancedMessagingPreferences',1, 'Show the patrons messaging preferences page in the OPAC', NULL, 'YesNo')"); + print "Upgrade to $DBversion done (Bug 9254: Problem with EnhancedMessagingPreferences) \n"; + SetVersion ($DBversion); +} =head1 FUNCTIONS diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 74d14af..c914dae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -60,7 +60,13 @@ Patrons: choices: yes: Allow no: "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. + - patrons to receive notices. Note that this only applies to certain kinds of notices. + - + - pref: OPACEnhancedMessagingPreferences + choices: + yes: Allow + no: "Don't allow" + - patrons to choose which notices they receive and when they receive them in the OPAC. Note that this only works if EnhancedMessagingPreferences is active. - - pref: ExtendedPatronAttributes choices: diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc index 5a07d95..b48db08 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc @@ -26,7 +26,7 @@ [% IF ( suggestionsview ) %]
  • [% ELSE %]
  • [% END %]my purchase suggestions
  • [% END %] [% END %] - [% IF ( EnhancedMessagingPreferences ) %] + [% IF ( EnhancedMessagingPreferences && OPACEnhancedMessagingPreferences ) %] [% IF ( messagingview ) %]
  • [% ELSE %]
  • [% END %]my messaging
  • [% END %] [% IF ( virtualshelves ) %] -- 1.7.9.5