[freeside-commits] freeside/FS/FS cust_bill.pm, 1.142,
1.143 part_bill_event.pm, 1.20, 1.21 cust_main.pm, 1.204, 1.205
Ivan,,,
ivan at wavetail.420.am
Sat Dec 24 16:52:29 PST 2005
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv15320/FS/FS
Modified Files:
cust_bill.pm part_bill_event.pm cust_main.pm
Log Message:
add invoice event to suspend only when greater than N amount
Index: part_bill_event.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_bill_event.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- part_bill_event.pm 9 Jun 2005 06:36:37 -0000 1.20
+++ part_bill_event.pm 25 Dec 2005 00:52:27 -0000 1.21
@@ -134,6 +134,8 @@
or $c =~ /^\s*\$cust_main\->suspend_(if|unless)_pkgpart\([\d\,\s]*\);\s*$/
+ or $c =~ /^\s*\$cust_bill\->cust_suspend_if_balance_over\([\d\.\s]*\);\s*$/
+
or do {
#log
return "illegal eventcode: $c";
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- cust_bill.pm 27 Nov 2005 21:59:23 -0000 1.142
+++ cust_bill.pm 25 Dec 2005 00:52:27 -0000 1.143
@@ -236,6 +236,25 @@
qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
}
+=item cust_suspend_if_balance_over AMOUNT
+
+Suspends the customer associated with this invoice if the total amount owed on
+this invoice and all older invoices is greater than the specified amount.
+
+Returns a list: an empty list on success or a list of errors.
+
+=cut
+
+sub cust_suspend_if_balance_over {
+ my( $self, $amount ) = ( shift, shift );
+ my $cust_main = $self->cust_main;
+ if ( $cust_main->total_owed_date($self->_date) < $amount ) {
+ return ();
+ } else {
+ $cust_main->suspend;
+ }
+}
+
=item cust_credit
Depreciated. See the cust_credited method.
@@ -2389,6 +2408,7 @@
}
+
=back
=head1 SUBROUTINES
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- cust_main.pm 28 Nov 2005 17:16:20 -0000 1.204
+++ cust_main.pm 25 Dec 2005 00:52:27 -0000 1.205
@@ -1460,7 +1460,8 @@
=item suspend
Suspends all unsuspended packages (see L<FS::cust_pkg>) for this customer.
-Always returns a list: an empty list on success or a list of errors.
+
+Returns a list: an empty list on success or a list of errors.
=cut
@@ -1472,8 +1473,9 @@
=item suspend_if_pkgpart PKGPART [ , PKGPART ... ]
Suspends all unsuspended packages (see L<FS::cust_pkg>) matching the listed
-PKGPARTs (see L<FS::part_pkg>). Always returns a list: an empty list on
-success or a list of errors.
+PKGPARTs (see L<FS::part_pkg>).
+
+Returns a list: an empty list on success or a list of errors.
=cut
@@ -1488,8 +1490,9 @@
=item suspend_unless_pkgpart PKGPART [ , PKGPART ... ]
Suspends all unsuspended packages (see L<FS::cust_pkg>) unless they match the
-listed PKGPARTs (see L<FS::part_pkg>). Always returns a list: an empty list
-on success or a list of errors.
+listed PKGPARTs (see L<FS::part_pkg>).
+
+Returns a list: an empty list on success or a list of errors.
=cut
More information about the freeside-commits
mailing list