[freeside-commits] freeside/FS/FS part_pkg_report_option.pm, NONE, 1.1 Conf.pm, 1.294, 1.295 Schema.pm, 1.146, 1.147 cust_main.pm, 1.436, 1.437 cust_pkg.pm, 1.129, 1.130

Jeff Finucane,420,, jeff at wavetail.420.am
Mon Jun 29 06:53:25 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv21344/FS/FS

Modified Files:
	Conf.pm Schema.pm cust_main.pm cust_pkg.pm 
Added Files:
	part_pkg_report_option.pm 
Log Message:
FCC form 477 reporting #4912

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- Schema.pm	25 Jun 2009 01:28:53 -0000	1.146
+++ Schema.pm	29 Jun 2009 13:53:23 -0000	1.147
@@ -686,6 +686,7 @@
         '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 @@
       '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', '', '', '', '', 

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -d -r1.294 -r1.295
--- Conf.pm	26 Jun 2009 06:55:07 -0000	1.294
+++ Conf.pm	29 Jun 2009 13:53:23 -0000	1.295
@@ -2576,6 +2576,13 @@
   },
 
   {
+    '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.',

--- NEW FILE: part_pkg_report_option.pm ---
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;


Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.436
retrieving revision 1.437
diff -u -d -r1.436 -r1.437
--- cust_main.pm	26 Jun 2009 18:53:46 -0000	1.436
+++ cust_main.pm	29 Jun 2009 13:53:23 -0000	1.437
@@ -7573,6 +7573,13 @@
     unless $params->{'cancelled_pkgs'};
 
   ##
+  # parse without census tract checkbox
+  ##
+
+  push @where, "(censustract = '' or censustract is null)"
+    if $params->{'no_censustract'};
+
+  ##
   # dates
   ##
 

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- cust_pkg.pm	21 Jun 2009 15:21:30 -0000	1.129
+++ cust_pkg.pm	29 Jun 2009 13:53:23 -0000	1.130
@@ -2325,12 +2325,44 @@
   #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
   ###
 



More information about the freeside-commits mailing list