[freeside-commits] branch FREESIDE_3_BRANCH updated. 3a62fa3cc84424ebf528ee2f67b64ea00b363921

Mitch Jackson mitch at freeside.biz
Mon Oct 22 21:53:17 PDT 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  3a62fa3cc84424ebf528ee2f67b64ea00b363921 (commit)
      from  3e6f3fa1610939bbc35a181966e38ec9d97940f7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3a62fa3cc84424ebf528ee2f67b64ea00b363921
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Oct 23 00:51:51 2018 -0400

    RT# 38217 Fix JS bug when creating an email notice

diff --git a/httemplate/browse/log_email.html b/httemplate/browse/log_email.html
index 007ea6f74..6c2bce571 100644
--- a/httemplate/browse/log_email.html
+++ b/httemplate/browse/log_email.html
@@ -6,10 +6,7 @@
                         . $add_condition_link
                         . ' | '
                         . $system_log_link
-                        . '</P>'
-                        . '<SCRIPT>'
-                        . $areyousure
-                        . '</SCRIPT>',
+                        . '</P>',
      'query'         => $query,
      'count_query'   => $count_query,
      'header'      => [ '#',
@@ -43,6 +40,24 @@
 
    ) %>
 
+<script>
+  function areyousure_delete_log_email(logemailnum) {
+    if ( confirm( 'Delete log email condition #' + logemailnum )) {
+        console.log('ok?');
+      <%
+        include(
+          '/elements/popup_link_onclick.html' => {
+            js_action   => qq( '${fsurl}/misc/delete-log_email.html?logemailnum=' + logemailnum ),
+            actionlabel => 'Delete log email condition',
+            nofalse     => 1,
+          }
+        )
+      %>
+      return;
+    }
+  }
+</script>
+
 <%init>
 
 my $curuser = $FS::CurrentUser::CurrentUser;
@@ -50,11 +65,7 @@ my $curuser = $FS::CurrentUser::CurrentUser;
 die "access denied"
   unless $curuser->access_right([ 'View system logs', 'Configuration' ]);
 
-my $add_condition_link = include('/elements/popup_link.html',
-  'action' => $p.'edit/log_email.html?popup=1',
-  'label'  => 'Add log email condition',
-  'actionlabel' => 'Add log email condition',
-);
+my $add_condition_link = qq( <a href="${fsurl}edit/log_email.html">Add log email condition</a> );
 
 my $system_log_link = qq(<A HREF="${p}search/log.html">System Log</A>);
 
@@ -68,24 +79,10 @@ my $query = {
 my $count_query = "SELECT COUNT(*) FROM log_email";
 
 my $actions = sub {
-  my $log_email = shift;
-  my $logemailnum = $log_email->logemailnum;
+  my $logemailnum = shift->logemailnum;
   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}
-  }
-}
-EOF
-
 my $editlink = [ $p.'edit/log_email.html?logemailnum=', 'logemailnum' ];
 
 </%init>
diff --git a/httemplate/misc/delete-log_email.html b/httemplate/misc/delete-log_email.html
index cc17b15a0..5a6bdc083 100644
--- a/httemplate/misc/delete-log_email.html
+++ b/httemplate/misc/delete-log_email.html
@@ -3,7 +3,7 @@
 % } else {
 <H1>Log email condition deleted</H1>
 <SCRIPT>
-window.top.location.reload();
+window.top.location = "<% $fsurl %>browse/log_email.html";
 </SCRIPT>
 % }
 
@@ -11,10 +11,12 @@ window.top.location.reload();
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right([ 'View system logs', 'Configuration' ]);
 
-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;
+  my $error;
+  my $logemailnum = $cgi->param('logemailnum');
+  if ( $logemailnum && $logemailnum =~ /^\d+$/ ) {
+    if ( my $log_email = FS::log_email->by_key( $logemailnum ) ) {
+      $error = $log_email->delete;
+    }
+  }
 </%init>
 

-----------------------------------------------------------------------

Summary of changes:
 httemplate/browse/log_email.html      | 45 ++++++++++++++++-------------------
 httemplate/misc/delete-log_email.html | 14 ++++++-----
 2 files changed, 29 insertions(+), 30 deletions(-)




More information about the freeside-commits mailing list