X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=f408552e36dac21151ffff71eaf6e42db5f81b1e;hb=f9930edeaceb217a6503fa49078fcff2b588caf8;hp=741eb87414ea7b1469364174596fbd209dff4756;hpb=8fdc0ea36474cfb3d1389f41691c14598559cbe7;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 741eb8741..f408552e3 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; @@ -338,7 +338,7 @@ sub insert { if ( $options{fcc_options} ) { warn " updating fcc options " if $DEBUG; - $self->process_fcc_options( $options{fcc_options} ); + $self->set_fcc_options( $options{fcc_options} ); } warn " committing transaction" if $DEBUG and $oldAutoCommit; @@ -624,7 +624,7 @@ sub replace { if ( $options->{fcc_options} ) { warn " updating fcc options " if $DEBUG; - $new->process_fcc_options( $options->{fcc_options} ); + $new->set_fcc_options( $options->{fcc_options} ); } warn " committing transaction" if $DEBUG and $oldAutoCommit; @@ -787,14 +787,14 @@ sub propagate { join("\n", @error); } -=item process_fcc_options HASHREF +=item set_fcc_options HASHREF Sets the FCC options on this package definition to the values specified in HASHREF. =cut -sub process_fcc_options { +sub set_fcc_options { my $self = shift; my $pkgpart = $self->pkgpart; my $options; @@ -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; + ''; }