Bug 22378: Fix audio alerts on SCO
authorNick Clemens <nick@bywatersolutions.com>
Wed, 20 Feb 2019 20:00:01 +0000 (20:00 +0000)
committerroot <root@f1ebe1bec408>
Tue, 26 Feb 2019 13:18:10 +0000 (13:18 +0000)
Note: The SCO only supports sounds with a full URL, not KOha built in sounds

To test:
1 - Enable audio alerts
2 -  Enable SCO
3 - Note JS error on loading the alerts
4 - Apply patch
5 - No more error
6 - Test with bug 18251

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt

index e004afd..2935351 100644 (file)
@@ -3,6 +3,7 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE AudioAlerts %]
+[% USE To %]
 [% USE Price %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
             return true;
         }
         [% IF Koha.Preference('AudioAlerts') %]
-            var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) | html %]' );
+            var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
             $( document ).ready(function() {
                 if ( AUDIO_ALERTS ) {
                     for ( var k in AUDIO_ALERTS ) {