X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=3f67c62f0b3beaaf5476740838e0e97efee52a72;hb=0a7d9371d3514312edd8661c621876cece4d5221;hp=f4568a8a0778e7ac048ae9f6dc61f47f25b7c38c;hpb=c4dd2593a5cf5c4463a9180fbc5aef1f2c76f6e2;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f4568a8a0..3f67c62f0 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1060,6 +1060,7 @@ sub check { my $error = $self->ut_numbern('custnum') || $self->ut_number('agentnum') + || $self->ut_textn('agent_custid') || $self->ut_number('refnum') || $self->ut_name('last') || $self->ut_name('first') @@ -2046,6 +2047,8 @@ quiet - set true to surpress email card/ACH decline notices. freq - "1d" for the traditional, daily events (the default), or "1m" for the new monthly events +payby - allows for one time override of normal customer billing method + =cut sub collect { @@ -2116,7 +2119,10 @@ sub collect { } qsearch( { 'table' => 'part_bill_event', - 'hashref' => { 'payby' => $self->payby, + 'hashref' => { 'payby' => (exists($options{'payby'}) + ? $options{'payby'} + : $self->payby + ), 'disabled' => '', }, 'extra_sql' => $extra_sql, } ) @@ -3143,6 +3149,29 @@ sub balance_date { ); } +=item in_transit_payments + +Returns the total of requests for payments for this customer pending in +batches in transit to the bank. See L and L + +=cut + +sub in_transit_payments { + my $self = shift; + my $in_transit_payments = 0; + foreach my $pay_batch ( qsearch('pay_batch', { + 'status' => 'I', + } ) ) { + foreach my $cust_pay_batch ( qsearch('cust_pay_batch', { + 'batchnum' => $pay_batch->batchnum, + 'custnum' => $self->custnum, + } ) ) { + $in_transit_payments += $cust_pay_batch->amount; + } + } + sprintf( "%.2f", $in_transit_payments ); +} + =item paydate_monthyear Returns a two-element list consisting of the month and year of this customer's