From 39fd666a49b2be516967131a46891f17ce0101da Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 24 Nov 2006 08:49:09 +0000 Subject: [PATCH] add less than and greater than amounts to credit and payment searches --- FS/FS/UI/Web.pm | 32 +++++++++++++++++ httemplate/elements/tr-input-beginning_ending.html | 4 +-- .../elements/tr-input-lessthan_greaterthan.html | 13 +++++++ httemplate/search/cust_credit.html | 23 +++---------- httemplate/search/cust_pay.cgi | 2 ++ httemplate/search/report_cust_credit.html | 40 ++++++++++++++-------- httemplate/search/report_cust_pay.html | 6 ++++ 7 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 httemplate/elements/tr-input-lessthan_greaterthan.html diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 080ac6e64..c9eaf5012 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -32,6 +32,38 @@ sub parse_beginning_ending { ( $beginning, $ending ); } +sub parse_lt_gt { + my($cgi, $field) = @_; + + my @search = (); + + my %op = ( + 'lt' => '<', + 'gt' => '>', + ); + + foreach my $op (keys %op) { + + warn "checking for ${field}_$op field\n" + if $DEBUG; + + if ( $cgi->param($field."_$op") =~ /^\s*\$?\s*([\d\,\s]+(\.\d\d)?)\s*$/ ) { + + my $num = $1; + $num =~ s/[\,\s]+//g; + my $search = "$field $op{$op} $num"; + push @search, $search; + + warn "found ${field}_$op field; adding search element $search\n" + if $DEBUG; + } + + } + + @search; + +} + ### # cust_main report subroutines ### diff --git a/httemplate/elements/tr-input-beginning_ending.html b/httemplate/elements/tr-input-beginning_ending.html index a8ab6ed10..397f7498a 100644 --- a/httemplate/elements/tr-input-beginning_ending.html +++ b/httemplate/elements/tr-input-beginning_ending.html @@ -5,7 +5,7 @@ - From: + From date: MAXLENGTH=<%$maxlength%>>
m/d/y<% $time_hint %>