diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-08-29 15:19:17 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-08-29 15:19:17 -0700 |
| commit | 33aa032478e29000c8c0d4fbe7bf8cb25c277606 (patch) | |
| tree | dca9779a3f3990ee26268575bb135081f9f1b23c /FS | |
| parent | 0e17277ed0cc243452dfc07d1bd702502c7d50c3 (diff) | |
| parent | 36e4318e1ccec27ae76a3d1505718a3d47af67c9 (diff) | |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/Template_Mixin.pm | 10 | ||||
| -rw-r--r-- | FS/FS/cust_main/Search.pm | 3 | ||||
| -rw-r--r-- | FS/FS/svc_acct.pm | 26 | ||||
| -rwxr-xr-x | FS/FS/svc_broadband.pm | 6 |
4 files changed, 29 insertions, 16 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 8277c0046..d35fd55f2 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -894,7 +894,6 @@ sub print_generic { warn "$me setting options\n" if $DEBUG > 1; - my $multilocation = scalar($cust_main->cust_location); #too expensive? my %options = (); $options{'section'} = $section if $multisection; $options{'format'} = $format; @@ -904,7 +903,6 @@ sub print_generic { $options{'summary_page'} = $summarypage; $options{'skip_usage'} = scalar(@$extra_sections) && !grep{$section == $_} @$extra_sections; - $options{'multilocation'} = $multilocation; $options{'multisection'} = $multisection; warn "$me searching for line items\n" @@ -2111,8 +2109,6 @@ ignored. multisection: a flag indicating that this is a multisection invoice, which does something complicated. -multilocation: a flag to display the location label for the package. - Returns a list of hashrefs, each of which may contain: pkgnum, description, amount, unit_amount, quantity, _is_setup, and @@ -2134,13 +2130,13 @@ sub _items_cust_bill_pkg { my $unsquelched = $opt{unsquelched} || ''; #unused my $section = $opt{section}->{description} if $opt{section}; my $summary_page = $opt{summary_page} || ''; #unused - my $multilocation = $opt{multilocation} || ''; my $multisection = $opt{multisection} || ''; my $discount_show_always = 0; my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50; my $cust_main = $self->cust_main;#for per-agent cust_bill-line_item-ate_style + # and location labels my @b = (); my ($s, $r, $u) = ( undef, undef, undef ); @@ -2255,7 +2251,7 @@ sub _items_cust_bill_pkg { $cust_pkg->h_labels_short($self->_date, undef, 'I') unless $cust_bill_pkg->pkgpart_override; #don't redisplay services - if ( $multilocation ) { + if ( $cust_pkg->locationnum != $cust_main->ship_locationnum ) { my $loc = $cust_pkg->location_label; $loc = substr($loc, 0, $maxlength). '...' if $format eq 'latex' && length($loc) > $maxlength; @@ -2357,7 +2353,7 @@ sub _items_cust_bill_pkg { warn "$me _items_cust_bill_pkg done adding service details\n" if $DEBUG > 1; - if ( $multilocation ) { + if ( $cust_pkg->locationnum != $cust_main->ship_locationnum ) { my $loc = $cust_pkg->location_label; $loc = substr($loc, 0, $maxlength). '...' if $format eq 'latex' && length($loc) > $maxlength; diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 7b2f30dc4..b07223ec5 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -798,6 +798,9 @@ sub search { my @select = ( 'cust_main.custnum', + # there's a good chance that we'll need these + 'cust_main.bill_locationnum', + 'cust_main.ship_locationnum', FS::UI::Web::cust_sql_fields($params->{'cust_fields'}), ); diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index e67db43c6..7ce79ae01 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -2808,6 +2808,13 @@ Arrayref of additional WHERE clauses, will be ANDed together. sub search { my ($class, $params) = @_; + my @from = ( + ' LEFT JOIN cust_svc USING ( svcnum ) ', + ' LEFT JOIN part_svc USING ( svcpart ) ', + ' LEFT JOIN cust_pkg USING ( pkgnum ) ', + ' LEFT JOIN cust_main USING ( custnum ) ', + ); + my @where = (); # domain @@ -2852,9 +2859,17 @@ sub search { push @where, "svcpart = $1"; } + if ( $params->{'exportnum'} =~ /^(\d+)$/ ) { + push @from, ' LEFT JOIN export_svc USING ( svcpart )'; + push @where, "exportnum = $1"; + } + # sector and tower my @where_sector = $class->tower_sector_sql($params); - push @where, @where_sector if @where_sector; + if ( @where_sector ) { + push @where, @where_sector; + push @from, ' LEFT JOIN tower_sector USING ( sectornum )'; + } # here is the agent virtualization #if ($params->{CurrentUser}) { @@ -2875,16 +2890,9 @@ sub search { push @where, @{ $params->{'where'} } if $params->{'where'}; + my $addl_from = join(' ', @from); my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : ''; - my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. - ' LEFT JOIN part_svc USING ( svcpart ) '. - ' LEFT JOIN cust_pkg USING ( pkgnum ) '. - ' LEFT JOIN cust_main USING ( custnum ) '; - - $addl_from .= ' LEFT JOIN tower_sector USING ( sectornum )' - if @where_sector; - my $count_query = "SELECT COUNT(*) FROM svc_acct $addl_from $extra_sql"; #if ( keys %svc_acct ) { # $count_query .= ' WHERE '. diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 82102697d..26659d52a 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -245,6 +245,12 @@ sub search { push @where, "svcpart = $1"; } + #exportnum + if ( $params->{'exportnum'} =~ /^(\d+)$/ ) { + push @from, 'LEFT JOIN export_svc USING ( svcpart )'; + push @where, "exportnum = $1"; + } + #ip_addr if ( $params->{'ip_addr'} =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/ ) { push @where, "ip_addr = '$1'"; |
