added 'with_import_error' option to queued record retrieval; returns recs with eithe...
authorberick <berick@esilibrary.com>
Mon, 2 May 2011 19:49:33 +0000 (15:49 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Jul 2011 18:50:51 +0000 (14:50 -0400)
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm

index 7f34422..4df6c1d 100644 (file)
@@ -430,19 +430,25 @@ sub retrieve_queued_records {
     };
 
     $query->{where}->{import_time} = undef if $$options{non_imported};
-    $query->{where}->{import_error} = {'!=' => undef} if $$options{with_rec_import_error};
-
-    if($$options{with_item_import_error} and $type eq 'bib') {
-        # limit to recs that have at least 1 item import error
-        $query->{from} = {
-            $class => {
-                vii => {
-                    field => 'record',
-                    fkey => 'id',
-                    filter => {import_error => {'!=' => undef}}
-                }
-            }
-        };
+
+    if($$options{with_import_error}) {
+
+        $query->{from} = {$class => {vii => {type => 'right'}}};
+        $query->{where}->{'-or'} = [
+            {'+vqbr' => {import_error => {'!=' => undef}}},
+            {'+vii' => {import_error => {'!=' => undef}}}
+        ];
+
+    } else {
+        
+        if($$options{with_rec_import_error}) {
+            $query->{where}->{import_error} = {'!=' => undef};
+
+        } elsif( $$options{with_item_import_error} and $type eq 'bib') {
+
+            $query->{from} = {$class => 'vii'};
+            $query->{where}->{'+vii'} = {import_error => {'!=' => undef}};
+        }
     }
 
     if($self->api_name =~ /matches/) {