From 56707979ef0b68c99e2b8f6eb4e46205f44c65ba Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 20 Apr 2009 16:58:08 +0000 Subject: [PATCH] add cust_main.archived field, skip billing if Y, RT#4412 --- FS/FS/Cron/bill.pm | 2 ++ FS/FS/Schema.pm | 17 ++++++++++++----- FS/FS/cust_main.pm | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index ecc891003..5c0a5da59 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -24,6 +24,8 @@ sub bill { my @search = (); + push @search, "cust_main.archived != 'Y' "; #disable? + push @search, "cust_main.payby = '". $opt{'p'}. "'" if $opt{'p'}; push @search, "cust_main.agentnum = ". $opt{'a'} diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index f1692b552..6aae91652 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -551,16 +551,23 @@ sub tables_hashref { 'referral_custnum', 'int', 'NULL', '', '', '', 'comments', 'text', 'NULL', '', '', '', 'spool_cdr','char', 'NULL', 1, '', '', + 'archived', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'custnum', 'unique' => [ [ 'agentnum', 'agent_custid' ] ], #'index' => [ ['last'], ['company'] ], - 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ], - [ 'daytime' ], [ 'night' ], [ 'fax' ], [ 'refnum' ], - [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ], - [ 'ship_last' ], [ 'ship_company' ], + 'index' => [ + [ 'agentnum' ], [ 'refnum' ], [ 'custbatch' ], + [ 'referral_custnum' ], [ 'payby' ], [ 'paydate' ], - [ 'agentnum' ], [ 'custbatch' ], + [ 'archived' ], + #billing + ['last'], [ 'company' ], + [ 'county' ], [ 'state' ], [ 'country' ], + [ 'zip' ], + [ 'daytime' ], [ 'night' ], [ 'fax' ], + #shipping + [ 'ship_last' ], [ 'ship_company' ], ], }, diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index a5bf36de7..076831a9d 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1569,7 +1569,7 @@ sub check { $self->payname($1); } - foreach my $flag (qw( tax spool_cdr )) { + foreach my $flag (qw( tax spool_cdr archived )) { $self->$flag() =~ /^(Y?)$/ or return "Illegal $flag: ". $self->$flag(); $self->$flag($1); } -- 2.11.0