From 28165279e149160f52571575877c995d29df0005 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Thu, 19 Jun 2014 08:21:43 -0400
Subject: [PATCH] Bug 11431 [2] - Rename soundon to AudioAlerts, move to it's own preference section

---
 circ/circulation.pl                                |    2 +-
 circ/returns.pl                                    |    2 +-
 installer/data/mysql/sysprefs.sql                  |    2 +-
 installer/data/mysql/updatedatabase.pl             |    8 ++++++++
 .../prog/en/includes/doc-head-close.inc            |    2 +-
 .../en/modules/admin/preferences/circulation.pref  |   13 +++++++------
 6 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/circ/circulation.pl b/circ/circulation.pl
index 81737ee..8381b78 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -547,7 +547,7 @@ $template->param(
     inprocess         => $inprocess,
     is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
     circview => 1,
-    soundon           => C4::Context->preference("SoundOn"),
+    AudioAlerts           => C4::Context->preference("AudioAlerts"),
     fast_cataloging   => $fast_cataloging,
     CircAutoPrintQuickSlip   => C4::Context->preference("CircAutoPrintQuickSlip"),
     activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
diff --git a/circ/returns.pl b/circ/returns.pl
index 428edb1..3701815 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -596,7 +596,7 @@ $template->param(
     dropboxmode    => $dropboxmode,
     dropboxdate    => output_pref($dropboxdate),
     overduecharges => $overduecharges,
-    soundon        => C4::Context->preference("SoundOn"),
+    AudioAlerts        => C4::Context->preference("AudioAlerts"),
     BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
 );
 
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ed427ea..64b0b85 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -364,7 +364,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('SlipCSS','',NULL,'Slips CSS url.','free'),
 ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'),
 ('SocialNetworks','0','','Enable/Disable social networks links in opac detail pages','YesNo'),
-('soundon','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
+('AudioAlerts','0','','Enable circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.','YesNo'),
 ('SpecifyDueDate','1','','Define whether to display \"Specify Due Date\" form in Circulation','YesNo'),
 ('SpecifyReturnDate',1,'','Define whether to display \"Specify Return Date\" form in Circulation','YesNo'),
 ('SpineLabelAutoPrint','0','','If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.','YesNo'),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 1030454..0ff7180 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8570,6 +8570,14 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{UPDATE systempreferences SET variable = 'AudioAlerts' WHERE variable = 'soundon'});
+
+    print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
index d9f9171..9a0b9f5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
@@ -62,7 +62,7 @@
     </script>
 [% END %]
 
-[% IF soundon %]
+[% IF AudioAlerts %]
     <script type="text/javascript">
         //<![CDATA[
             var TMPL_SOUND_PATH = "[% interface %]/[% theme %]/sound/";
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index 55d8a78..b5d90b6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -40,12 +40,6 @@ Circulation:
                   desc: latest to earliest
             - due date.
         -
-            - pref: soundon
-              choices: 
-                 yes: "Enable"
-                 no: "Don't enable"
-            - circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.
-        -
             - pref: SpecifyDueDate
               choices:
                   yes: Allow
@@ -619,3 +613,10 @@ Circulation:
                   yes: Use
                   no: "Don't use"
             - course reserves
+    Audio Alerts:
+        -
+            - pref: AudioAlerts 
+              choices: 
+                 yes: "Enable"
+                 no: "Don't enable"
+            - circulation sounds during checkin and checkout in the staff interface.  Not supported by all web browsers yet.
-- 
1.7.2.5