[freeside-commits] freeside/FS/FS part_pkg.pm,1.123.2.2,1.123.2.3
Ivan,,,
ivan at wavetail.420.am
Thu Sep 8 15:04:08 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv19718
Modified Files:
Tag: FREESIDE_2_3_BRANCH
part_pkg.pm
Log Message:
fix very obsolote eval callbacks for part_pkg.setup and recur, RT#14372
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.123.2.2
retrieving revision 1.123.2.3
diff -u -w -d -r1.123.2.2 -r1.123.2.3
--- part_pkg.pm 11 Aug 2011 00:38:14 -0000 1.123.2.2
+++ part_pkg.pm 8 Sep 2011 22:04:06 -0000 1.123.2.3
@@ -851,10 +851,7 @@
sub is_free {
my $self = shift;
- unless ( $self->plan ) {
- $self->setup =~ /^\s*0+(\.0*)?\s*$/
- && $self->recur =~ /^\s*0+(\.0*)?\s*$/;
- } elsif ( $self->can('is_free_options') ) {
+ if ( $self->can('is_free_options') ) {
not grep { $_ !~ /^\s*0*(\.0*)?\s*$/ }
map { $self->option($_) }
$self->is_free_options;
@@ -1287,38 +1284,11 @@
$self;
}
-#fallbacks that eval the setup and recur fields, for backwards compat
-
-sub calc_setup {
- my $self = shift;
- warn 'no price plan class for '. $self->plan. ", eval-ing setup\n";
- $self->_calc_eval('setup', @_);
-}
-
-sub calc_recur {
- my $self = shift;
- warn 'no price plan class for '. $self->plan. ", eval-ing recur\n";
- $self->_calc_eval('recur', @_);
-}
-
-use vars qw( $sdate @details );
-sub _calc_eval {
- #my( $self, $field, $cust_pkg ) = @_;
- my( $self, $field, $cust_pkg, $sdateref, $detailsref ) = @_;
- *sdate = $sdateref;
- *details = $detailsref;
- $self->$field() =~ /^(.*)$/
- or die "Illegal $field (pkgpart ". $self->pkgpart. '): '.
- $self->$field(). "\n";
- my $prog = $1;
- return 0 if $prog =~ /^\s*$/;
- my $value = eval $prog;
- die $@ if $@;
- $value;
-}
+#fatal fallbacks
+sub calc_setup { die 'no calc_setup for '. shift->plan. "\n"; }
+sub calc_recur { die 'no calc_recur for '. shift->plan. "\n"; }
#fallback that return 0 for old legacy packages with no plan
-
sub calc_remain { 0; }
sub calc_cancel { 0; }
sub calc_units { 0; }
More information about the freeside-commits
mailing list