LP#1779158 Vandelay queue filters query repair
authorBill Erickson <berickxx@gmail.com>
Mon, 16 Jul 2018 14:56:52 +0000 (10:56 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 11 Oct 2018 18:56:30 +0000 (14:56 -0400)
Fixes an issue with the queued record filters where filtering on import
errors lead to an invalid query, returning zero results.

Modify code to retain the import-errors portion of the from clause.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm

index 84c5055..a25a59f 100644 (file)
@@ -532,17 +532,25 @@ sub retrieve_queued_records {
 
         } elsif( $$options{with_item_import_error} and $type eq 'bib') {
 
-            $query->{from} = {$class => 'vii'};
+            $query->{from} = {$class => {'vii' => {}}};
             $query->{where}->{'+vii'} = {import_error => {'!=' => undef}};
         }
     }
 
     if($self->api_name =~ /matches/) {
         # find only records that have matches
-        $query->{from} = {$class => {$mclass => {type => 'right'}}};
+        if (ref $query->{from}) {
+            $query->{from}{$class}{$mclass} = {type => 'right'};
+        } else {
+            $query->{from} = {$class => {$mclass => {type => 'right'}}};
+        }
     } else {
         # join to mclass for sorting (see below)
-        $query->{from} = {$class => {$mclass => {type => 'left'}}};
+        if (ref $query->{from}) {
+            $query->{from}{$class}{$mclass} = {type => 'left'};
+        } else {
+            $query->{from} = {$class => {$mclass => {type => 'left'}}};
+        }
     }
 
     # order by the matched bib records to group like queued records