From 0aec475a117564063a98a4e0219b35946eb393db Mon Sep 17 00:00:00 2001 From: berick Date: Mon, 2 May 2011 15:49:33 -0400 Subject: [PATCH] added 'with_import_error' option to queued record retrieval; returns recs with either a record or item import failure (or both) --- .../perlmods/lib/OpenILS/Application/Vandelay.pm | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm index 7f34422851..4df6c1d329 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm @@ -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/) { -- 2.11.0