summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2009-06-12 10:20:30 +0000
committermark <mark>2009-06-12 10:20:30 +0000
commit958afc374c6e5c5908eb742b50910a458b20c295 (patch)
treefa38e4a935a8e8b363b9a4f15b3aee6d24698d43
parentdefb72a529ccc9697fa1f27c65eb3d624b5c03d9 (diff)
backported option for no postal fee on one-time charges
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cust_main.pm12
2 files changed, 17 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index df9d9066e..faed4ea12 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2068,6 +2068,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 recurring charges when this is set',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'batch-enable',
'section' => 'deprecated', #make sure batch-enable_payby is set for
#everyone before removing
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 2f28df3e2..a1130f44d 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2229,7 +2229,13 @@ sub bill {
if ( $setup != 0 || $recur != 0 ) {
- unless ($postal_charge) {
+ # Only create a postal charge if:
+ # - this package has a recurring fee OR postal charges are enabled for non-recurring fees
+ # - AND there isn't already a postal charge for this invoice.
+ if ( (!$postal_charge) &&
+ ( !$conf->exists('postal_invoice-recurring_only') ||
+ $recur > 0 )
+ ) {
$postal_charge = 1; # try only once
my $postal_pkg = $self->charge_postal_fee();
if ( $postal_pkg && !ref( $postal_pkg ) ) {
@@ -2237,7 +2243,9 @@ sub bill {
return "can't charge postal invoice fee for customer ".
$self->custnum. ": $postal_pkg";
}
- push @cust_pkgs, $postal_pkg if $postal_pkg;
+ if ( $postal_pkg ) {
+ push @cust_pkgs, $postal_pkg;
+ }
}
warn " charges (setup=$setup, recur=$recur); adding line items\n"