From ed599b33aaec3ea7b91fb6bfc0cc6f3c873645d4 Mon Sep 17 00:00:00 2001 From: simith Date: Wed, 11 Mar 2015 13:18:26 -0400 Subject: [PATCH] Fix koha plugin to access system pref. and EnhancedMessagingPreferences description http://bugs.koha-community.org/show_bug.cgi?id=12528 --- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 6 +++--- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt | 12 ++++++------ opac/opac-messaging.pl | 6 +----- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 93cff15..bab7994 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -116,7 +116,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'), ('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''), ('EnableSearchHistory','0','','Enable or disable search history','YesNo'), -('EnhancedMessagingPreferences','0','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), +('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), ('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'), ('ExpireReservesMaxPickUpDelayCharge','0',NULL,'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.','free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 011eb90..dadca32 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9807,6 +9807,7 @@ if ( CheckVersion($DBversion) ) { $DBversion = 'XXX'; if ( CheckVersion($DBversion) ) { $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES ('OPACEnhancedMessagingPreferences', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo')"); + $dbh->do("UPDATE systempreferences SET value = '1' WHERE variable = 'EnhancedMessagingPreferences'"); print "Upgrade to $DBversion done (Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC)\n"; SetVersion($DBversion); } 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 3799423..6883128 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 @@ -59,9 +59,9 @@ Patrons: - - pref: EnhancedMessagingPreferences 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. + yes: Show + no: "Don't show" + - "patron messaging setting on the intranet." - - pref: ExtendedPatronAttributes choices: 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 5656d35..866ec91 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -20,7 +20,7 @@
- [% IF (Authorized) %] + [% IF Koha.Preference('OPACEnhancedMessagingPreferences') %]

Your messaging settings

[% IF ( settings_updated ) %] @@ -30,7 +30,7 @@ - [% IF ( SMSSendDriver ) %][% END %][% IF ( TalkingTechItivaPhone ) %][% END %] + [% IF Koha.Preference('SMSSendDriver') %][% END %][% IF Koha.Preference('TalkingTechItivaPhoneNotification') %][% END %] [% FOREACH messaging_preference IN messaging_preferences %] [% END %] [% IF ( messaging_preference.transport_sms ) %] - [% IF ( SMSSendDriver ) %] + [% IF Koha.Preference('SMSSendDriver') %] [% END %] [% END %] - [% IF ( TalkingTechItivaPhone ) %] + [% IF Koha.Preference('TalkingTechItivaPhoneNotification') %]
 Days in advanceSMSPhoneEmailDigests only?Do not notify
 Days in advanceSMSPhoneEmailDigests only?Do not notify
[% IF ( messaging_preference.Item_Due ) %]Item due @@ -54,7 +54,7 @@ - [% IF ( messaging_preference.transports_sms ) %] @@ -64,7 +64,7 @@ [% IF ( messaging_preference.transports_phone ) %]
- [% IF ( SMSSendDriver ) %] + [% IF Koha.Preference('SMSSendDriver') %]
[% END %]
@@ -122,7 +122,7 @@ [% ELSE %]

You are not allowed to call this page directly

- To report this problem, you can email the Koha Administrator. + To report this problem, you can email the Koha Administrator. [% END %] diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index d365e32..a8c4b43 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -66,10 +66,6 @@ C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowe # warn( Data::Dumper->Dump( [ $messaging_options ], [ 'messaging_options' ] ) ); $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"), - admin => C4::Context->preference('KohaAdminEmailAddress'), - Authorized => C4::Context->preference('OPACEnhancedMessagingPreferences')); + SMSnumber => defined $borrower->{'smsalertnumber'} ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'}); output_html_with_http_headers $query, $cookie, $template->output; -- 1.9.1