[freeside-commits] freeside/FS/FS Conf.pm, 1.362, 1.363 Mason.pm, 1.36, 1.37 Schema.pm, 1.216, 1.217 cust_pkg.pm, 1.162, 1.163 part_pkg.pm, 1.103, 1.104

Jeff Finucane,420,, jeff at wavetail.420.am
Sat May 22 12:57:55 PDT 2010


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

Modified Files:
	Conf.pm Mason.pm Schema.pm cust_pkg.pm part_pkg.pm 
Log Message:
improved fcc 477 report #7783

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -w -d -r1.216 -r1.217
--- Schema.pm	20 May 2010 22:48:41 -0000	1.216
+++ Schema.pm	22 May 2010 19:57:53 -0000	1.217
@@ -1461,6 +1461,7 @@
         'pay_weight',    'real',    'NULL', '', '', '',
         'credit_weight', 'real',    'NULL', '', '', '',
         'agentnum',      'int',     'NULL', '', '', '', 
+        'fcc_ds0s',      'int',     'NULL', '', '', '', 
         'no_auto',      'char',     'NULL',  1, '', '', 
       ],
       'primary_key' => 'pkgpart',

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.362
retrieving revision 1.363
diff -u -w -d -r1.362 -r1.363
--- Conf.pm	18 May 2010 03:25:31 -0000	1.362
+++ Conf.pm	22 May 2010 19:57:53 -0000	1.363
@@ -2370,6 +2370,13 @@
   },
 
   {
+    'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
+    'section'     => 'UI',
+    'description' => "Show a field on package definitions for assigning a DSO equivalency number suitable for use on FCC form 477.",
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'svc_acct-edit_uid',
     'section'     => 'shell',
     'description' => 'Allow UID editing.',

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -w -d -r1.103 -r1.104
--- part_pkg.pm	30 Mar 2010 02:53:10 -0000	1.103
+++ part_pkg.pm	22 May 2010 19:57:53 -0000	1.104
@@ -98,6 +98,8 @@
 
 =item agentnum - Optional agentnum (see L<FS::agent>)
 
+=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477
+
 =back
 
 =head1 METHODS
@@ -480,6 +482,7 @@
            ? $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum' )
            : $self->ut_agentnum_acl('agentnum', \@null_agentnum_right)
        )
+    || $self->ut_numbern('fcc_ds0s')
     || $self->SUPER::check
   ;
   return $error if $error;

Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -w -d -r1.36 -r1.37
--- Mason.pm	8 May 2010 02:38:53 -0000	1.36
+++ Mason.pm	22 May 2010 19:57:53 -0000	1.37
@@ -125,6 +125,7 @@
                    states_hash counties cities state_label
                  );
   use FS::Misc::eps2png qw( eps2png );
+  use FS::Report::FCC_477;
   use FS::Report::Table::Monthly;
   use FS::TicketSystem;
   use FS::Tron qw( tron_lint );

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -w -d -r1.162 -r1.163
--- cust_pkg.pm	8 Apr 2010 01:15:25 -0000	1.162
+++ cust_pkg.pm	22 May 2010 19:57:53 -0000	1.163
@@ -2563,6 +2563,10 @@
 
 specifies the user for agent virtualization
 
+=item fcc_line
+
+ boolean selects packages containing fcc form 477 telco lines
+
 =back
 
 =cut
@@ -2684,6 +2688,12 @@
   push @where,  "part_pkg.custom = 'Y'" if $params->{custom};
 
   ###
+  # parse fcc_line
+  ###
+
+  push @where,  "part_pkg.fcc_ds0s > 0" if $params->{fcc_line};
+
+  ###
   # parse censustract
   ###
 
@@ -2841,6 +2851,35 @@
 
 }
 
+=item fcc_477_count
+
+Returns a list of two package counts.  The first is a count of packages
+based on the supplied criteria and the second is the count of residential
+packages with those same criteria.  Criteria are specified as in the search
+method.
+
+=cut
+
+sub fcc_477_count {
+  my ($class, $params) = @_;
+
+  my $sql_query = $class->search( $params );
+
+  my $count_sql = delete($sql_query->{'count_query'});
+  $count_sql =~ s/ FROM/,count(CASE WHEN cust_main.company IS NULL OR cust_main.company = '' THEN 1 END) FROM/
+    or die "couldn't parse count_sql";
+
+  my $count_sth = dbh->prepare($count_sql)
+    or die "Error preparing $count_sql: ". dbh->errstr;
+  $count_sth->execute
+    or die "Error executing $count_sql: ". $count_sth->errstr;
+  my $count_arrayref = $count_sth->fetchrow_arrayref;
+
+  return ( @$count_arrayref );
+
+}
+
+
 =item location_sql
 
 Returns a list: the first item is an SQL fragment identifying matching 



More information about the freeside-commits mailing list