From c4f325bb759e1d6d642c01ce167c0213dd8e5354 Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Mon, 2 Nov 2015 16:45:45 -0500 Subject: [PATCH] Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC This fix permits the staff to pull apart the access to patron message setting. 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. --- .../data/mysql/atomicupdate/sysprefs_Bug12528.sql | 3 +++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 7 +++++++ .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 14 ++++++++------ .../bootstrap/en/modules/opac-messaging.tt | 7 ++++++- opac/opac-messaging.pl | 1 + 6 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql diff --git a/installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql b/installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql new file mode 100644 index 0000000..be3169a --- /dev/null +++ b/installer/data/mysql/atomicupdate/sysprefs_Bug12528.sql @@ -0,0 +1,3 @@ +INSERT INTO systempreferences ( variable, value, options, explanation,type ) VALUES +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo') +; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 5d4910e..ecc4ad9 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -267,6 +267,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'), ('OPACdidyoumean',NULL,NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'), ('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'), +('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), ('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'), ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'), ('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'), 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 a0e8587..a3237cb 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 @@ -147,6 +147,13 @@ Patrons: yes: Allow no: "Don't allow" - librarians to discharge borrowers and borrowers to request a discharge. + - + - pref: OPACEnhancedMessagingPreferences + choices: + yes: Show + no: "Don't show" + - "patron messaging setting on the OPAC (NOTE: EnhancedMessagingPreferences must be enabled)." + "Norwegian patron database": - - pref: NorwegianPatronDBEnable diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index c5a2298..f175fe3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -77,12 +77,14 @@ [% END %] [% IF ( EnhancedMessagingPreferences ) %] - [% IF ( messagingview ) %] -
  • - [% ELSE %] -
  • - [% END %] - your messaging
  • + [% IF Koha.Preference( 'OPACEnhancedMessagingPreferences' ) %] + [% IF ( messagingview ) %] +
  • + [% ELSE %] +
  • + [% END %] + your messaging
  • + [% END %] [% END %] [% IF Koha.Preference( 'virtualshelves' ) == 1 %] 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 b27756f..8d49c2a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -22,6 +22,7 @@
    + [% IF (Authorized) %]

    Your messaging settings

    [% IF ( settings_updated ) %] @@ -129,7 +130,11 @@
    -
    + [% ELSE %] +

    You are not allowed to call this page directly

    + To report this problem, you can email the Koha Administrator. + [% END %] + diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index dfd273a..ba6dda6 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -64,6 +64,7 @@ $template->param( BORROWER_INFO => [ $borrower ], messagingview => 1, SMSnumber => $borrower->{'smsalertnumber'}, SMSSendDriver => C4::Context->preference("SMSSendDriver"), + Authorized => C4::Context->preference('OPACEnhancedMessagingPreferences'), TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") ); output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; -- 1.7.9.5