summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-03-23 19:19:39 -0700
committerIvan Kohler <ivan@freeside.biz>2016-03-23 19:19:39 -0700
commit705f668e3409858d6c34500d4c18cbcdf7b2ebd7 (patch)
tree3ddf4835adaa8ef945256ac74cd3a25006235734
parent850b3a9ce595532549ef04f828cc0089e7287af7 (diff)
optimize customer list (fix option caching in 3.x), RT#20173
-rw-r--r--FS/FS/part_pkg.pm5
-rw-r--r--FS/FS/part_pkg/flat.pm12
2 files changed, 4 insertions, 13 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 07dacfb29..73d5647e0 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1283,9 +1283,8 @@ sub option {
my( $self, $opt, $ornull ) = @_;
#cache: was pulled up in the original part_pkg query
- if ( $opt =~ /^(setup|recur)_fee$/ && defined($self->hashref->{"_$opt"}) ) {
- return $self->hashref->{"_$opt"};
- }
+ return $self->hashref->{"_opt_$opt"}
+ if exists $self->hashref->{"_opt_$opt"};
cluck "$self -> option: searching for $opt" if $DEBUG;
my $part_pkg_option =
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index 9ad583c38..2c69432b5 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -143,11 +143,7 @@ sub calc_setup {
sub unit_setup {
my($self, $cust_pkg, $sdate, $details ) = @_;
- ( exists( $self->{'Hash'}{'_opt_setup_fee'} )
- ? $self->{'Hash'}{'_opt_setup_fee'}
- : $self->option('setup_fee', 1)
- )
- || 0;
+ $self->option('setup_fee', 1) || 0;
}
sub calc_recur {
@@ -197,11 +193,7 @@ sub cutoff_day {
sub base_recur {
my($self, $cust_pkg, $sdate) = @_;
- ( exists( $self->{'Hash'}{'_opt_recur_fee'} )
- ? $self->{'Hash'}{'_opt_recur_fee'}
- : $self->option('recur_fee', 1)
- )
- || 0;
+ $self->option('recur_fee', 1) || 0;
}
sub base_recur_permonth {