[freeside-commits] branch master updated. 0edb6050aeb65200869a12d83d8de794ed384154

Mitch Jackson mitch at freeside.biz
Tue Jan 8 14:28:35 PST 2019


The branch, master has been updated
       via  0edb6050aeb65200869a12d83d8de794ed384154 (commit)
       via  5702ca6d01cd5c6c3ab457fc272d2476ddb42b1e (commit)
       via  4e95ac939f2b22719b854de1f20d67d8bc6e0803 (commit)
      from  da863bce6c626f566e5e33e5a8896f6ae4aba470 (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 0edb6050aeb65200869a12d83d8de794ed384154
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Jan 8 17:19:02 2019 -0500

    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!<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
diff --git a/httemplate/edit/log_email.html b/httemplate/edit/log_email.html
index b79aba986..a81e98b09 100644
--- a/httemplate/edit/log_email.html
+++ b/httemplate/edit/log_email.html
@@ -41,7 +41,7 @@
            )
 %>
 <%once>
-my @contexts = sort FS::log_context->contexts;
+my @contexts = FS::log_context->contexts;
 </%once>
 <%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') %>
+<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>
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);
 </%once>
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;

commit 5702ca6d01cd5c6c3ab457fc272d2476ddb42b1e
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Jan 8 17:17:09 2019 -0500

    RT# 81706 Include jQuery libraries in header-popup.html

diff --git a/httemplate/elements/header-popup.html b/httemplate/elements/header-popup.html
index 22a390e36..2c72d85df 100644
--- a/httemplate/elements/header-popup.html
+++ b/httemplate/elements/header-popup.html
@@ -31,6 +31,8 @@ Example:
 %   unless ( $no_jquery ) {
       <SCRIPT SRC="<% $fsurl %>elements/jquery-3.3.1.js"></SCRIPT>
       <SCRIPT SRC="<% $fsurl %>elements/jquery-migrate-3.0.1.min.js"></SCRIPT>
+      <SCRIPT SRC="<% $fsurl %>elements/jquery-ui-1.12.1.min.js"></SCRIPT>
+      <SCRIPT SRC="<% $fsurl %>elements/jquery.validate-1.17.0.min.js"></SCRIPT>
 %     if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) {
       <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT>
 %     }

commit 4e95ac939f2b22719b854de1f20d67d8bc6e0803
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Jan 8 17:13:15 2019 -0500

    RT# 38217 Log context list includes all contexts, not just predefined

diff --git a/FS/FS/log_context.pm b/FS/FS/log_context.pm
index 74038fc05..6b69a8058 100644
--- a/FS/FS/log_context.pm
+++ b/FS/FS/log_context.pm
@@ -4,7 +4,9 @@ use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs );
 
-my @contexts = ( qw(
+# Items in @default_contexts will always be included in the
+# output of contexts() method
+my @default_contexts = ( qw(
   bill_and_collect
   FS::cust_main::Billing::bill_and_collect
   FS::cust_main::Billing::bill
@@ -31,6 +33,9 @@ my @contexts = ( qw(
   freeside-paymentech-download
   test
   FS::TaxEngine::billsoft
+  wa_sales
+  wa_tax_rate_update
+  tax_rate_update
 ) );
 
 =head1 NAME
@@ -127,11 +132,25 @@ sub check {
 
 =item contexts
 
-Returns a list of all valid contexts.
+Returns a list of all log contexts, by combining @default_contexts
+with all context values seen in the log_context table
 
 =cut
 
-sub contexts { @contexts }
+sub contexts {
+  my $self = shift;
+
+  my %contexts = map { $_ => 1 } @default_contexts;
+
+  $contexts{ $_->context } = 1
+    for qsearch({
+      select  => 'DISTINCT context AS context',
+      table   => 'log_context',
+      hashref => {},
+    });
+
+  sort { lc $a cmp lc $b } keys %contexts;
+}
 
 =back
 

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

Summary of changes:
 FS/FS/log_context.pm                  | 25 ++++++++++++++++++++++---
 httemplate/browse/log_email.html      |  9 ++-------
 httemplate/edit/log_email.html        |  2 +-
 httemplate/elements/header-popup.html |  2 ++
 httemplate/misc/delete-log_email.html | 25 +++++++++++++++++++------
 httemplate/search/log.html            |  2 +-
 6 files changed, 47 insertions(+), 18 deletions(-)




More information about the freeside-commits mailing list