(start of) reconcile breakage from stale accounts, RT#6407
[freeside.git] / FS / FS / Cron / breakage.pm
1 package FS::Cron::breakage;
2
3 use strict;
4 use base 'Exporter';
5 use vars qw( @EXPORT_OK );
6 use FS::Conf;
7 use FS::Record qw(qsearch);
8 use FS::agent;
9 #use FS::cust_main;
10
11 @EXPORT_OK = qw ( reconcile_breakage );
12
13 #freeside-daily %opt
14 # -v: enable debugging
15 # -l: debugging level
16
17 sub reconcile_breakage {
18   return;
19   #nothing yet
20
21   my $conf = new FS::Conf;
22
23   foreach my $agent (qsearch('agent', {})) {
24
25     my $days = $conf->config('breakage-days', $agent->agentnum)
26       or next;
27
28     #find customers w/a balance older than $days (and no activity since)
29
30     # - do a one time charge in the total amount of old unapplied payments.
31     #     'pkg' => 'Breakage', #or whatever.
32     #     'setuptax' => 'Y',
33     #     'classnum' => scalar($conf->config('breakage-pkg_class')),
34     # - use the new $cust_main->charge( 'bill_now' => 1 ) option to generate an invoice, etc.
35     # - apply_payments_and_credits
36
37   }
38
39 }
40
41 1;