[freeside-commits] freeside/FS/FS/part_event/Condition balance_credit_limit.pm, NONE, 1.1
Mark Wells
mark at wavetail.420.am
Wed Sep 22 14:22:05 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail.420.am:/tmp/cvs-serv29856/FS/FS/part_event/Condition
Added Files:
balance_credit_limit.pm
Log Message:
customer credit limits, RT#8209
--- NEW FILE: balance_credit_limit.pm ---
package FS::part_event::Condition::balance_credit_limit;
use strict;
use FS::cust_main;
use base qw( FS::part_event::Condition );
sub description { 'Customer is over credit limit'; }
sub condition {
my($self, $object) = @_;
my $cust_main = $self->cust_main($object);
my $over = $cust_main->credit_limit;
return 0 if !length($over); # if credit limit is null, no limit
$cust_main->balance > $over;
}
sub condition_sql {
my( $class, $table ) = @_;
my $balance_sql = FS::cust_main->balance_sql;
"(cust_main.credit_limit IS NULL OR
$balance_sql - cust_main.credit_limit > 0 )";
}
1;
More information about the freeside-commits
mailing list