summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-12-22 15:30:56 -0800
committerIvan Kohler <ivan@freeside.biz>2016-12-22 15:30:56 -0800
commit399013698f9ba6ff2c9861a839f424da9609825e (patch)
tree69b3b1340b39062b2eacf484ee926f9630108f0e /httemplate/search
parent36b5fc9c511af4fdf1f09530129352b3d7f2685e (diff)
package search on null dates, RT#73715
Diffstat (limited to 'httemplate/search')
-rwxr-xr-xhttemplate/search/cust_pkg.cgi2
-rwxr-xr-xhttemplate/search/report_cust_pkg.html62
2 files changed, 56 insertions, 8 deletions
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index dbd346dba..df1d7e589 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -203,6 +203,8 @@ my %disable = (
foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end change_date cancel active )) {
+ $search_hash{$field.'_null'} = scalar( $cgi->param($field.'_null') );
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
next if $beginning == 0 && $ending == 4294967295
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
index ac19de8aa..ed5af2481 100755
--- a/httemplate/search/report_cust_pkg.html
+++ b/httemplate/search/report_cust_pkg.html
@@ -80,6 +80,7 @@
what.form.<% $field %>_beginning_text.disabled = true;
what.form.<% $field %>_ending_text.disabled = true;
+ what.form.<% $field %>_null.disabled = true;
what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
@@ -90,15 +91,21 @@
% } else {
- what.form.<% $field %>_beginning_text.disabled = false;
- what.form.<% $field %>_ending_text.disabled = false;
- what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
- what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
+ what.form.<% $field %>_null.disabled = false;
- what.form.<% $field %>_beginning_button.style.display = '';
- what.form.<% $field %>_ending_button.style.display = '';
- what.form.<% $field %>_beginning_disabled.style.display = 'none';
- what.form.<% $field %>_ending_disabled.style.display = 'none';
+ if ( ! what.form.<% $field %>_null.checked ) {
+
+ what.form.<% $field %>_beginning_text.disabled = false;
+ what.form.<% $field %>_ending_text.disabled = false;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
+
+ what.form.<% $field %>_beginning_button.style.display = '';
+ what.form.<% $field %>_ending_button.style.display = '';
+ what.form.<% $field %>_beginning_disabled.style.display = 'none';
+ what.form.<% $field %>_ending_disabled.style.display = 'none';
+
+ }
% }
% }
@@ -109,6 +116,37 @@
}
+% foreach my $field (@date_fields) {
+
+ function <% $field %>_null_changed(what) {
+
+ if ( what.checked ) {
+ what.form.<% $field %>_beginning_text.disabled = true;
+ what.form.<% $field %>_ending_text.disabled = true;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
+ what.form.<% $field %>_beginning_button.style.display = 'none';
+ what.form.<% $field %>_ending_button.style.display = 'none';
+ what.form.<% $field %>_beginning_disabled.style.display = '';
+ what.form.<% $field %>_ending_disabled.style.display = '';
+
+ } else {
+ what.form.<% $field %>_beginning_text.disabled = false;
+ what.form.<% $field %>_ending_text.disabled = false;
+ what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
+ what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
+
+ what.form.<% $field %>_beginning_button.style.display = '';
+ what.form.<% $field %>_ending_button.style.display = '';
+ what.form.<% $field %>_beginning_disabled.style.display = 'none';
+ what.form.<% $field %>_ending_disabled.style.display = 'none';
+
+ }
+
+ }
+
+% }
+
</SCRIPT>
<& /elements/tr-select-pkg_class.html,
@@ -135,6 +173,7 @@
<TD></TD>
<TD>From date <i>(m/d/y)</i></TD>
<TD>To date <i>(m/d/y)</i></TD>
+ <TD>Empty date</TD>
</TR>
% my $noinit = 0;
% foreach my $field (@date_fields) {
@@ -152,6 +191,13 @@
</TD>
% $noinit = 1;
% }
+ <TD ALIGN="center">
+ <& /elements/checkbox.html,
+ 'field' => $field.'_null',
+ 'value' => 'Y',
+ 'onchange' => $field.'_null_changed',
+ &>
+ </TD>
</TR>
% } #foreach $field
</TABLE>