X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fbulk_change_pkg.cgi;h=2432f3cb3e9103e8f05decd8ca1f20b7e4855683;hb=833cfe5c9938d33c3e6b97ed610c25a7afa6eb04;hp=d2ab4bf494dd69f1c1396818c6e37596227ef001;hpb=c648976f0b7975f2328ebd7ba8c711fad0ca4195;p=freeside.git diff --git a/httemplate/misc/process/bulk_change_pkg.cgi b/httemplate/misc/process/bulk_change_pkg.cgi index d2ab4bf49..2432f3cb3 100755 --- a/httemplate/misc/process/bulk_change_pkg.cgi +++ b/httemplate/misc/process/bulk_change_pkg.cgi @@ -11,16 +11,43 @@ my %search_hash = (); $search_hash{'query'} = $cgi->param('query'); -for my $param (qw(agentnum magic status classnum pkgpart)) { - $search_hash{$param} = $cgi->param($param) - if $cgi->param($param); +#scalars +for (qw( agentnum cust_status cust_main_salesnum salesnum custnum magic status + custom cust_fields pkgbatch zip + 477part 477rownum date + )) +{ + $search_hash{$_} = $cgi->param($_) if length($cgi->param($_)); +} + +#arrays +for my $param (qw( pkgpart classnum refnum towernum )) { + $search_hash{$param} = [ $cgi->param($param) ] + if grep { $_ eq $param } $cgi->param; +} + +#scalars that need to be passed if empty +for my $param (qw( censustract censustract2 )) { + $search_hash{$param} = $cgi->param($param) || '' + 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; + +for my $param (grep /^report_option_any/, $cgi->param) { + $search_hash{$param} = $cgi->param($param); } ### # parse dates ### -#false laziness w/report_cust_pkg.html +#false laziness w/report_cust_pkg.html and bulk_pkg_increment_bill.cgi my %disable = ( 'all' => {}, 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, @@ -30,7 +57,9 @@ my %disable = ( '' => {}, ); -foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { +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); @@ -41,7 +70,7 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { } -my $sql_query = FS::cust_pkg->search_sql(\%search_hash); +my $sql_query = FS::cust_pkg->search(\%search_hash); $sql_query->{'select'} = 'cust_pkg.pkgnum'; my $error = FS::cust_pkg::bulk_change( [ $cgi->param('new_pkgpart') ],