From 5a52da30588e8811338845ce2edaf0631acad479 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Sep 2010 20:19:41 +0000 Subject: [PATCH] refactor giant cust_main.pm a little in preparation of adding API methods for maestro, RT#9967 --- FS/FS.pm | 4 + FS/FS/cust_main.pm | 3527 ++++------------------------------- FS/FS/cust_main/Billing.pm | 1549 +++++++++++++++ FS/FS/cust_main/Billing_Realtime.pm | 1439 ++++++++++++++ FS/FS/part_pkg.pm | 1 + FS/MANIFEST | 2 + 6 files changed, 3313 insertions(+), 3209 deletions(-) create mode 100644 FS/FS/cust_main/Billing.pm create mode 100644 FS/FS/cust_main/Billing_Realtime.pm diff --git a/FS/FS.pm b/FS/FS.pm index 07b31b3b5..40914cef9 100644 --- a/FS/FS.pm +++ b/FS/FS.pm @@ -262,6 +262,10 @@ L - Prospect class L - Customer class +L - Customer billing class + +L - Customer real-time billing class + L - Customer location class L - Mixin class for records that contain fields from cust_main diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 007beec92..21f66b92e 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2,11 +2,10 @@ package FS::cust_main; require 5.006; use strict; -use base qw( FS::otaker_Mixin - FS::payinfo_Mixin - FS::cust_main_Mixin +use base qw( FS::cust_main::Billing FS::cust_main::Billing_Realtime + FS::otaker_Mixin FS::payinfo_Mixin FS::cust_main_Mixin FS::Record - ); + ); use vars qw( @EXPORT_OK $DEBUG $me $conf @encrypted_fields $import $ignore_expired_card @@ -14,7 +13,6 @@ use vars qw( @EXPORT_OK $DEBUG $me $conf @paytypes ); use vars qw( $realtime_bop_decline_quiet ); #ugh -use Safe; use Carp; use Exporter; use Scalar::Util qw( blessed ); @@ -40,10 +38,6 @@ use FS::payby; use FS::cust_pkg; use FS::cust_svc; use FS::cust_bill; -use FS::cust_bill_pkg; -use FS::cust_bill_pkg_display; -use FS::cust_bill_pkg_tax_location; -use FS::cust_bill_pkg_tax_rate_location; use FS::cust_pay; use FS::cust_pay_pending; use FS::cust_pay_void; @@ -56,15 +50,10 @@ use FS::cust_location; use FS::cust_class; use FS::cust_main_exemption; use FS::cust_tax_adjustment; -use FS::tax_rate; -use FS::tax_rate_location; use FS::cust_tax_location; -use FS::part_pkg_taxrate; use FS::agent; use FS::cust_main_invoice; use FS::cust_tag; -use FS::cust_credit_bill; -use FS::cust_bill_pay; use FS::prepay_credit; use FS::queue; use FS::part_pkg; @@ -80,7 +69,7 @@ use FS::TicketSystem; @EXPORT_OK = qw( smart_search ); -$realtime_bop_decline_quiet = 0; +$realtime_bop_decline_quiet = 0; #move to Billing_Realtime # 1 is mostly method/subroutine entry and options # 2 traces progress of some operations @@ -2667,257 +2656,200 @@ sub classname { : ''; } +=item BILLING METHODS -=item bill_and_collect +Documentation on billing methods has been moved to +L. -Cancels and suspends any packages due, generates bills, applies payments and -credits, and applies collection events to run cards, send bills and notices, -etc. - -By default, warns on errors and continues with the next operation (but see the -"fatal" flag below). +=item do_cust_event [ HASHREF | OPTION => VALUE ... ] -Options are passed as name-value pairs. Currently available options are: +Runs billing events; see L and the billing events web +interface. -=over 4 +If there is an error, returns the error, otherwise returns false. -=item time +Options are passed as name-value pairs. -Bills the customer as if it were that time. Specified as a UNIX timestamp; see L). Also see L and L for conversion functions. For example: +Currently available options are: - use Date::Parse; - ... - $cust_main->bill( 'time' => str2time('April 20th, 2001') ); +=over 4 -=item invoice_time +=item time -Used in conjunction with the I