[freeside-commits] freeside/FS/FS cust_bill_pkg.pm, 1.68, 1.69 part_pkg.pm, 1.129, 1.130

Mark Wells mark at wavetail.420.am
Tue Feb 7 18:18:04 PST 2012


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9754/FS/FS

Modified Files:
	cust_bill_pkg.pm part_pkg.pm 
Log Message:
correct unused-time credits for discounted packages, #16352

Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -w -d -r1.68 -r1.69
--- cust_bill_pkg.pm	4 Jan 2012 21:09:49 -0000	1.68
+++ cust_bill_pkg.pm	8 Feb 2012 02:17:57 -0000	1.69
@@ -893,7 +893,7 @@
 
   if ( $self->get('details') ) {
 
-    return sum( 
+    return sum( 0, 
       map { $_->amount || 0 }
       grep { !defined($classnum) or $classnum eq $_->classnum }
       @{ $self->get('details') }
@@ -908,7 +908,7 @@
     my $sth = dbh->prepare($sql) or die dbh->errstr;
     $sth->execute or die $sth->errstr;
 
-    return $sth->fetchrow_arrayref->[0];
+    return $sth->fetchrow_arrayref->[0] || 0;
 
   }
 

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -w -d -r1.129 -r1.130
--- part_pkg.pm	24 Jan 2012 22:25:13 -0000	1.129
+++ part_pkg.pm	8 Feb 2012 02:17:58 -0000	1.130
@@ -1292,29 +1292,16 @@
 sub calc_remain { 0; }
 sub calc_units  { 0; }
 
+#fallback for everything not based on flat.pm
+sub recur_temporality { 'upcoming'; }
+sub calc_cancel { 0; }
+
 #fallback for everything except bulk.pm
 sub hide_svc_detail { 0; }
 
 #fallback for packages that can't/won't summarize usage
 sub sum_usage { 0; }
 
-# somewhat more intelligent fallback--
-# covers the standard cases of billing outstanding usage or just running
-# another recurring billing cycle
-sub calc_cancel {
-  my $self = shift;
-  my $conf = new FS::Conf;
-  if ( $self->recur_temporality eq 'preceding'
-       and $self->option('bill_recur_on_cancel',1) ) {
-    return $self->calc_recur(@_);
-  }
-  elsif ( $conf->exists('bill_usage_on_cancel') # should be a package option?
-          and $self->can('calc_usage') ) {
-    return $self->calc_usage(@_);
-  }
-  0;
-}
-
 =item recur_cost_permonth CUST_PKG
 
 recur_cost divided by freq (only supported for monthly and longer frequencies)



More information about the freeside-commits mailing list