[freeside-commits] freeside/httemplate/search report_477.html, 1.7, 1.7.2.1 477partV.html, 1.5, 1.5.2.1 477partVI_census.html, 1.3.2.13, 1.3.2.14

Mark Wells mark at wavetail.420.am
Wed Feb 8 20:00:25 PST 2012


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv15590/httemplate/search

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	report_477.html 477partV.html 477partVI_census.html 
Log Message:
fix 477 report, #16408

Index: 477partVI_census.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/477partVI_census.html,v
retrieving revision 1.3.2.13
retrieving revision 1.3.2.14
diff -u -w -d -r1.3.2.13 -r1.3.2.14
--- 477partVI_census.html	18 Aug 2011 23:59:23 -0000	1.3.2.13
+++ 477partVI_census.html	9 Feb 2012 04:00:22 -0000	1.3.2.14
@@ -114,9 +114,9 @@
       my $extracolumns = "$rowcount AS upload, $columncount AS download, $tech_code as technology_code";
       my $percent = "CASE WHEN count(*) > 0 THEN 100-100*cast(count(cust_main.company) as numeric)/cast(count(*) as numeric) ELSE cast(0 as numeric) END AS residential";
       $sql_query->{select} = "count(*) AS quantity, $extracolumns, censustract, $percent";
-      $sql_query->{extra_sql} =~ /^(.*)(ORDER BY pkgnum)(.*)$/s
-        or die "couldn't parse extra_sql";
-      $sql_query->{extra_sql} = "$1 GROUP BY censustract $3";
+      $sql_query->{order_by} =~ /^(.*)(ORDER BY pkgnum)(.*)$/s
+        or die "couldn't parse order_by";
+      $sql_query->{order_by} = "$1 GROUP BY censustract $3";
       push @sql_query, $sql_query;
     }
     $columncount++;

Index: report_477.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_477.html,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -w -d -r1.7 -r1.7.2.1
--- report_477.html	5 Jun 2011 05:41:46 -0000	1.7
+++ report_477.html	9 Feb 2012 04:00:22 -0000	1.7.2.1
@@ -33,13 +33,23 @@
           element.style.display = 'none';
         }
       }
+      function toggleV() {
+        document.getElementById('enableV').disabled =
+          ! (document.getElementById('enableIIA').checked ||
+             document.getElementById('enableIIB').checked);
+      }
+      function toggleVI() {
+        document.getElementById('enableVI').disabled =
+          ! document.getElementById('enableIA').checked;
+      }
     </SCRIPT>
 
     <% include( '/elements/tr-checkbox.html',
                    'label' => 'Enable part IA?',
                    'field' => 'part',
+                   'id'    => 'enableIA',
                    'value' => 'IA',
-                   'onchange' => 'partchange(this)',
+                   'onchange' => 'partchange(this); toggleVI();',
                )
     %>
 
@@ -115,8 +125,9 @@
     <% include( '/elements/tr-checkbox.html',
                    'label' => 'Enable part IIA?',
                    'field' => 'part',
+                   'id'    => 'enableIIA',
                    'value' => 'IIA',
-                   'onchange' => 'partchange(this)',
+                   'onchange' => 'partchange(this); toggleV();',
                )
     %>
 
@@ -144,8 +155,9 @@
     <% include( '/elements/tr-checkbox.html',
                    'label' => 'Enable part IIB?',
                    'field' => 'part',
+                   'id'    => 'enableIIB',
                    'value' => 'IIB',
-                   'onchange' => 'partchange(this)',
+                   'onchange' => 'partchange(this); toggleV();',
                )
     %>
 
@@ -173,6 +185,7 @@
     <% include( '/elements/tr-checkbox.html',
                    'label' => 'Enable part IV?',
                    'field' => 'part',
+                   'id'    => 'enableIV', #unused
                    'value' => 'IV',
                    'onchange' => 'partchange(this)',
                )
@@ -193,7 +206,10 @@
                    'label' => 'Enable part V?',
                    'field' => 'part',
                    'value' => 'V',
+                   'id'    => 'enableV',
                    'onchange' => 'partchange(this)',
+                   'postfix'  => 
+                    ' <FONT SIZE="-1">(requires Part IIA or IIB)</FONT>',
                )
     %>
     <TR id='partV' style="display:none">
@@ -213,10 +229,16 @@
     <% include( '/elements/tr-checkbox.html',
                    'label' => 'Enable part VI?',
                    'field' => 'part',
+                   'id'    => 'enableVI',
                    'value' => 'VI_census',
+                   'postfix'  =>
+                    ' <FONT SIZE="-1">(requires part IA)</FONT>',
                )
     %>
-
+  <SCRIPT TYPE="text/javascript">
+  toggleV();
+  toggleVI();
+  </SCRIPT>
   </TABLE>
 
 <BR>

Index: 477partV.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/477partV.html,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -w -d -r1.5 -r1.5.2.1
--- 477partV.html	5 Jun 2011 05:41:46 -0000	1.5
+++ 477partV.html	9 Feb 2012 04:00:22 -0000	1.5.2.1
@@ -1,7 +1,7 @@
 <% include( 'elements/search.html',
                   'html_init'         => $html_init,
                   'name'              => 'zip code',
-                  'query'             => [ @sql_query ],
+                  'query'             => $sql_query,
                   'count_query'       => $count_query,
                   'nohtmlheader'      => 1,
                   'disable_total'     => 1,
@@ -10,6 +10,7 @@
                   'no_field_elements' => 1,
                   'fields'            => [ 'zip' ],
                   'url'               => $opt{url} || '',
+                  'disable_download'  => 1,
 
               )
 %>
@@ -33,24 +34,12 @@
 $search_hash{report_option} = $cgi->param('partv_report_option')
   if $cgi->param('partv_report_option');
 
-my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' > 1 });
-$sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip';
-$sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//;
-push @sql_query, $sql_query;
-push @count_query, delete($sql_query->{'count_query'});
-$count_query[0] =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
-$count_query[0] =~ s/ORDER BY [.\w]+//;
-
-$search_hash{report_option} = $cgi->param('partv_report_option')
-  if $cgi->param('partv_report_option');
-
-$sql_query = FS::cust_pkg->search( { %search_hash } );
+my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' => 1 });
 $sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip';
-$sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//;
-push @sql_query, $sql_query;
-push @count_query, delete($sql_query->{'count_query'});
-$count_query[1] =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
-$count_query[1] =~ s/ORDER BY [.\w]+//;
-my $count_query = join(' UNION ', @count_query);
+$sql_query->{order_by} = 'ORDER BY substr(zip,1,5)';
+my $count_query = delete($sql_query->{'count_query'});
+$count_query =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
+$count_query =~ s/ORDER BY [.\w]+//;
 
+warn "\ncount_query:\n$count_query\n\nsql_query:\n".Dumper($sql_query)."\n\n";
 </%init>



More information about the freeside-commits mailing list