diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2019-02-28 03:44:26 -0800 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2019-02-28 03:44:26 -0800 |
| commit | 75866018ce20f390d3af012c8fb119a8e87616d3 (patch) | |
| tree | 42477a4f7f8cb7d4110ec6e5eb8d1b005e080891 | |
| parent | 3671ac4f46054ab39aded867ec3e5d2732bdb6c3 (diff) | |
fix -C, RT#82943
| -rwxr-xr-x | bin/part_pkg-bulk_change | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/part_pkg-bulk_change b/bin/part_pkg-bulk_change index 176965baf..5347da6be 100755 --- a/bin/part_pkg-bulk_change +++ b/bin/part_pkg-bulk_change @@ -16,9 +16,18 @@ adminsuidsetup $user; my %search = (); $search{'plan'} = $opt_p if $opt_p; $search{'comment'} = $opt_m if $opt_m; -$search{'classnum'} = { op=>'NOT IN', value=>"($opt_C)" } if $opt_C; -foreach my $part_pkg ( qsearch('part_pkg',\%search) ) { +my $extra_sql = ''; +$extra_sql = ( keys(%search) ? 'AND' : 'WHERE' ). + " classnum NOT IN ($opt_C)" + if $opt_C; + +foreach my $part_pkg ( qsearch({ 'table' => 'part_pkg', + 'hashref' => \%search, + 'extra_sql' => $extra_sql, + }) + ) +{ next if ! $part_pkg->freq && $opt_r; if ( $opt_o ) { |
