Acq: bug fix. Thinko let to unintended search term negation in unified search.
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Apr 2010 19:19:55 +0000 (19:19 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Apr 2010 19:19:55 +0000 (19:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16144 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm

index 24e1b92..d1d3447 100644 (file)
@@ -182,13 +182,19 @@ sub prepare_au_terms {
                     $links->{$attr}->{"class"} eq "au") {
                     push @joins, [$plain_hint, $attr, $join_num];
                     my $au_term = gen_au_term($value, $join_num);
-                    $au_term = {"-not" => $au_term} if $nots--;
+                    if ($nots > 0) {
+                        $au_term = {"-not" => $au_term};
+                        $nots--;
+                    }
                     push @new_outer_terms, $au_term;
                     $join_num++;
                     delete $hint_unit->{$hint};
                 }
             }
-            $hint_unit = {"-not" => $hint_unit} if $nots--;
+            if ($nots > 0) {
+                $hint_unit = {"-not" => $hint_unit};
+                $nots--;
+            }
             push @new_outer_terms, $hint_unit if scalar keys %$hint_unit;
         }
         $terms->{$conj} = [ @new_outer_terms ];