[open-ils-commits] r18939 - branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 8 23:45:32 EST 2010
Author: dbs
Date: 2010-12-08 23:45:29 -0500 (Wed, 08 Dec 2010)
New Revision: 18939
Modified:
branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Log:
Enable Ingest to ingest multiple located URIs for a single org-unit at once
Previous logic incorrectly restricted a given bib record to have one located
URI per org-unit - unless you reingested it multiple times, each time adding
one more URI per org-unit.
We also add the strict pragma and adjust some syntax accordingly.
Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm 2010-12-09 04:44:14 UTC (rev 18938)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm 2010-12-09 04:45:29 UTC (rev 18939)
@@ -2,6 +2,7 @@
use OpenILS::Application;
use base qw/OpenILS::Application/;
+use strict;
use Unicode::Normalize;
use OpenSRF::EX qw/:try/;
@@ -128,13 +129,13 @@
# update uri stuff ...
# gather URI call numbers for this record
- my $uri_cns = $u->{call_number} = $cstore->request(
+ my $uri_cns = $cstore->request(
'open-ils.cstore.direct.asset.call_number.id_list.atomic' => { record => $bib->id, label => '##URI##' }
)->gather(1);
if (@$uri_cns) {
# gather the maps for those call numbers
- my $uri_maps = $u->{call_number} = $cstore->request(
+ my $uri_maps = $cstore->request(
'open-ils.cstore.direct.asset.uri_call_number_map.id_list.atomic' => { call_number => $uri_cns }
)->gather(1);
@@ -149,7 +150,6 @@
# now, add CNs, URIs and maps
my %new_cns_by_owner;
- my %new_uris_by_owner;
for my $u ( @{ $blob->{uri} } ) {
my $owner = $u->{call_number}->owning_lib;
@@ -166,13 +166,9 @@
}
if ($u->{uri}->isnew) {
- if ($new_uris_by_owner{$owner}) {
- $u->{uri} = $new_uris_by_owner{$owner};
- } else {
- $u->{uri} = $new_uris_by_owner{$owner} = $cstore->request(
- 'open-ils.cstore.direct.asset.uri.create' => $u->{uri}
- )->gather(1);
- }
+ $u->{uri} = $cstore->request(
+ 'open-ils.cstore.direct.asset.uri.create' => $u->{uri}
+ )->gather(1);
}
# Check for an existing CN-URI map
@@ -901,8 +897,8 @@
$value =~ s/\W+$//sgo;
# hack to normalize ratio-like strings
- while ($term =~ /\b\d{1}:[, ]?\d+(?:[ ,]\d+[^:])+/o) {
- $term = $` . join ('', split(/[, ]/, $&)) . $';
+ while ($value =~ /\b\d{1}:[, ]?\d+(?:[ ,]\d+[^:])+/o) {
+ $value = $` . join ('', split(/[, ]/, $&)) . $';
}
$value =~ s/\b\.+\b//sgo;
@@ -1030,7 +1026,7 @@
next unless $tagline;
_data_tag_to_full_rows($type, $tagline, \@ns_list, $tagline->getAttribute( "tag" ));
- if ($xmltype eq 'metabib' and $tag eq '245') {
+ if ($xmltype eq 'metabib' and $tagline->getAttribute( "tag" ) eq '245') {
_data_tag_to_full_rows($type, $tagline, \@ns_list, 'tnf');
}
}
@@ -1159,7 +1155,7 @@
my @rows = $self->method_lookup("open-ils.ingest.flat_marc.$type.xml")->run($r->marc);
for my $row (@rows) {
$client->respond($row);
- $log->debug(OpenSRF::Utils::JSON->perl2JSON($row), DEBUG);
+ $log->debug(OpenSRF::Utils::JSON->perl2JSON($row));
}
return undef;
}
@@ -1253,7 +1249,7 @@
# see if we need to create a call number
my $cn = $cn_cache{$org->id};
$cn = $cn->clone if ($cn);
- $cn->clear_isnew if ($cn);
+ $cn->clear_isnew if ($cn && $cn->isnew() != 1);
$cn ||= $cstore
->request( 'open-ils.cstore.direct.asset.call_number.search' => { owning_lib => $org->id, record => $recid, label => '##URI##' } )
@@ -1351,7 +1347,7 @@
return undef unless ($r and $r->marc);
my ($fp) = $self->method_lookup('open-ils.ingest.fingerprint.xml')->run($r->marc);
- $log->debug("Returning [$fp] as fingerprint for record $rec", INFO);
+ $log->debug("Returning [$fp] as fingerprint for record $rec");
$fp->{quality} = int($fp->{quality});
return $fp;
}
More information about the open-ils-commits
mailing list