[freeside-commits] branch FREESIDE_3_BRANCH updated. f5fa5936b194d069689856e3854410e22f2b8d90
Mark Wells
mark at 420.am
Thu Oct 17 19:27:32 PDT 2013
The branch, FREESIDE_3_BRANCH has been updated
via f5fa5936b194d069689856e3854410e22f2b8d90 (commit)
from c5faf08296702144c0b35ca857df1ca3313c37ff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f5fa5936b194d069689856e3854410e22f2b8d90
Author: Mark Wells <mark at freeside.biz>
Date: Thu Oct 17 19:27:17 2013 -0700
advanced package report: search by properties of the location object, #23582
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index b2cb8f0..682b11b 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4239,6 +4239,24 @@ boolean; if true, returns only packages with more than 0 FCC phone lines.
Limit to packages with a service location in the specified state and country.
For FCC 477 reporting, mostly.
+=item location_cust
+
+Limit to packages whose service location is the same as the customer's
+default service location.
+
+=item location_nocust
+
+Limit to packages whose service location is not the customer's default
+service location.
+
+=item location_census
+
+Limit to packages whose service location has a census tract.
+
+=item location_nocensus
+
+Limit to packages whose service location doesn't have a census tract.
+
=back
=cut
@@ -4471,6 +4489,18 @@ sub search {
}
###
+ # location_* flags
+ ###
+ if ( $params->{location_cust} xor $params->{location_nocust} ) {
+ my $op = $params->{location_cust} ? '=' : '!=';
+ push @where, "cust_location.locationnum $op cust_main.ship_locationnum";
+ }
+ if ( $params->{location_census} xor $params->{location_nocensus} ) {
+ my $op = $params->{location_census} ? "IS NOT NULL" : "IS NULL";
+ push @where, "cust_location.censustract $op";
+ }
+
+ ###
# parse part_pkg
###
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 995779a..54bfa00 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -175,6 +175,10 @@ for my $param (qw( censustract censustract2 )) {
if grep { $_ eq $param } $cgi->param;
}
+#location flags (checkboxes)
+my @loc = grep /^\w+$/, $cgi->param('loc');
+$search_hash{"location_$_"} = 1 foreach @loc;
+
my $report_option = $cgi->param('report_option');
$search_hash{report_option} = $report_option if $report_option;
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
index f9aabfc..b3f2004 100755
--- a/httemplate/search/report_cust_pkg.html
+++ b/httemplate/search/report_cust_pkg.html
@@ -8,11 +8,7 @@
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
- <TR>
- <TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1">Customer search options</FONT>
- </TH>
- </TR>
+ <& /elements/tr-title.html, value => mt('Customer search options') &>
<& /elements/tr-select-agent.html,
'curr_value' => scalar( $cgi->param('agentnum') ),
@@ -56,11 +52,7 @@
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
- <TR>
- <TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1">Package search options</FONT>
- </TH>
- </TR>
+ <& /elements/tr-title.html, value => mt('Package search options') &>
<& /elements/tr-select-sales.html,
'label' => 'Package sales person',
@@ -70,11 +62,10 @@
'disable_empty' => 1,
&>
- <% include( '/elements/tr-select-cust_pkg-status.html',
+ <& /elements/tr-select-cust_pkg-status.html,
'label' => 'Package status',
'onchange' => 'status_changed(this);',
- )
- %>
+ &>
<SCRIPT TYPE="text/javascript">
@@ -120,23 +111,21 @@
</SCRIPT>
- <% include( '/elements/tr-select-pkg_class.html',
+ <& /elements/tr-select-pkg_class.html,
'pre_options' => [ '0' => 'all' ],
'empty_label' => '(empty class)',
- )
- %>
+ &>
% if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
- <% include( '/elements/tr-select-table.html',
+ <& /elements/tr-select-table.html,
'label' => 'Report classes',
'table' => 'part_pkg_report_option',
'name_col' => 'name',
'hashref' => { 'disabled' => '' },
'element_name' => 'report_option',
'multiple' => 'multiple',
- )
- %>
+ &>
% }
<TR>
@@ -189,24 +178,33 @@
</SCRIPT>
- <% include( '/elements/tr-checkbox.html',
+ <& /elements/tr-checkbox.html,
'label' => 'Custom packages',
'field' => 'custom',
'value' => 1,
'onchange' => 'custom_changed(this);',
- )
- %>
-
- <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
+ &>
+
+ <& /elements/tr-selectmultiple-part_pkg.html &>
+
+ <& /elements/tr-title.html, value => mt('Location search options') &>
+
+% my @location_options = qw(cust nocust census nocensus);
+ <& /elements/tr-checkbox-multiple.html,
+ 'label' => 'Where package location:',
+ 'field' => 'loc',
+ 'options' => \@location_options,
+ 'labels' => { 'cust' => "is the customer's default location",
+ 'nocust' => "is not the customer's default location",
+ 'census' => "has a census tract",
+ 'nocensus' => "does not have a census tract",
+ },
+ 'value' => { map { $_ => 1 } @location_options },
+ &>
- <TR>
- <TH CLASS="background" COLSPAN=2> </TH>
- </TR>
+ <& /elements/tr-title.html, value => mt('Display options') &>
- <TR>
- <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
- </TR>
- <% include( '/elements/tr-select-cust-fields.html' ) %>
+ <& /elements/tr-select-cust-fields.html &>
</TABLE>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 30 ++++++++++++++++
httemplate/search/cust_pkg.cgi | 4 ++
httemplate/search/report_cust_pkg.html | 60 +++++++++++++++----------------
3 files changed, 63 insertions(+), 31 deletions(-)
More information about the freeside-commits
mailing list