[freeside-commits] branch FREESIDE_3_BRANCH updated. 30776e35f2b4bd50affc82bd0c3277e5b7dcad83

Mitch Jackson mitch at freeside.biz
Tue Jan 8 15:16:36 PST 2019


The branch, FREESIDE_3_BRANCH has been updated
       via  30776e35f2b4bd50affc82bd0c3277e5b7dcad83 (commit)
      from  ad6474af65a9894684bd5e8553e25d9e71f52bb2 (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 30776e35f2b4bd50affc82bd0c3277e5b7dcad83
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 0ff8cc868..1ae667708 100644
--- a/FS/FS/log_context.pm
+++ b/FS/FS/log_context.pm
@@ -4,8 +4,9 @@ use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs );
 
-my @contexts = ( qw(
-  test
+# 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
@@ -25,6 +26,11 @@ my @contexts = ( qw(
   freeside-ipifony-download
   freeside-paymentech-upload
   freeside-paymentech-download
+  test
+  FS::TaxEngine::billsoft
+  wa_sales
+  wa_tax_rate_update
+  tax_rate_update
 ) );
 
 =head1 NAME
@@ -121,11 +127,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 | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list