ACQ Vandelay : vl ML bits for updating acq records
authorBill Erickson <berick@esilibrary.com>
Wed, 30 Nov 2011 20:42:30 +0000 (15:42 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 30 Nov 2011 20:42:30 +0000 (15:42 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm

index b30d652..ef49f00 100644 (file)
@@ -1090,6 +1090,19 @@ sub import_record_list_impl {
 
             if($e->$update_func($rec)) {
 
+                if($type eq 'bib') {
+
+                    # see if this record is linked from an acq record.
+                    my $li = $e->search_acq_lineitem(
+                        {queued_record => $rec->id, state => {'!=' => 'canceled'}})->[0];
+
+                    if ($li) { 
+                        # if so, update the acq lineitem to point to the imported record
+                        $li->eg_bib_id($rec->imported_as);
+                        $$report_args{evt} = $e->die_event unless $e->update_acq_lineitem($li);
+                    }
+                }
+
                 push @success_rec_ids, $rec_id;
                 finish_rec_import_attempt($report_args);