summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-08-09 15:19:27 -0700
committerIvan Kohler <ivan@freeside.biz>2014-08-09 15:19:27 -0700
commitf9930edeaceb217a6503fa49078fcff2b588caf8 (patch)
treeb7627bbada0c78d2f8c9317201db215b60932484 /FS/FS/part_pkg.pm
parentde7167ac01e77d08f1fdd05ba229eb87b2c67e6d (diff)
optimizations for large package lists, RT#28526
Diffstat (limited to 'FS/FS/part_pkg.pm')
-rw-r--r--FS/FS/part_pkg.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 06f304a..f408552 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -31,7 +31,7 @@ use FS::part_pkg_discount;
use FS::part_pkg_vendor;
use FS::part_pkg_currency;
-$DEBUG = 0;
+$DEBUG = 1;
$setup_hack = 0;
$skip_pkg_svc_hack = 0;
@@ -1288,6 +1288,12 @@ will be suppressed.
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"};
+ }
+
cluck "$self -> option: searching for $opt"
if $DEBUG;
my $part_pkg_option =
@@ -1296,12 +1302,14 @@ sub option {
optionname => $opt,
} );
return $part_pkg_option->optionvalue if $part_pkg_option;
+
my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
split("\n", $self->get('plandata') );
return $plandata{$opt} if exists $plandata{$opt};
cluck "WARNING: (pkgpart ". $self->pkgpart. ") Package def option $opt ".
"not found in options or plandata!\n"
unless $ornull;
+
'';
}