projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
optimize customer list (fix option caching in 3.x), RT#20173
[freeside.git]
/
FS
/
FS
/
part_svc.pm
diff --git
a/FS/FS/part_svc.pm
b/FS/FS/part_svc.pm
index
ca26074
..
612c590
100644
(file)
--- a/
FS/FS/part_svc.pm
+++ b/
FS/FS/part_svc.pm
@@
-12,6
+12,11
@@
use FS::export_svc;
use FS::cust_svc;
use FS::part_svc_class;
use FS::cust_svc;
use FS::part_svc_class;
+FS::UID->install_callback(sub {
+ # preload the cache and make sure all modules load
+ my $svc_defs = FS::part_svc->_svc_defs;
+});
+
$DEBUG = 0;
=head1 NAME
$DEBUG = 0;
=head1 NAME
@@
-145,9
+150,9
@@
sub insert {
foreach my $field (fields($svcdb), @fields) {
next if $field eq 'svcnum';
my $prefix = $svcdb.'__';
foreach my $field (fields($svcdb), @fields) {
next if $field eq 'svcnum';
my $prefix = $svcdb.'__';
- if ( defined( $self->getfield($prefix.$
_
.'_flag'))
- or defined($self->getfield($prefix.$
_
.'_required'))
- or length($self->getfield($prefix.$
_
.'_label'))
+ if ( defined( $self->getfield($prefix.$
field
.'_flag'))
+ or defined($self->getfield($prefix.$
field
.'_required'))
+ or length($self->getfield($prefix.$
field
.'_label'))
) {
my $part_svc_column = $self->part_svc_column($field);
my $previous = qsearchs('part_svc_column', {
) {
my $part_svc_column = $self->part_svc_column($field);
my $previous = qsearchs('part_svc_column', {
@@
-284,9
+289,9
@@
sub replace {
foreach my $field (fields($svcdb),@fields) {
next if $field eq 'svcnum';
my $prefix = $svcdb.'__';
foreach my $field (fields($svcdb),@fields) {
next if $field eq 'svcnum';
my $prefix = $svcdb.'__';
- if ( defined( $new->getfield($prefix.$
_
.'_flag'))
- or defined($new->getfield($prefix.$
_
.'_required'))
- or length($new->getfield($prefix.$
_
.'_label'))
+ if ( defined( $new->getfield($prefix.$
field
.'_flag'))
+ or defined($new->getfield($prefix.$
field
.'_required'))
+ or length($new->getfield($prefix.$
field
.'_label'))
) {
my $part_svc_column = $new->part_svc_column($field);
my $previous = qsearchs('part_svc_column', {
) {
my $part_svc_column = $new->part_svc_column($field);
my $previous = qsearchs('part_svc_column', {
@@
-560,6
+565,9
@@
is specified as B<0>, returns the number of unlinked customer services.
sub num_cust_svc {
my $self = shift;
sub num_cust_svc {
my $self = shift;
+ return $self->{Hash}{num_cust_svc}
+ if !@_ && exists($self->{Hash}{num_cust_svc});
+
my @param = ( $self->svcpart );
my( $join, $and ) = ( '', '' );
my @param = ( $self->svcpart );
my( $join, $and ) = ( '', '' );
@@
-649,9
+657,17
@@
sub _svc_defs {
next;
}
$info{$mod} = $info;
next;
}
$info{$mod} = $info;
+
+ # all svc_* modules are required to have h_svc_* modules for invoice
+ # display. check for them as early as possible.
+ eval "use FS::h_$mod;";
+ if ( $@ ) {
+ die "couldn't load history record module h_$mod: $@\n";
+ }
}
}
}
}
+
tie my %svc_defs, 'Tie::IxHash',
map { $_ => $info{$_}->{'fields'} }
sort { $info{$a}->{'display_weight'} <=> $info{$b}->{'display_weight'} }
tie my %svc_defs, 'Tie::IxHash',
map { $_ => $info{$_}->{'fields'} }
sort { $info{$a}->{'display_weight'} <=> $info{$b}->{'display_weight'} }