X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=d2f2f86fadb2c1ebc5abf7d814ae8f20dff69d4c;hb=a51b71cdea80993d815ecd9c79132df0a68b78b6;hp=e4927a3895d2d761a53acf7ac0213ef55b39d54d;hpb=4e0dfb0cb472d5fa4ab0581c43b4bab72ed50847;p=freeside.git

diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index e4927a389..d2f2f86fa 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1665,7 +1665,7 @@ recur_cost divided by freq (only supported for monthly and longer frequencies)
 sub recur_cost_permonth {
   my($self, $cust_pkg) = @_;
   return 0 unless $self->freq =~ /^\d+$/ && $self->freq > 0;
-  sprintf('%.2f', $self->recur_cost / $self->freq );
+  sprintf('%.2f', ($self->recur_cost || 0) / $self->freq );
 }
 
 =item cust_bill_pkg_recur CUST_PKG
@@ -1710,7 +1710,7 @@ unit_setup minus setup_cost
 
 sub setup_margin {
   my $self = shift;
-  $self->unit_setup(@_) - $self->setup_cost;
+  $self->unit_setup(@_) - ($self->setup_cost || 0);
 }
 
 =item recur_margin_permonth