allow fees to be charged based on batch payment attempts, #27778
authorMark Wells <mark@freeside.biz>
Fri, 25 Apr 2014 03:24:01 +0000 (20:24 -0700)
committerMark Wells <mark@freeside.biz>
Fri, 25 Apr 2014 03:24:01 +0000 (20:24 -0700)
FS/FS/cust_event_fee.pm
FS/FS/cust_main/Billing.pm
FS/FS/part_event/Action/cust_fee.pm

index 181640d..e88dcc4 100644 (file)
@@ -151,6 +151,15 @@ sub by_cust {
     table     => 'cust_event_fee',
     addl_from => 'JOIN cust_event USING (eventnum) ' .
                  'JOIN part_event USING (eventpart) ' .
     table     => 'cust_event_fee',
     addl_from => 'JOIN cust_event USING (eventnum) ' .
                  'JOIN part_event USING (eventpart) ' .
+                 'JOIN cust_pay_batch ON (cust_event.tablenum = cust_pay_batch.paybatchnum)',
+    extra_sql => "$where eventtable = 'cust_pay_batch' ".
+                 "AND cust_pay_batch.custnum = $custnum",
+    %params
+  }),
+  qsearch({
+    table     => 'cust_event_fee',
+    addl_from => 'JOIN cust_event USING (eventnum) ' .
+                 'JOIN part_event USING (eventpart) ' .
                  'JOIN cust_pkg ON (cust_event.tablenum = cust_pkg.pkgnum)',
     extra_sql => "$where eventtable = 'cust_pkg' ".
                  "AND cust_pkg.custnum = $custnum",
                  'JOIN cust_pkg ON (cust_event.tablenum = cust_pkg.pkgnum)',
     extra_sql => "$where eventtable = 'cust_pkg' ".
                  "AND cust_pkg.custnum = $custnum",
index 94a0069..63c7f2b 100644 (file)
@@ -570,7 +570,10 @@ sub bill {
       my $object = $event_fee->cust_event->cust_X;
       my $part_fee = $event_fee->part_fee;
       my $cust_bill;
       my $object = $event_fee->cust_event->cust_X;
       my $part_fee = $event_fee->part_fee;
       my $cust_bill;
-      if ( $object->isa('FS::cust_main') or $object->isa('FS::cust_pkg') ) {
+      if ( $object->isa('FS::cust_main')
+           or $object->isa('FS::cust_pkg')
+           or $object->isa('FS::cust_pay_batch') )
+      {
         # Not the real cust_bill object that will be inserted--in particular
         # there are no taxes yet.  If you want to charge a fee on the total 
         # invoice amount including taxes, you have to put the fee on the next
         # Not the real cust_bill object that will be inserted--in particular
         # there are no taxes yet.  If you want to charge a fee on the total 
         # invoice amount including taxes, you have to put the fee on the next
index 9373091..27ca2a1 100644 (file)
@@ -6,7 +6,8 @@ use base qw( FS::part_event::Action::Mixin::fee );
 sub description { 'Charge a fee based on the customer\'s current invoice'; }
 
 sub eventtable_hashref {
 sub description { 'Charge a fee based on the customer\'s current invoice'; }
 
 sub eventtable_hashref {
-    { 'cust_main' => 1 };
+    { 'cust_main'       => 1,
+      'cust_pay_batch'  => 1 };
 }
 
 sub hold_until_bill { 1 }
 }
 
 sub hold_until_bill { 1 }