From 4a899a1567cb737e81ba05e2ba904ea9aabf6c30 Mon Sep 17 00:00:00 2001 From: simith Date: Wed, 30 Jul 2014 11:25:00 -0400 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. Modified: installer/data/mysql/sysprefs.sql -OPACEnhancedMessagingPreferences preference added koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref -OPACEnhancedMessagingPreferences preference added koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc -access to message setting changed 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. --- installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc | 14 ++++++++------ koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt | 8 ++++++-- opac/opac-messaging.pl | 4 +++- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d820b94..0b74643 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -230,6 +230,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','','Define export options available on OPAC detail page.','free'), ('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'), ('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'), 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 2469431..2876677 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 @@ -138,3 +138,9 @@ Patrons: - pref: CardnumberLength - "characters long. The length can be a single number to specify an exact length, a range separated by a comma (i.e., 'Min,Max'), or a maximum with no minimum (i.e., ',Max')." - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one." + - + - pref: OPACEnhancedMessagingPreferences + choices: + yes: Show + no: "Don't show" + - "patron messaging setting on the OPAC (NOTE: EnhancedMessagingPreferences must be enabled)." \ No newline at end of file diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index 182543b..50fe23e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -79,12 +79,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 21c40c7..881d8d3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -5,7 +5,6 @@ [% INCLUDE 'masthead.inc' %] -
    + [% IF (Authorized) %]

    Your messaging settings

    [% IF ( settings_updated ) %] @@ -120,6 +120,10 @@
    + [% ELSE %] +

    You are not allowed to call this page directly

    + To report this problem, you can email the Koha Administrator. + [% END %]
    @@ -142,4 +146,4 @@ }); //]]> -[% END %] +[% END %] \ No newline at end of file diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 096dbff..74d95ef 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -68,6 +68,8 @@ $template->param( BORROWER_INFO => [ $borrower ], messagingview => 1, SMSnumber => defined $borrower->{'smsalertnumber'} ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'}, SMSSendDriver => C4::Context->preference("SMSSendDriver"), - TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") ); + TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"), + admin => C4::Context->preference('KohaAdminEmailAddress'), + Authorized => C4::Context->preference('OPACEnhancedMessagingPreferences')); output_html_with_http_headers $query, $cookie, $template->output; -- 1.9.1