diff options
| author | Mitch Jackson <mitch@freeside.biz> | 2019-01-08 17:13:15 -0500 |
|---|---|---|
| committer | Mitch Jackson <mitch@freeside.biz> | 2019-01-08 17:49:21 -0500 |
| commit | 4978a051c40df565435e0555634c7eff4b5a8e1b (patch) | |
| tree | 94fefbd54e63c5839711a76f463a706cef9b8525 | |
| parent | fe557e7e0d3d8077b2a4a15278a6f2dee5c04e95 (diff) | |
RT# 38217 Log context list includes all contexts, not just predefined
| -rw-r--r-- | FS/FS/log_context.pm | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/FS/FS/log_context.pm b/FS/FS/log_context.pm index 3aed73cd5..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 @@ -30,6 +32,10 @@ my @contexts = ( qw( freeside-paymentech-upload freeside-paymentech-download test + FS::TaxEngine::billsoft + wa_sales + wa_tax_rate_update + tax_rate_update ) ); =head1 NAME @@ -126,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 |
