+=cut
+
+sub search_sql_where {
+ my($class, $param) = @_;
+
+ my $cust_bill_param = {
+ map { $_ => $param->{$_} }
+ grep { exists($param->{$_}) }
+ qw( _date invnum_min invnum_max agentnum custnum cust_classnum
+ refnum )
+ };
+ my $search_sql = FS::cust_bill->search_sql_where($cust_bill_param);
+ $search_sql =~ s/cust_bill/cust_bill_void/g;
+ my @search = ($search_sql);
+
+ if ( $param->{void_date} ) {
+ my($beginning, $ending) = @{$param->{void_date}};
+ push @search, "cust_bill_void.void_date >= $beginning",
+ "cust_bill_void.void_date < $ending";
+ }
+
+ if ( $param->{void_usernum} =~ /^(\d+)$/ ) {
+ my $usernum = $1;
+ push @search, "cust_bill_void.void_usernum = $1";
+ }
+
+ join(" AND ", @search);
+}
+
+