From: Mitch Jackson Date: Tue, 8 Jan 2019 22:19:02 +0000 (-0500) Subject: RT# 38217 Improve delete button on log email page X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=0edb6050aeb65200869a12d83d8de794ed384154 RT# 38217 Improve delete button on log email page --- diff --git a/httemplate/browse/log_email.html b/httemplate/browse/log_email.html index 007ea6f74..e80b4bc90 100644 --- a/httemplate/browse/log_email.html +++ b/httemplate/browse/log_email.html @@ -1,4 +1,3 @@ -<% include('/elements/init_overlib.html') %> <% include('/browse/elements/browse.html', 'title' => 'Log email condition configuration', 'name_singular' => 'condition', @@ -42,6 +41,7 @@ ], ) %> +<% include('/elements/init_overlib.html') %> <%init> @@ -73,15 +73,10 @@ my $actions = sub { qq!(delete)!; }; -my $areyousure_onclick = include('/elements/popup_link_onclick.html', - 'js_action' => q(') . $p . q(misc/delete-log_email.html?logemailnum=' + logemailnum), - 'actionlabel' => 'Delete log email condition', -); - my $areyousure = < <%once> -my @contexts = sort FS::log_context->contexts; +my @contexts = FS::log_context->contexts; <%init> diff --git a/httemplate/misc/delete-log_email.html b/httemplate/misc/delete-log_email.html index cc17b15a0..98b25e4c1 100644 --- a/httemplate/misc/delete-log_email.html +++ b/httemplate/misc/delete-log_email.html @@ -1,9 +1,15 @@ +<% include("/elements/header.html", 'Log email condition configuration') %> +

+ System Log + | Log E-Mail Condition +

+ % if ($error) {

<% $error %>

% } else {

Log email condition deleted

% } @@ -11,10 +17,17 @@ window.top.location.reload(); die "access denied" unless $FS::CurrentUser::CurrentUser->access_right([ 'View system logs', 'Configuration' ]); +my $error; my $logemailnum = $cgi->param('logemailnum'); -$logemailnum =~ /^\d+$/ or die "bad logemailnum '$logemailnum'"; -my $log_email = FS::log_email->by_key($logemailnum) - or die "logemailnum '$logemailnum' not found"; -my $error = $log_email->delete; - +if ( $logemailnum =~ /^\d+$/ ) { + if ( my $log_email = FS::log_email->by_key($logemailnum) ) { + $error = $log_email->delete; + } else { + $error = "logemailnum '$logemailnum' not found"; + } +} else { + $error = "bad logemailnum '$logemailnum'"; +} + + diff --git a/httemplate/search/log.html b/httemplate/search/log.html index f6ac9d9be..9be0b7d0a 100644 --- a/httemplate/search/log.html +++ b/httemplate/search/log.html @@ -201,7 +201,7 @@ my %colors = ( my $color_sub = sub { $colors{ $_[0]->level }; }; -my @contexts = ('', sort FS::log_context->contexts); +my @contexts = ('', FS::log_context->contexts); <%init> my $curuser = $FS::CurrentUser::CurrentUser;