X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Flog_context.pm;h=6b69a805882dc4c41843e0905baa943fce26fcff;hp=a41d3c837ff96c115fdff306293bc0439a169122;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hpb=51f97ec141f77064ca020634e7eccd85d9ead753 diff --git a/FS/FS/log_context.pm b/FS/FS/log_context.pm index a41d3c837..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 @@ -26,9 +28,14 @@ my @contexts = ( qw( queue upgrade upgrade_taxable_billpkgnum + freeside-ipifony-download freeside-paymentech-upload freeside-paymentech-download test + FS::TaxEngine::billsoft + wa_sales + wa_tax_rate_update + tax_rate_update ) ); =head1 NAME @@ -125,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