X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=93704605215f680f4aab528b8ec05afa321db30d;hb=2457752a82358108aa078f175a4e866f1786299a;hp=e5982a9e32ec9f65dfdefe96141502fff546e537;hpb=7516e3da0f17eeecba27219ef96a8b5f46af2083;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index e5982a9e3..937046052 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -17,14 +17,6 @@ use base qw( FS::cust_main::Packages require 5.006; use strict; -use vars qw( $DEBUG $me $conf - @encrypted_fields - $import - $ignore_expired_card $ignore_banned_card $ignore_illegal_zip - $ignore_invalid_card - $skip_fuzzyfiles - @paytypes - ); use Carp; use Scalar::Util qw( blessed ); use Time::Local qw(timelocal); @@ -86,21 +78,24 @@ use FS::cust_payby; # 1 is mostly method/subroutine entry and options # 2 traces progress of some operations # 3 is even more information including possibly sensitive data -$DEBUG = 0; -$me = '[FS::cust_main]'; +our $DEBUG = 0; +our $me = '[FS::cust_main]'; + +our $import = 0; +our $ignore_expired_card = 0; +our $ignore_banned_card = 0; +our $ignore_invalid_card = 0; -$import = 0; -$ignore_expired_card = 0; -$ignore_banned_card = 0; -$ignore_invalid_card = 0; +our $skip_fuzzyfiles = 0; -$skip_fuzzyfiles = 0; +our $ucfirst_nowarn = 0; -@encrypted_fields = ('payinfo', 'paycvv'); +our @encrypted_fields = ('payinfo', 'paycvv'); sub nohistory_fields { ('payinfo', 'paycvv'); } -@paytypes = ('', 'Personal checking', 'Personal savings', 'Business checking', 'Business savings'); +our @paytypes = ('', 'Personal checking', 'Personal savings', 'Business checking', 'Business savings'); +our $conf; #ask FS::UID to run this stuff for us later #$FS::UID::callback{'FS::cust_main'} = sub { install_callback FS::UID sub { @@ -3481,7 +3476,7 @@ Old-style: sub charge { my $self = shift; - my ( $amount, $quantity, $start_date, $classnum ); + my ( $amount, $setup_cost, $quantity, $start_date, $classnum ); my ( $pkg, $comment, $additional ); my ( $setuptax, $taxclass ); #internal taxes my ( $taxproduct, $override ); #vendor (CCH) taxes @@ -3491,6 +3486,7 @@ sub charge { my $locationnum; if ( ref( $_[0] ) ) { $amount = $_[0]->{amount}; + $setup_cost = $_[0]->{setup_cost}; $quantity = exists($_[0]->{quantity}) ? $_[0]->{quantity} : 1; $start_date = exists($_[0]->{start_date}) ? $_[0]->{start_date} : ''; $no_auto = exists($_[0]->{no_auto}) ? $_[0]->{no_auto} : ''; @@ -3509,6 +3505,7 @@ sub charge { $locationnum = $_[0]->{locationnum} || $self->ship_locationnum; } else { $amount = shift; + $setup_cost = ''; $quantity = 1; $start_date = ''; $pkg = @_ ? shift : 'One-time charge'; @@ -3539,6 +3536,7 @@ sub charge { 'setuptax' => $setuptax, 'taxclass' => $taxclass, 'taxproductnum' => $taxproduct, + 'setup_cost' => $setup_cost, } ); my %options = ( ( map { ("additional_info$_" => $additional->[$_] ) } @@ -4230,17 +4228,29 @@ Returns a status string for this customer, currently: =over 4 -=item prospect - No packages have ever been ordered +=item prospect + +No packages have ever been ordered. Displayed as "No packages". + +=item ordered + +Recurring packages all are new (not yet billed). -=item ordered - Recurring packages all are new (not yet billed). +=item active -=item active - One or more recurring packages is active +One or more recurring packages is active. -=item inactive - No active recurring packages, but otherwise unsuspended/uncancelled (the inactive status is new - previously inactive customers were mis-identified as cancelled) +=item inactive -=item suspended - All non-cancelled recurring packages are suspended +No active recurring packages, but otherwise unsuspended/uncancelled (the inactive status is new - previously inactive customers were mis-identified as cancelled). -=item cancelled - All recurring packages are cancelled +=item suspended + +All non-cancelled recurring packages are suspended. + +=item cancelled + +All recurring packages are cancelled. =back @@ -4267,17 +4277,39 @@ sub cust_status { =item ucfirst_status +Deprecated, use the cust_status_label method instead. + Returns the status with the first character capitalized. =cut -sub ucfirst_status { shift->ucfirst_cust_status(@_); } +sub ucfirst_status { + carp "ucfirst_status deprecated, use cust_status_label" unless $ucfirst_nowarn; + local($ucfirst_nowarn) = 1; + shift->ucfirst_cust_status(@_); +} sub ucfirst_cust_status { + carp "ucfirst_cust_status deprecated, use cust_status_label" unless $ucfirst_nowarn; my $self = shift; ucfirst($self->cust_status); } +=item cust_status_label + +=item status_label + +Returns the display label for this status. + +=cut + +sub status_label { shift->cust_status_label(@_); } + +sub cust_status_label { + my $self = shift; + __PACKAGE__->statuslabels->{$self->cust_status}; +} + =item statuscolor Returns a hex triplet color string for this customer's status.