X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=dd4d11c5fb82d79b546e21fa3b659cc79b739b10;hb=517ad7e0c5bd5a6329dfd3ef9c35f69afea9fc49;hp=009c81e06f3a68ef881cf83c31ed11c08ce086e4;hpb=c99a171b22bf8776a4ba449aed55e20904c881fa;p=freeside.git diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 009c81e06..dd4d11c5f 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -4,7 +4,7 @@ use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Sales_Mixin FS::m2m_Common FS::option_Common ); use strict; -use vars qw($disable_agentcheck $DEBUG $me); +use vars qw( $disable_agentcheck $DEBUG $me $upgrade ); use Carp qw(cluck); use Scalar::Util qw( blessed ); use List::Util qw(min max); @@ -54,6 +54,8 @@ $me = '[FS::cust_pkg]'; $disable_agentcheck = 0; +$upgrade = 0; #go away after setup+start dates cleaned up for old customers + sub _cache { my $self = shift; my ( $hashref, $cache ) = @_; @@ -656,7 +658,7 @@ sub check { return $error if $error; return "A package with both start date (future start) and setup date (already started) will never bill" - if $self->start_date && $self->setup; + if $self->start_date && $self->setup && ! $upgrade; return "A future unsuspend date can only be set for a package with a suspend date" if $self->resume and !$self->susp and !$self->adjourn; @@ -1858,7 +1860,7 @@ sub change { if ( $opt->{cust_main} ) { my $cust_main = $opt->{cust_main}; unless ( $cust_main->custnum ) { - my $error = $cust_main->insert; + my $error = $cust_main->insert( @{ $opt->{cust_main_insert_args}||[] } ); if ( $error ) { $dbh->rollback if $oldAutoCommit; return "inserting cust_main (transaction rolled back): $error"; @@ -3460,8 +3462,7 @@ sub attribute_since_sqlradacct { foreach my $cust_svc ( grep { my $part_svc = $_->part_svc; - $part_svc->svcdb eq 'svc_acct' - && scalar($part_svc->part_export_usage); + scalar($part_svc->part_export_usage); } $self->cust_svc ) { $sum += $cust_svc->attribute_since_sqlradacct($start, $end, $attrib); @@ -4285,21 +4286,29 @@ For FCC 477 reporting, mostly. =item location_cust -Limit to packages whose service location is the same as the customer's +Limit to packages whose service locations are the same as the customer's default service location. =item location_nocust -Limit to packages whose service location is not the customer's default +Limit to packages whose service locations are not the customer's default service location. =item location_census -Limit to packages whose service location has a census tract. +Limit to packages whose service locations have census tracts. =item location_nocensus -Limit to packages whose service location doesn't have a census tract. +Limit to packages whose service locations do not have a census tract. + +=item location_geocode + +Limit to packages whose locations have geocodes. + +=item location_geocode + +Limit to packages whose locations do not have geocodes. =back @@ -4543,6 +4552,10 @@ sub search { my $op = $params->{location_census} ? "IS NOT NULL" : "IS NULL"; push @where, "cust_location.censustract $op"; } + if ( $params->{location_geocode} xor $params->{location_nogeocode} ) { + my $op = $params->{location_geocode} ? "IS NOT NULL" : "IS NULL"; + push @where, "cust_location.geocode $op"; + } ### # parse part_pkg