RT# 38217 Improve delete button on log email page
authorMitch Jackson <mitch@freeside.biz>
Tue, 8 Jan 2019 22:19:02 +0000 (17:19 -0500)
committerMitch Jackson <mitch@freeside.biz>
Tue, 8 Jan 2019 22:28:16 +0000 (17:28 -0500)
httemplate/browse/log_email.html
httemplate/edit/log_email.html
httemplate/misc/delete-log_email.html
httemplate/search/log.html

index 007ea6f..e80b4bc 100644 (file)
@@ -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!<A HREF="javascript:areyousure_delete_log_email($logemailnum)">(delete)</A>!;
 };
 
-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 = <<EOF;
 function areyousure_delete_log_email(logemailnum) {
   if (confirm('Are you sure you want to delete log email condition #'+logemailnum+'?')) {
-${areyousure_onclick}
+    window.top.location = "${fsurl}misc/delete-log_email.html?logemailnum=" + logemailnum;
   }
 }
 EOF
index b79aba9..a81e98b 100644 (file)
@@ -41,7 +41,7 @@
            )
 %>
 <%once>
-my @contexts = sort FS::log_context->contexts;
+my @contexts = FS::log_context->contexts;
 </%once>
 <%init>
 
index cc17b15..98b25e4 100644 (file)
@@ -1,9 +1,15 @@
+<% include("/elements/header.html", 'Log email condition configuration') %>
+<P>
+  <A HREF="<% $p %>search/log.html">System Log</A>
+  | <a href="<% $p %>browse/log_email.html">Log E-Mail Condition</a>
+</p>
+
 % if ($error) {
 <P STYLE="color: red"><% $error %></P>
 % } else {
 <H1>Log email condition deleted</H1>
 <SCRIPT>
-window.top.location.reload();
+window.top.location = "<% $fsurl %>browse/log_email.html";
 </SCRIPT>
 % }
 
@@ -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;
-</%init>
 
+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'";
+}
+
+</%init>
index f6ac9d9..9be0b7d 100644 (file)
@@ -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);
 </%once>
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;