Bug 15734: Use To.json to filter audio alerts
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Oct 2018 13:47:11 +0000 (10:47 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 9 Oct 2018 15:45:03 +0000 (15:45 +0000)
Test Plan:
1) Enable audio alerts
2) Note audio alerts don't work
3) Apply this patch
4) Note audio alerts now work

Use complex selectors to test:
  #circ_returns p.problem:contains('Not checked out.')
  #doc3 > #bd

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc

index 046c7d5..6c02936 100644 (file)
@@ -1,6 +1,7 @@
 [% USE raw %]
 [% USE Asset %]
 [% USE AudioAlerts %]
+[% USE To %]
 [%# Prevent XFS attacks -%]
 [% UNLESS popup %]
     <script type="text/javascript">
@@ -70,7 +71,7 @@
     <script type="text/javascript">
         //<![CDATA[
             var AUDIO_ALERT_PATH = '[% interface | html %]/[% theme | html %]/sound/';
-            var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) | html %]' );
+            var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
         //]]>
 
         $( document ).ready(function() {