[freeside-commits] branch FREESIDE_3_BRANCH updated. 6acb603bb4422ca282b29e962291eb3d0d86d7bd

Jonathan Prykop jonathan at 420.am
Thu Jun 16 22:54:29 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  6acb603bb4422ca282b29e962291eb3d0d86d7bd (commit)
      from  56ff5b54ef32ac5c3c03c6762e48342033ca46d8 (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 6acb603bb4422ca282b29e962291eb3d0d86d7bd
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Jun 17 00:31:09 2016 -0500

    RT#39627: System log daily context also includes Cron::bill and Cron::upload results [v3, search only]

diff --git a/FS/FS/log.pm b/FS/FS/log.pm
index 753a31f..547beb7 100644
--- a/FS/FS/log.pm
+++ b/FS/FS/log.pm
@@ -312,9 +312,16 @@ sub search {
 
   if ( $params->{'context'} ) {
     my $quoted = dbh->quote($params->{'context'});
-    push @where, 
-      "EXISTS(SELECT 1 FROM log_context WHERE log.lognum = log_context.lognum ".
-      "AND log_context.context = $quoted)";
+    if ( $params->{'context_height'} =~ /^\d+$/ ) {
+      my $subq = 'SELECT context FROM log_context WHERE log.lognum = log_context.lognum'.
+                 ' ORDER BY logcontextnum DESC LIMIT '.$params->{'context_height'};
+      push @where,
+        "EXISTS(SELECT 1 FROM ($subq) AS log_context_x WHERE log_context_x.context = $quoted)";
+    } else {
+      push @where, 
+        "EXISTS(SELECT 1 FROM log_context WHERE log.lognum = log_context.lognum ".
+        "AND log_context.context = $quoted)";
+    }
   }
 
   # agent virtualization
diff --git a/httemplate/search/log.html b/httemplate/search/log.html
index 7714f46..d4fed54 100644
--- a/httemplate/search/log.html
+++ b/httemplate/search/log.html
@@ -100,6 +100,12 @@ a:visited {text-decoration: none}
       labels => { map {$_, $_} @contexts },
       curr_value => ($cgi->param('context') || ''),
     &>
+    <BR><& /elements/checkbox.html,
+      'field' => 'context_height',
+      'postfix' => 'Only match most specific context',
+      'value' => 1,
+      'curr_value' => scalar($cgi->param('context_height')),
+    &>
   </TD>
 </TR>
 <TR>
@@ -210,7 +216,7 @@ $cgi->param('max_level', 7) unless defined($cgi->param('max_level'));
 my %search = ();
 $search{'date'} = [ FS::UI::Web::parse_beginning_ending($cgi) ];
 $search{'level'} = [ $cgi->param('min_level'), $cgi->param('max_level') ];
-foreach my $param (qw(agentnum context tablename tablenum custnum message)) {
+foreach my $param (qw(agentnum context context_height tablename tablenum custnum message)) {
   if ( $cgi->param($param) ) {
     $search{$param} = $cgi->param($param);
   }

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

Summary of changes:
 FS/FS/log.pm               |   13 ++++++++++---
 httemplate/search/log.html |    8 +++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list