option for no postal fee on one-time charges
authorjeff <jeff>
Tue, 30 Sep 2008 20:22:38 +0000 (20:22 +0000)
committerjeff <jeff>
Tue, 30 Sep 2008 20:22:38 +0000 (20:22 +0000)
FS/FS/Conf.pm
FS/FS/cust_main.pm

index 79e9feb..610d590 100644 (file)
@@ -2012,6 +2012,13 @@ worry that config_items is freeside-specific and icky.
   },
 
   {
+    'key'         => 'postal_invoice-recurring_only',
+    'section'     => 'billing',
+    'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'batch-enable',
     'section'     => 'billing',
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
index b348aaa..225854c 100644 (file)
@@ -2147,7 +2147,12 @@ sub bill {
     return "can't charge postal invoice fee for customer ".
       $self->custnum. ": $postal_pkg";
   }
-  if ( $postal_pkg ) {
+  if ( $postal_pkg &&
+       ( scalar( grep { $_->recur && $_->recur > 0 } @cust_bill_pkg) ||
+         !$conf->exists('postal_invoice-recurring_only')
+       )
+     )
+  {
     foreach my $part_pkg ( $postal_pkg->part_pkg->self_and_bill_linked ) {
       my $error =
         $self->_make_lines( 'part_pkg'            => $part_pkg,