Protect against duplicate Located URIs at ingest time
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 16:12:55 +0000 (16:12 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 16:12:55 +0000 (16:12 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13599 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm

index 1d30d18..5789fe0 100644 (file)
@@ -175,11 +175,19 @@ sub rw_biblio_ingest_single_object {
             }
         }
 
+        # Check for an existing CN-URI map
+        $tmp = $cstore->request(
+            'open-ils.cstore.direct.asset.uri_call_number_map.id_list',
+            { call_number => $u->{call_number}->id, uri => $u->{uri}->id }
+        )->gather(1);
+
+        next if ($tmp);
+
         my $umap = Fieldmapper::asset::uri_call_number_map->new;
         $umap->uri($u->{uri}->id);
         $umap->call_number($u->{call_number}->id);
 
-        $cstore->request( 'open-ils.cstore.direct.asset.uri_call_number_map.create' => $umap )->gather(1) if (!$tmp);
+        $cstore->request( 'open-ils.cstore.direct.asset.uri_call_number_map.create' => $umap )->gather(1);
     }
 
     # update full_rec stuff ...