From: Ivan Kohler Date: Thu, 13 Nov 2014 22:28:36 +0000 (-0800) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=52a824f9b11ca266be10c76894eaf6607344c8d0;hp=-c Merge branch 'master' of git.freeside.biz:/home/git/freeside --- 52a824f9b11ca266be10c76894eaf6607344c8d0 diff --combined FS/FS/Conf.pm index ca6588e06,b1ef9017f..cb4274f39 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@@ -3729,7 -3729,7 +3729,7 @@@ and customer address. Include units.' 'type' => 'select', 'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'csv-chase_canada-E-xactBatch', 'BoM', 'PAP', - 'paymentech', 'ach-spiritone', 'RBC' + 'paymentech', 'ach-spiritone', 'RBC', 'CIBC', ] }, @@@ -3791,7 -3791,7 +3791,7 @@@ 'type' => 'select', 'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP', 'paymentech', 'ach-spiritone', 'RBC', - 'td_eft1464', 'eft_canada' + 'td_eft1464', 'eft_canada', 'CIBC' ] }, @@@ -3809,6 -3809,13 +3809,13 @@@ 'type' => 'textarea', }, + { + 'key' => 'batchconfig-CIBC', + 'section' => 'billing', + 'description' => 'Configuration for Canadian Imperial Bank of Commerce, six lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Bank, 6. Bank account', + 'type' => 'textarea', + }, + { 'key' => 'batchconfig-PAP', 'section' => 'billing', @@@ -4944,7 -4951,7 +4951,7 @@@ { 'key' => 'default_phone_countrycode', 'section' => '', - 'description' => 'Default countrcode', + 'description' => 'Default countrycode', 'type' => 'text', }, diff --combined FS/FS/cust_main/Status.pm index c17bb5711,b5e8986ef..9a3fe1bbe --- a/FS/FS/cust_main/Status.pm +++ b/FS/FS/cust_main/Status.pm @@@ -68,21 -68,6 +68,21 @@@ sub statuscolors } +sub statuslabels { + #my $self = shift; #i guess i'm a class method + + my %statuslabels = ( + 'prospect' => 'No packages', + 'active' => 'Active', + 'ordered' => 'Ordered', + 'inactive' => 'Inactive', + 'suspended' => 'Suspended', + 'cancelled' => 'Cancelled', + ); + + \%statuslabels; +} + =item cancelled_sql =cut @@@ -118,6 -103,42 +118,42 @@@ sub cancelled_sql =back + =head1 CLASS METHODS + + =over 4 + + =item churn_sql START, END + + Returns an SQL statement for the customer churn status query. The columns + returned are the custnum and the number of active, suspended, and cancelled + packages (excluding one-time packages) at the start date ("s_active", + "s_suspended", and "s_cancelled") and the end date ("e_active", etc.). + + =cut + + # not sure this belongs here...FS::cust_main::Packages? + + sub churn_sql { + my $self = shift; + my ($speriod, $eperiod) = @_; + + my $s_sql = FS::h_cust_pkg->status_as_of_sql($speriod); + my $e_sql = FS::h_cust_pkg->status_as_of_sql($eperiod); + + my @select = ( + 'custnum', + 'COALESCE(SUM(s.is_active::int),0) as s_active', + 'COALESCE(SUM(s.is_suspended::int),0) as s_suspended', + 'COALESCE(SUM(s.is_cancelled::int),0) as s_cancelled', + 'COALESCE(SUM(e.is_active::int),0) as e_active', + 'COALESCE(SUM(e.is_suspended::int),0) as e_suspended', + 'COALESCE(SUM(e.is_cancelled::int),0) as e_cancelled', + ); + my $from = "($s_sql) AS s FULL JOIN ($e_sql) AS e USING (custnum)"; + + return "SELECT ".join(',', @select)." FROM $from GROUP BY custnum"; + } + =head1 BUGS =head1 SEE ALSO