From: Ivan Kohler Date: Thu, 24 Mar 2016 03:56:03 +0000 (-0700) Subject: optimize customer list, RT#20173 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bb3fa983a42ded23b90e61c67b28ab53694e7965 optimize customer list, RT#20173 --- diff --git a/FS/FS/pkg_svc.pm b/FS/FS/pkg_svc.pm index b2dc87042..5c6070303 100644 --- a/FS/FS/pkg_svc.pm +++ b/FS/FS/pkg_svc.pm @@ -2,6 +2,17 @@ package FS::pkg_svc; use base qw(FS::Record); use strict; +use FS::Record qw( qsearchs ); +use FS::part_svc; + +our $cache_enabled = 0; + +sub _simplecache { + my( $self, $hashref ) = @_; + if ( $cache_enabled && $hashref->{'svc'} ) { + $self->{'_svcpart'} = FS::part_svc->new($hashref); + } +} =head1 NAME @@ -132,6 +143,14 @@ Returns the FS::part_pkg object (see L). Returns the FS::part_svc object (see L). +=cut + +sub part_svc { + my $self = shift; + return $self->{_svcpart} if $self->{_svcpart}; + qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } ); +} + =back =head1 BUGS