From: ivan Date: Mon, 8 Nov 2004 09:16:14 +0000 (+0000) Subject: fix bug that could cause mis-billing on upgrades! (new installs ok) X-Git-Tag: BEFORE_FINAL_MASONIZE~876 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=2cbb39a5a2c7d5788f0713031d4237890c6298b0 fix bug that could cause mis-billing on upgrades! (new installs ok) --- diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 67c7c9641..5063936a9 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