From 858a4148ebd52853f9a2c892560bfc2e4820a0c8 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 --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../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 b32136a..defca57 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -315,6 +315,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 08b8ae3..bfa4a70 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -400,3 +400,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice'); 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 d93de4e..6c876a0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6309,6 +6309,13 @@ if ( C4::Context->preference("Version") < TransformToNum($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 =head2 TableExists($table) 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.2.5