summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2004-11-08 09:16:14 +0000
committerivan <ivan>2004-11-08 09:16:14 +0000
commit2cbb39a5a2c7d5788f0713031d4237890c6298b0 (patch)
tree43044562c5f2e59ace9ea86258d6eaed583ee8ab
parentd596debbf5a491141cfa86454b6f74fc70de75af (diff)
fix bug that could cause mis-billing on upgrades! (new installs ok)
-rw-r--r--FS/FS/part_pkg.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 67c7c96..5063936 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -2,7 +2,7 @@ package FS::part_pkg;
use strict;
use vars qw( @ISA %freq %plans $DEBUG );
-use Carp;
+use Carp qw(cluck);
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
@@ -454,13 +454,18 @@ Returns the option value for the given name, or the empty string.
=cut
sub option {
- my $self = shift;
+ my( $self, $opt ) = @_;
my $part_pkg_option =
qsearchs('part_pkg_option', {
pkgpart => $self->pkgpart,
- optionname => shift,
+ optionname => $opt,
} );
- $part_pkg_option ? $part_pkg_option->optionvalue : '';
+ return $part_pkg_option->optionvalue if $part_pkg_option;
+ my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
+ split("\n", $self->plandata );
+ return $plandata{$opt} if exists $plandata{$opt};
+ cluck "Package definition option $opt not found in options or plandata!\n";
+ '';
}
=item _rebless