diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS.pm | 6 | ||||
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 12 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 32 | ||||
-rw-r--r-- | FS/FS/part_pkg_report_option.pm | 125 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rw-r--r-- | FS/t/part_pkg_report_option.t | 5 |
8 files changed, 194 insertions, 2 deletions
@@ -167,9 +167,9 @@ L<FS::part_export> - External provisioning export class L<FS::part_export_option> - Export option class -L<FS::pkg_category> - Package category class +L<FS::pkg_category> - Package category class (invoice oriented) -L<FS::pkg_class> - Package class class +L<FS::pkg_class> - Package class class (tax oriented) L<FS::part_pkg> - Package definition class @@ -179,6 +179,8 @@ L<FS::part_pkg_taxclass> - Tax class class L<FS::part_pkg_option> - Package definition option class +L<FS::part_pkg_report_option> - Package reporting classification class + L<FS::pkg_svc> - Class linking package definitions (see L<FS::part_pkg>) with service definitions (see L<FS::part_svc>) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index b45cdd797..12d6075b8 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2576,6 +2576,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'cust_main-require_censustract', + 'section' => 'UI', + 'description' => 'Customer is required to have a census tract. Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address', + 'type' => 'checkbox', + }, + + { 'key' => 'disable_acl_changes', 'section' => '', 'description' => 'Disable all ACL changes, for demos.', diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index aed8d6079..61cd17e06 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -686,6 +686,7 @@ sub tables_hashref { 'paytype', 'varchar', 'NULL', $char_d, '', '', 'payip', 'varchar', 'NULL', 15, '', '', 'geocode', 'varchar', 'NULL', 20, '', '', + 'censustract', 'varchar', 'NULL', 20, '', '', # 7 to save space? 'tax', 'char', 'NULL', 1, '', '', 'otaker', 'varchar', '', 32, '', '', 'refnum', 'int', '', '', '', '', @@ -1850,6 +1851,17 @@ sub tables_hashref { 'index' => [ [ 'pkgpart' ], [ 'optionname' ] ], }, + 'part_pkg_report_option' => { + 'columns' => [ + 'num', 'serial', '', '', '', '', + 'name', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'num', + 'unique' => [ [ 'name' ] ], + 'index' => [ [ 'disabled' ] ], + }, + 'rate' => { 'columns' => [ 'ratenum', 'serial', '', '', '', '', diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 3f23346db..e5f289ca3 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -7573,6 +7573,13 @@ sub search_sql { unless $params->{'cancelled_pkgs'}; ## + # parse without census tract checkbox + ## + + push @where, "(censustract = '' or censustract is null)" + if $params->{'no_censustract'}; + + ## # dates ## diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index a510c5245..881e005de 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -2325,12 +2325,44 @@ sub search_sql { #eslaf ### + # parse package report options + ### + + my @report_option = (); + if ( exists($params->{'report_option'}) + && $params->{'report_option'} =~ /^([,\d]*)$/ + ) + { + @report_option = split(',', $1); + } + + if (@report_option) { + # this will result in the empty set for the dangling comma case as it should + push @where, + map{ "0 < ( SELECT count(*) FROM part_pkg_option + WHERE part_pkg_option.pkgpart = part_pkg.pkgpart + AND optionname = 'report_option_$_' + AND optionvalue = '1' )" + } @report_option; + } + + #eslaf + + ### # parse custom ### push @where, "part_pkg.custom = 'Y'" if $params->{custom}; ### + # parse censustract + ### + + if ( $params->{'censustract'} =~ /^([.\d]+)$/ and $1 ) { + push @where, "cust_main.censustract = '". $params->{censustract}. "'"; + } + + ### # parse part_pkg ### diff --git a/FS/FS/part_pkg_report_option.pm b/FS/FS/part_pkg_report_option.pm new file mode 100644 index 000000000..16a4c9864 --- /dev/null +++ b/FS/FS/part_pkg_report_option.pm @@ -0,0 +1,125 @@ +package FS::part_pkg_report_option; + +use strict; +use base qw( FS::Record ); +use FS::Record qw( qsearch qsearchs ); + +=head1 NAME + +FS::part_pkg_report_option - Object methods for part_pkg_report_option records + +=head1 SYNOPSIS + + use FS::part_pkg_report_option; + + $record = new FS::part_pkg_report_option \%hash; + $record = new FS::part_pkg_report_option { 'column' => 'value' }; + + $error = $record->insert; + + $error = $new_record->replace($old_record); + + $error = $record->delete; + + $error = $record->check; + +=head1 DESCRIPTION + +An FS::part_pkg_report_option object represents a package definition optional +reporting classification. FS::part_pkg_report_option inherits from +FS::Record. The following fields are currently supported: + +=over 4 + +=item num + +primary key + +=item name + +name - The name associated with the reporting option + +=item disabled + +disabled - set to 'Y' to prevent addition to new packages + + +=back + +=head1 METHODS + +=over 4 + +=item new HASHREF + +Creates a new report option. To add the option to the database, see L<"insert">. + +Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the I<hash> method. + +=cut + +sub table { 'part_pkg_report_option'; } + +=item insert + +Adds this record to the database. If there is an error, returns the error, +otherwise returns false. + +=cut + +=item delete + +Delete this record from the database. + +=cut + +sub delete { + return "Can't delete part_pkg_report_option records!"; +} + +=item replace OLD_RECORD + +Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. + +=cut + +=item check + +Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. + +=cut + +# the check method should currently be supplied - FS::Record contains some +# data checking routines + +sub check { + my $self = shift; + + my $error = + $self->ut_numbern('num') + || $self->ut_text('name') + || $self->ut_enum('disabled', [ '', 'Y' ]) + ; + return $error if $error; + + $self->SUPER::check; +} + +=back + +=head1 BUGS + +Overlaps somewhat with pkg_class and pkg_category + +=head1 SEE ALSO + +L<FS::Record>, schema.html from the base documentation. + +=cut + +1; + diff --git a/FS/MANIFEST b/FS/MANIFEST index 70287a3d9..7def8dffd 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -439,6 +439,8 @@ FS/cust_bill_pkg_tax_rate_location.pm t/cust_bill_pkg_tax_rate_location.t FS/cust_recon.pm t/cust_recon.t +FS/part_pkg_report_option.pm +t/part_pkg_report_option.t FS/cust_main_exemption.pm t/cust_main_exemption.t FS/cust_tax_adjustment.pm diff --git a/FS/t/part_pkg_report_option.t b/FS/t/part_pkg_report_option.t new file mode 100644 index 000000000..622bb3872 --- /dev/null +++ b/FS/t/part_pkg_report_option.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::part_pkg_report_option; +$loaded=1; +print "ok 1\n"; |