diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-03-28 17:29:35 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-03-28 17:29:35 -0700 |
commit | df21571ae9b56b8645c53053fdabc78ca6eeffed (patch) | |
tree | 63f4ba9772eac6271aa6d831f2685ae9813b4bff /FS | |
parent | 588bd40945822ce3a89e4ddd3588ebc107019410 (diff) |
optimize customer list, RT#30173
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 4e305fc2b..38edd0493 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3803,13 +3803,17 @@ sub status { shift->cust_status(@_); } sub cust_status { my $self = shift; + return $self->hashref->{cust_status} if $self->hashref->{cust_status}; for my $status ( FS::cust_main->statuses() ) { my $method = $status.'_sql'; my $numnum = ( my $sql = $self->$method() ) =~ s/cust_main\.custnum/?/g; my $sth = dbh->prepare("SELECT $sql") or die dbh->errstr; $sth->execute( ($self->custnum) x $numnum ) or die "Error executing 'SELECT $sql': ". $sth->errstr; - return $status if $sth->fetchrow_arrayref->[0]; + if ( $sth->fetchrow_arrayref->[0] ) { + $self->hashref->{cust_status} = $status; + return $status; + } } } |