[freeside-commits] branch master updated. 8abffa51cf2846154e9a893fc2af24db99f49c69
Brian Medley
bpm at 420.am
Fri Apr 20 10:42:26 PDT 2012
The branch, master has been updated
via 8abffa51cf2846154e9a893fc2af24db99f49c69 (commit)
via 25f8c85c0723294a7fbf57df82ded48d9f07a074 (commit)
via b4aba212f8f28a77c9e62323b30209601463c5ff (commit)
from 96cac28e01e2c57b2606efbed4932e2ed9328412 (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 8abffa51cf2846154e9a893fc2af24db99f49c69
Merge: 25f8c85 96cac28
Author: Brian Medley <bpm at snafu.org>
Date: Fri Apr 20 12:41:57 2012 -0500
Merge branch 'master' of git.freeside.biz:/home/git/freeside
commit 25f8c85c0723294a7fbf57df82ded48d9f07a074
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 b4aba212f8f28a77c9e62323b30209601463c5ff
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