X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FConf.pm;h=a37e5a6ef04bfc148c3a4762dcac4fea9168f2a3;hb=cd1a490338a5da42ab94b62b24231aa14dd5d048;hp=c4e5af4e0f5f860ec41fea849991d57503d4d6a9;hpb=cfd6a2219e498ec70d30b207b7a82037347ca7b0;p=freeside.git diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c4e5af4e0..a37e5a6ef 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1,7 +1,9 @@ package FS::Conf; -use vars qw($base_dir @config_items @base_items @card_types $DEBUG); use strict; +use vars qw( $base_dir @config_items @base_items @card_types $DEBUG + $conf_cache $conf_cache_enabled + ); use Carp; use IO::File; use File::Basename; @@ -21,6 +23,8 @@ $base_dir = '%%%FREESIDE_CONF%%%'; $DEBUG = 0; +$conf_cache_enabled = 0; + =head1 NAME FS::Conf - Freeside configuration values @@ -121,6 +125,8 @@ sub _config { my($self,$name,$agentnum,$agentonly)=@_; my $hashref = { 'name' => $name }; local $FS::Record::conf = undef; # XXX evil hack prevents recursion + $conf_cache = undef unless $conf_cache_enabled; # use cache only when it is + # safe to do so my $cv; my @a = ( ($agentnum || ()), @@ -134,9 +140,14 @@ sub _config { foreach my $a (@a) { $hashref->{agentnum} = $a; foreach my $l (@l) { - $hashref->{locale} = $l; - $cv = FS::Record::qsearchs('conf', $hashref); - return $cv if $cv; + my $key = join(':',$name, $a, $l); + if (! exists $conf_cache->{$key}){ + $hashref->{locale} = $l; + # $conf_cache is reset in FS::UID during myconnect, so the cache is + # reset per connection + $conf_cache->{$key} = FS::Record::qsearchs('conf', $hashref); + } + return $conf_cache->{$key} if $conf_cache->{$key}; } } return undef; @@ -362,6 +373,12 @@ sub set { $error = $new->insert; } + if (! $error) { + # clean the object cache + my $key = join(':',$name, $agentnum, $self->{locale}); + $conf_cache->{ $key } = $new; + } + die "error setting configuration value: $error \n" if $error; @@ -2681,6 +2698,13 @@ and customer address. Include units.', }, { + 'key' => 'banned_pay-pad', + 'section' => 'billing', + 'description' => 'Padding for encrypted storage of banned credit card hashes. If you already have new-style SHA512 entries in the banned_pay table, do not change as this will invalidate the old entries.', + 'type' => 'text', + }, + + { 'key' => 'payby-default', 'section' => 'deprecated', 'description' => 'Deprecated; in 4.x there is no longer the concept of a single "payment type". Used to indicate the default payment type. HIDE disables display of billing information and sets customers to BILL.', @@ -3936,7 +3960,7 @@ and customer address. Include units.', { 'key' => 'batchconfig-RBC', 'section' => 'billing', - 'description' => 'Configuration for Royal Bank of Canada PDS batching, four lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code.', + 'description' => 'Configuration for Royal Bank of Canada PDS batching, five lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code 5. (optional) set to TEST to turn on test mode.', 'type' => 'textarea', }, @@ -4416,6 +4440,7 @@ and customer address. Include units.', 'section' => 'invoicing', 'description' => 'Instead of showing payments (and credits) applied to the invoice, show those received since the previous invoice date.', 'type' => 'checkbox', + 'uscensus' => 'U.S. Census Bureau', }, {