diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-12-05 10:45:26 -0800 |
---|---|---|
committer | Jeremy Davis <jeremyd@freeside.biz> | 2014-12-10 11:23:48 -0500 |
commit | a83f6bb859327c0ff55d6aa30e39e8a0f657be75 (patch) | |
tree | 45626acc9ee47f7253cac441186a8adc60d76f78 /FS/FS/Template_Mixin.pm | |
parent | 36a9d4661fffb85b8d9ec099ee2dc0ced8991e99 (diff) |
agent-ize invoice_default_terms, RT#32513
Diffstat (limited to 'FS/FS/Template_Mixin.pm')
-rw-r--r-- | FS/FS/Template_Mixin.pm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 6ab5558d5..ebc977a35 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -1856,8 +1856,15 @@ sub terms { my $cust_main = $self->cust_main; return $cust_main->invoice_terms if $cust_main && $cust_main->invoice_terms; + my $agentnum = ''; + if ( $cust_main ) { + $agentnum = $cust_main->agentnum; + } elsif ( my $prospect_main = $self->prospect_main ) { + $agentnum = $prospect_main->agentnum; + } + #use configured default - $conf->config('invoice_default_terms') || ''; + $conf->config('invoice_default_terms', $agentnum) || ''; } sub due_date { @@ -1891,8 +1898,8 @@ sub balance_due_date { my $self = shift; my $conf = $self->conf; my $duedate = ''; - if ( $conf->exists('invoice_default_terms') - && $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) { + my $terms = $self->terms; + if ( $terms =~ /^\s*Net\s*(\d+)\s*$/ ) { $duedate = $self->time2str_local('rdate', $self->_date + ($1*86400) ); } $duedate; |