[freeside-commits] freeside/FS/FS/part_event/Action addpost.pm, 1.1, 1.2 apply.pm, 1.1, 1.2 bill.pm, 1.1, 1.2 cancel.pm, 1.1, 1.2 collect.pm, 1.1, 1.2 cust_bill_batch.pm, 1.1, 1.2 cust_bill_comp.pm, 1.1, 1.2 cust_bill_fee_percent.pm, 1.1, 1.2 cust_bill_realtime_card.pm, 1.1, 1.2 cust_bill_realtime_check.pm, 1.1, 1.2 cust_bill_realtime_lec.pm, 1.1, 1.2 cust_bill_send_agent.pm, 1.1, 1.2 cust_bill_send_alternate.pm, 1.1, 1.2 cust_bill_send_csv_ftp.pm, 1.1, 1.2 cust_bill_send_if_newest.pm, 1.1, 1.2 cust_bill_send.pm, 1.1, 1.2 cust_bill_spool_csv.pm, 1.1, 1.2 cust_bill_suspend_if_balance.pm, 1.1, 1.2 fee.pm, 1.1, 1.2 pkg_referral_credit_pkg.pm, NONE, 1.1 pkg_referral_credit.pm, NONE, 1.1 suspend_if_pkgpart.pm, 1.1, 1.2 suspend.pm, 1.1, 1.2 suspend_unless_pkgpart.pm, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Sat Nov 22 14:17:29 PST 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Action
In directory wavetail.420.am:/tmp/cvs-serv30261/FS/FS/part_event/Action
Modified Files:
addpost.pm apply.pm bill.pm cancel.pm collect.pm
cust_bill_batch.pm cust_bill_comp.pm cust_bill_fee_percent.pm
cust_bill_realtime_card.pm cust_bill_realtime_check.pm
cust_bill_realtime_lec.pm cust_bill_send_agent.pm
cust_bill_send_alternate.pm cust_bill_send_csv_ftp.pm
cust_bill_send_if_newest.pm cust_bill_send.pm
cust_bill_spool_csv.pm cust_bill_suspend_if_balance.pm fee.pm
suspend_if_pkgpart.pm suspend.pm suspend_unless_pkgpart.pm
Added Files:
pkg_referral_credit_pkg.pm pkg_referral_credit.pm
Log Message:
referral credits overhaul, use billing events, agents can self-configure, limit to once-per-customer, depend on any time from referred package, referred customer payment, specific packages, partial staged credits, RT#3983
Index: cust_bill_realtime_card.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_realtime_card.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_realtime_card.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_realtime_card.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -8,17 +8,13 @@
'Run card with a Business::OnlinePayment realtime gateway';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 30;
-}
+sub default_weight { 30; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_send_csv_ftp.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_send_csv_ftp.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_send_csv_ftp.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,13 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Upload CSV invoice data to an FTP server';
-}
+sub description { 'Upload CSV invoice data to an FTP server'; }
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
@@ -31,9 +27,7 @@
);
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_send_agent.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_send_agent.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_send_agent.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_send_agent.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -24,9 +24,7 @@
);
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: suspend_if_pkgpart.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/suspend_if_pkgpart.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- suspend_if_pkgpart.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ suspend_if_pkgpart.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Suspend packages';
-}
+sub description { 'Suspend packages'; }
+
+#i should be deprecated in favor of using the if_pkgpart condition
sub option_fields {
(
@@ -18,12 +18,10 @@
'reason_class' => 'S',
},
);
-};
-
-sub default_weight {
- 10;
}
+sub default_weight { 10; }
+
sub do_action {
my( $self, $cust_object ) = @_;
Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/bill.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- bill.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ bill.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -8,13 +8,9 @@
'Generate invoices (normally only used with a Late Fee event)';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
-sub default_weight {
- 60;
-}
+sub default_weight { 60; }
sub do_action {
my( $self, $cust_object ) = @_;
Index: suspend.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/suspend.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- suspend.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ suspend.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,7 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Suspend';
-}
+sub description { 'Suspend'; }
sub option_fields {
(
@@ -14,12 +12,10 @@
'reason_class' => 'S',
},
);
-};
-
-sub default_weight {
- 10;
}
+sub default_weight { 10; }
+
sub do_action {
my( $self, $cust_object ) = @_;
Index: cust_bill_batch.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_batch.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_batch.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_batch.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,21 +3,15 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Add card or check to a pending batch';
-}
+sub description { 'Add card or check to a pending batch'; }
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 40;
-}
+sub default_weight { 40; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_send_alternate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_send_alternate.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_send_alternate.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_send_alternate.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,7 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Send invoice (email/print/fax) with alternate template';
-}
+sub description { 'Send invoice (email/print/fax) with alternate template'; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
@@ -19,9 +17,7 @@
);
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_realtime_lec.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_realtime_lec.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_realtime_lec.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_realtime_lec.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -8,17 +8,13 @@
'Run phone bill ("LEC") billing with a Business::OnlinePayment realtime gateway';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 30;
-}
+sub default_weight { 30; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_fee_percent.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_fee_percent.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_fee_percent.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_fee_percent.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,7 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Late fee (percentage of invoice)';
-}
+sub description { 'Late fee (percentage of invoice)'; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
@@ -18,9 +16,7 @@
);
}
-sub default_weight {
- 10;
-}
+sub default_weight { 10; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: suspend_unless_pkgpart.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/suspend_unless_pkgpart.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- suspend_unless_pkgpart.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ suspend_unless_pkgpart.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Suspend packages except';
-}
+sub description { 'Suspend packages except'; }
+
+#i should be deprecated in favor of using the unless_pkgpart condition
sub option_fields {
(
@@ -18,12 +18,10 @@
'reason_class' => 'S',
},
);
-};
-
-sub default_weight {
- 10;
}
+sub default_weight { 10; }
+
sub do_action {
my( $self, $cust_object ) = @_;
Index: apply.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/apply.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- apply.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ apply.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -7,13 +7,9 @@
'Apply unapplied payments and credits';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
-sub default_weight {
- 70;
-}
+sub default_weight { 70; }
sub do_action {
my( $self, $cust_object ) = @_;
Index: cust_bill_comp.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_comp.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_comp.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_comp.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,21 +3,15 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Pay invoice with a complimentary "payment"';
-}
+sub description { 'Pay invoice with a complimentary "payment"'; }
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 30;
-}
+sub default_weight { 30; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_suspend_if_balance.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_suspend_if_balance.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_suspend_if_balance.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ cust_bill_suspend_if_balance.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,13 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Suspend if balance (this invoice and previous) over';
-}
+sub description { 'Suspend if balance (this invoice and previous) over'; }
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
@@ -23,12 +19,10 @@
'reason_class' => 'S',
},
);
-};
-
-sub default_weight {
- 10;
}
+sub default_weight { 10; }
+
sub do_action {
my( $self, $cust_bill ) = @_;
Index: collect.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/collect.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- collect.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ collect.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -8,13 +8,9 @@
'Collect on invoices (normally only used with a Late Fee and Generate Invoice events)';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
-sub default_weight {
- 80;
-}
+sub default_weight { 80; }
sub do_action {
my( $self, $cust_object ) = @_;
Index: fee.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/fee.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fee.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ fee.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,21 +3,17 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Late fee (flat)';
-}
+sub description { 'Late fee (flat)'; }
sub option_fields {
(
'charge' => { label=>'Amount', type=>'money', }, # size=>7, },
'reason' => 'Reason',
);
-};
-
-sub default_weight {
- 10;
}
+sub default_weight { 10; }
+
sub do_action {
my( $self, $cust_object ) = @_;
Index: cancel.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cancel.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cancel.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cancel.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,9 +3,7 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Cancel';
-}
+sub description { 'Cancel'; }
sub option_fields {
(
@@ -14,13 +12,10 @@
'reason_class' => 'C',
},
);
-
-};
-
-sub default_weight {
- 20;
}
+sub default_weight { 20; }
+
sub do_action {
my( $self, $cust_object ) = @_;
--- NEW FILE: pkg_referral_credit.pm ---
package FS::part_event::Action::pkg_referral_credit;
use strict;
use base qw( FS::part_event::Action );
sub description { 'Credit the referring customer a specific amount'; }
sub eventtable_hashref {
{ 'cust_pkg' => 1 };
}
sub option_fields {
(
'reasonnum' => { 'label' => 'Credit reason',
'type' => 'select-reason',
'reason_class' => 'R',
},
'amount' => { 'label' => 'Credit amount',
'type' => 'money',
},
);
}
#a little false laziness w/pkg_referral_credit_pkg
sub do_action {
my( $self, $cust_pkg ) = @_;
my $cust_main = $self->cust_main($cust_pkg);
# my $part_pkg = $cust_pkg->part_pkg;
return 'No referring customer' unless $cust_main->referral_custnum;
my $referring_cust_main = $cust_main->referring_cust_main;
return 'Referring customer is cancelled'
if $referring_cust_main->status eq 'cancelled';
my $amount = $self->_calc_referral_credit($cust_pkg);
my $reasonnum = $self->option('reasonnum');
my $error = $referring_cust_main->credit(
$amount,
\$reasonnum,
'addlinfo' =>
'for customer #'. $cust_main->display_custnum. ': '.$cust_main->name,
);
die "Error crediting customer ". $cust_main->referral_custnum.
" for referral: $error"
if $error;
}
sub _calc_referral_credit {
my( $self, $cust_pkg ) = @_;
$self->option('amount');
}
1;
--- NEW FILE: pkg_referral_credit_pkg.pm ---
package FS::part_event::Action::pkg_referral_credit_pkg;
use strict;
use base qw( FS::part_event::Action::pkg_referral_credit );
sub description { 'Credit the referring customer an amount based on the referred package'; }
#sub eventtable_hashref {
# { 'cust_pkg' => 1 };
#}
sub option_fields {
(
'reasonnum' => { 'label' => 'Credit reason',
'type' => 'select-reason',
'reason_class' => 'R',
},
'percent' => { 'label' => 'Percent',
'type' => 'input-percentage',
'default' => '100',
},
'what' => { 'label' => 'Of',
'type' => 'select',
#also add some way to specify in the package def, no?
'options' => [ qw( base_recur_permonth ) ],
'labels' => { 'base_recur_permonth' => 'Base monthly fee', },
},
);
}
sub _calc_referral_credit {
my( $self, $cust_pkg ) = @_;
my $cust_main = $self->cust_main($cust_pkg);
my $part_pkg = $cust_pkg->part_pkg;
my $what = $self->option('what');
if ( $what eq 'base_recur_permonth' ) { #huh. yuck.
if ( $part_pkg->freq !~ /^\d+$/ ) {
die 'WARNING: Not crediting customer '. $cust_main->referral_custnum.
' for package '. $cust_pkg->pkgnum.
' ( customer '. $cust_pkg->custnum. ')'.
' - Referral credits not (yet) available for '.
' packages with '. $part_pkg->freq_pretty. ' frequency';
}
}
my $percent = $self->option('percent');
sprintf('%.2f', $part_pkg->$what($cust_pkg) * $percent / 100 );
}
1;
Index: addpost.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/addpost.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- addpost.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ addpost.pm 22 Nov 2008 22:17:26 -0000 1.2
@@ -3,13 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Add postal invoicing';
-}
+sub description { 'Add postal invoicing'; }
-sub default_weight {
- 20;
-}
+sub default_weight { 20; }
sub do_action {
my( $self, $cust_object ) = @_;
Index: cust_bill_spool_csv.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_spool_csv.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_spool_csv.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ cust_bill_spool_csv.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,13 +3,9 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Spool CSV invoice data';
-}
+sub description { 'Spool CSV invoice data'; }
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
@@ -43,9 +39,7 @@
);
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_send.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_send.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_send.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_send.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -3,17 +3,13 @@
use strict;
use base qw( FS::part_event::Action );
-sub description {
- 'Send invoice (email/print/fax)';
-}
+sub description { 'Send invoice (email/print/fax)'; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_realtime_check.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_realtime_check.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_realtime_check.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_realtime_check.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -8,17 +8,13 @@
'Run check with a Business::OnlinePayment realtime gateway';
}
-sub deprecated {
- 1;
-}
+sub deprecated { 1; }
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
-sub default_weight {
- 30;
-}
+sub default_weight { 30; }
sub do_action {
my( $self, $cust_bill ) = @_;
Index: cust_bill_send_if_newest.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/cust_bill_send_if_newest.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_bill_send_if_newest.pm 1 Aug 2007 22:24:38 -0000 1.1
+++ cust_bill_send_if_newest.pm 22 Nov 2008 22:17:27 -0000 1.2
@@ -24,9 +24,7 @@
);
}
-sub default_weight {
- 50;
-}
+sub default_weight { 50; }
sub do_action {
my( $self, $cust_bill ) = @_;
More information about the freeside-commits
mailing list