From 1af581404eae84707fa1c66e3f455eb433e3b16b Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 27 Jul 2018 18:14:31 -0400 Subject: [PATCH] RT# 77160 - added date search on customer timespan report --- httemplate/search/cust_timespan.html | 7 ++++++- httemplate/search/elements/search.html | 15 ++++++++------- httemplate/search/report_cust_timespan.html | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/httemplate/search/cust_timespan.html b/httemplate/search/cust_timespan.html index f5684251a..f95250a44 100644 --- a/httemplate/search/cust_timespan.html +++ b/httemplate/search/cust_timespan.html @@ -11,6 +11,7 @@ 'header' => \@header, 'fields' => \@fields, 'links' => \@links, + 'disable_maxselect' => '1', &> <%init> @@ -84,7 +85,11 @@ my $active_pkg_sql = 'select pkgnum from cust_pkg where cust_pkg.custnum = cust_ ## sql to get the first active date, last cancel date, and last reason. my $active_date = 'select min(setup) from cust_pkg left join part_pkg using (pkgpart) where cust_pkg.custnum = cust_main.custnum and part_pkg.freq > \'0\''; -my $cancel_date = 'select max(cancel) from cust_pkg where cust_pkg.custnum = cust_main.custnum'; + +## set cancel date range here +my($beginning_date, $ending_date) = FS::UI::Web::parse_beginning_ending($cgi, ''); +my $cancel_date = 'select max(cancel) from cust_pkg left join part_pkg using (pkgpart) where cust_pkg.custnum = cust_main.custnum and part_pkg.freq > \'0\' and (cancel >= '.$beginning_date.' and cancel <= '.$ending_date.')'; + my $cancel_reason = 'select reason.reason from cust_pkg left join cust_pkg_reason on (cust_pkg.pkgnum = cust_pkg_reason.pkgnum) left join reason on (cust_pkg_reason.reasonnum = reason.reasonnum) diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 2979eaadc..209302a5d 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -385,14 +385,15 @@ unless ( $type =~ /^(csv|xml|\w*.xls)$/) { #setup some pagination things if we're in html mode my $conf = new FS::Conf; - $confmax = $conf->config('maxsearchrecordsperpage') || 100; - if ( $cgi->param('maxrecords') =~ /^(\d+)$/ ) { - $maxrecords = $1; - } else { - $maxrecords ||= $confmax; - } - $opt{'disable_maxselect'} ||= $conf->exists('disable_maxselect'); + unless ($opt{'disable_maxselect'}) { + $confmax = $conf->config('maxsearchrecordsperpage') || 100; + if ( $cgi->param('maxrecords') =~ /^(\d+)$/ ) { + $maxrecords = $1; + } else { + $maxrecords ||= $confmax; + } + } $limit = $maxrecords ? "LIMIT $maxrecords" : ''; diff --git a/httemplate/search/report_cust_timespan.html b/httemplate/search/report_cust_timespan.html index 4ff3bb892..27dd94006 100644 --- a/httemplate/search/report_cust_timespan.html +++ b/httemplate/search/report_cust_timespan.html @@ -20,6 +20,8 @@ 'curr_value' => scalar( $cgi->param('cust_status') ), &> + <& /elements/tr-input-beginning_ending.html &> + -- 2.11.0