From 7091c6b274b25df13b6779bbcf9545a1f81c8f97 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 23 Oct 2015 07:55:18 -0400 Subject: [PATCH] Bug 11431: (QA followup) Add ability to edit audio alerts Signed-off-by: Katrin Fischer --- admin/audio_alerts.pl | 15 ++++-- .../prog/en/modules/admin/audio_alerts.tt | 49 +++++++++++++++++-- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/admin/audio_alerts.pl b/admin/audio_alerts.pl index d592be41c9..8470255cef 100755 --- a/admin/audio_alerts.pl +++ b/admin/audio_alerts.pl @@ -45,7 +45,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -if ( $selector && $sound ) { +if ( $id && $action && $where && $action eq 'move' ) { + Koha::AudioAlerts->find($id)->move($where); +} +elsif ( $id && $selector && $sound ) { + my $alert = Koha::AudioAlerts->find($id); + $alert->selector( $selector ); + $alert->sound( $sound ); + $alert->store(); +} +elsif ( $selector && $sound ) { Koha::AudioAlert->new( { selector => $selector, sound => $sound } )->store(); } @@ -54,10 +63,6 @@ if (@delete) { Koha::AudioAlerts->fix_precedences(); } -if ( $id && $action && $where && $action eq 'move' ) { - Koha::AudioAlerts->find($id)->move($where); -} - $template->param( AudioAlerts => 1, audio_alerts => scalar Koha::AudioAlerts->search() ); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt index 82b3b87482..489c5422bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt @@ -4,6 +4,8 @@ @@ -48,8 +80,9 @@ $( document ).ready(function() {
- Add new alert + Add new alertEdit alert + @@ -79,23 +112,28 @@ $( document ).ready(function() { - +

+ + + Cancel edit +

- - +
+ + - + [% FOREACH a IN audio_alerts %] @@ -119,6 +157,7 @@ $( document ).ready(function() { + [% END %] -- 2.39.5
  Precedence   Selector Sound 
[% a.selector %] [% a.sound %] Edit