[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 5708d624dcc4557fa38d8f209a324ebb0c3e9644

Brian Medley bpm at 420.am
Fri Apr 20 11:28:26 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  5708d624dcc4557fa38d8f209a324ebb0c3e9644 (commit)
       via  f232ab43d46ece5e2025787c1f1f223c803f8691 (commit)
       via  a1e10e63935c5e561252b1defe4e16688ba54b4d (commit)
      from  b109815d5160ab9f3088274f7839a30b0fcf52d4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5708d624dcc4557fa38d8f209a324ebb0c3e9644
Merge: f232ab4 b109815
Author: Brian Medley <bpm at snafu.org>
Date:   Fri Apr 20 13:28:01 2012 -0500

    Merge branch 'FREESIDE_2_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_2_3_BRANCH


commit f232ab43d46ece5e2025787c1f1f223c803f8691
Author: Brian Medley <bpm at snafu.org>
Date:   Fri Apr 20 11:48:50 2012 -0500

    remove whitespace, #17319

diff --git a/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm b/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm
index 13f886a..558f5cd 100644
--- a/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm
+++ b/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm
@@ -29,7 +29,7 @@ sub _calc_fee {
   my $num = $flat_fee - $percent;
   if ($num == 0) {
     return($percent);
-  } 
+  }
   elsif ($num > 0) {
     return($flat_fee);
   }

commit a1e10e63935c5e561252b1defe4e16688ba54b4d
Author: Brian Medley <bpm at snafu.org>
Date:   Fri Apr 20 09:58:25 2012 -0500

    new fee either flat or percentage based, #17319

diff --git a/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm b/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm
new file mode 100644
index 0000000..13f886a
--- /dev/null
+++ b/FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm
@@ -0,0 +1,41 @@
+package FS::part_event::Action::cust_bill_fee_greater_percent_or_flat;
+
+use strict;
+use base qw( FS::part_event::Action::fee );
+use Tie::IxHash;
+
+sub description { 'Late fee (greater of percentage of invoice or flat fee)'; }
+
+sub eventtable_hashref {
+  { 'cust_bill' => 1 };
+}
+
+sub option_fields {
+  my $class = shift;
+
+  my $t = tie my %option_fields, 'Tie::IxHash', $class->SUPER::option_fields();
+  $t->Shift; #assumes charge is first
+  $t->Unshift( 'flat_fee'  => { label=>'Flat Fee', type=>'money', } );
+  $t->Unshift( 'percent'   => { label=>'Percent', size=>2, } );
+
+  %option_fields;
+}
+
+sub _calc_fee {
+  my( $self, $cust_bill ) = @_;
+  my $percent  = sprintf('%.2f', $cust_bill->owed * $self->option('percent') / 100 );
+  my $flat_fee = $self->option('flat_fee');
+
+  my $num = $flat_fee - $percent;
+  if ($num == 0) {
+    return($percent);
+  } 
+  elsif ($num > 0) {
+    return($flat_fee);
+  }
+  else {
+    return($percent);
+  }
+}
+
+1;

-----------------------------------------------------------------------

Summary of changes:
 .../cust_bill_fee_greater_percent_or_flat.pm       |   41 ++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 FS/FS/part_event/Action/cust_bill_fee_greater_percent_or_flat.pm




More information about the freeside-commits mailing list