diff options
author | ivan <ivan> | 2009-11-03 03:13:47 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-11-03 03:13:47 +0000 |
commit | 12a33bafaae99cca2485eb0a58d64dd67f3a9827 (patch) | |
tree | 0f55ad3351022719baa675dd585a7738a809a22f /FS | |
parent | c07021534a52514a7908a4613332c9a4dac2f6e9 (diff) |
(start of) reconcile breakage from stale accounts, RT#6407
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 58 | ||||
-rw-r--r-- | FS/FS/Cron/breakage.pm | 41 | ||||
-rwxr-xr-x | FS/bin/freeside-daily | 4 |
3 files changed, 64 insertions, 39 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 68a6fa0e1..5ea717e4d 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1032,19 +1032,7 @@ worry that config_items is freeside-specific and icky. 'key' => 'finance_pkgclass', 'section' => 'billing', 'description' => 'The package class for finance charges', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::pkg_class; - map { $_->classnum => $_->classname } - FS::Record::qsearch('pkg_class', {} ); - }, - 'option_sub' => sub { require FS::Record; - require FS::pkg_class; - my $pkg_class = FS::Record::qsearchs( - 'pkg_class', { 'classnum'=>shift } - ); - $pkg_class ? $pkg_class->classname : ''; - }, + 'type' => 'select-pkg_class', }, { @@ -1539,38 +1527,14 @@ worry that config_items is freeside-specific and icky. 'key' => 'signup_server-classnum2', 'section' => '', 'description' => 'Package Class for first optional purchase', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::pkg_class; - map { $_->classnum => $_->classname } - FS::Record::qsearch('pkg_class', {} ); - }, - 'option_sub' => sub { require FS::Record; - require FS::pkg_class; - my $pkg_class = FS::Record::qsearchs( - 'pkg_class', { 'classnum'=>shift } - ); - $pkg_class ? $pkg_class->classname : ''; - }, + 'type' => 'select-pkg_class', }, { 'key' => 'signup_server-classnum3', 'section' => '', 'description' => 'Package Class for second optional purchase', - 'type' => 'select-sub', - 'options_sub' => sub { require FS::Record; - require FS::pkg_class; - map { $_->classnum => $_->classname } - FS::Record::qsearch('pkg_class', {} ); - }, - 'option_sub' => sub { require FS::Record; - require FS::pkg_class; - my $pkg_class = FS::Record::qsearchs( - 'pkg_class', { 'classnum'=>shift } - ); - $pkg_class ? $pkg_class->classname : ''; - }, + 'type' => 'select-pkg_class', }, { @@ -3223,6 +3187,22 @@ worry that config_items is freeside-specific and icky. 'type' => 'checkbox', }, + { + 'key' => 'breakage-days', + 'section' => 'billing', + 'description' => 'If set to a number of days, after an account goes that long without activity, recognizes any outstanding payments and credits as "breakage" by creating a breakage charge and invoice.', + 'type' => 'text', + 'per_agent' => 1, + }, + + { + 'key' => 'breakage-pkg_class', + 'section' => 'billing', + 'description' => 'Package class to use for breakage reconciliation.', + 'type' => 'select-pkg_class', + }, + + { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" }, { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" }, { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" }, diff --git a/FS/FS/Cron/breakage.pm b/FS/FS/Cron/breakage.pm new file mode 100644 index 000000000..631266794 --- /dev/null +++ b/FS/FS/Cron/breakage.pm @@ -0,0 +1,41 @@ +package FS::Cron::breakage; + +use strict; +use base 'Exporter'; +use vars qw( @EXPORT_OK ); +use FS::Conf; +use FS::Record qw(qsearch); +use FS::agent; +#use FS::cust_main; + +@EXPORT_OK = qw ( reconcile_breakage ); + +#freeside-daily %opt +# -v: enable debugging +# -l: debugging level + +sub reconcile_breakage { + return; + #nothing yet + + my $conf = new FS::Conf; + + foreach my $agent (qsearch('agent', {})) { + + my $days = $conf->config('breakage-days', $agent->agentnum) + or next; + + #find customers w/a balance older than $days (and no activity since) + + # - do a one time charge in the total amount of old unapplied payments. + # 'pkg' => 'Breakage', #or whatever. + # 'setuptax' => 'Y', + # 'classnum' => scalar($conf->config('breakage-pkg_class')), + # - use the new $cust_main->charge( 'bill_now' => 1 ) option to generate an invoice, etc. + # - apply_payments_and_credits + + } + +} + +1; diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 728fa969a..04073d47e 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -16,6 +16,10 @@ use FS::Cron::bill qw(bill); bill(%opt); #you can skip this just by not having the config +use FS::Cron::breakage qw(reconcile_breakage); +reconcile_breakage(%opt); + +#you can skip this just by not having the config use FS::Cron::upload qw(upload); upload(%opt); |