Lines 35-40
my ( $input_marc_file, $number, $offset) = ('',0,0);
Link Here
|
35 |
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile); |
35 |
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile); |
36 |
my $cleanisbn = 1; |
36 |
my $cleanisbn = 1; |
37 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
37 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
|
|
38 |
my $framework = ''; |
38 |
|
39 |
|
39 |
$|=1; |
40 |
$|=1; |
40 |
|
41 |
|
Lines 62-67
GetOptions(
Link Here
|
62 |
'idmap:s' => \$idmapfl, |
63 |
'idmap:s' => \$idmapfl, |
63 |
'cleanisbn!' => \$cleanisbn, |
64 |
'cleanisbn!' => \$cleanisbn, |
64 |
'dedupbarcode' => \$dedup_barcode, |
65 |
'dedupbarcode' => \$dedup_barcode, |
|
|
66 |
'framework=s' => \$framework, |
65 |
); |
67 |
); |
66 |
$biblios=!$authorities||$biblios; |
68 |
$biblios=!$authorities||$biblios; |
67 |
|
69 |
|
Lines 154-160
if ($authorities){
Link Here
|
154 |
} |
156 |
} |
155 |
else { |
157 |
else { |
156 |
( $tagid, $subfieldid ) = |
158 |
( $tagid, $subfieldid ) = |
157 |
GetMarcFromKohaField( "biblio.biblionumber", '' ); |
159 |
GetMarcFromKohaField( "biblio.biblionumber", $framework ); |
158 |
$tagid||="001"; |
160 |
$tagid||="001"; |
159 |
} |
161 |
} |
160 |
|
162 |
|
Lines 308-314
RECORD: while ( ) {
Link Here
|
308 |
} |
310 |
} |
309 |
else |
311 |
else |
310 |
{ |
312 |
{ |
311 |
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio($record, '', { defer_marc_save => 1 }) }; |
313 |
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio($record, $framework, { defer_marc_save => 1 }) }; |
312 |
} |
314 |
} |
313 |
if ( $@ ) { |
315 |
if ( $@ ) { |
314 |
warn "ERROR: Adding biblio $biblionumber failed: $@\n"; |
316 |
warn "ERROR: Adding biblio $biblionumber failed: $@\n"; |
Lines 326-332
RECORD: while ( ) {
Link Here
|
326 |
C4::Biblio::_strip_item_fields($clone_record, ''); |
328 |
C4::Biblio::_strip_item_fields($clone_record, ''); |
327 |
# This sets the marc fields if there was an error, and also calls |
329 |
# This sets the marc fields if there was an error, and also calls |
328 |
# defer_marc_save. |
330 |
# defer_marc_save. |
329 |
ModBiblioMarc( $clone_record, $biblionumber, '' ); |
331 |
ModBiblioMarc( $clone_record, $biblionumber, $framework ); |
330 |
if ( $error_adding ) { |
332 |
if ( $error_adding ) { |
331 |
warn "ERROR: Adding items to bib $biblionumber failed: $error_adding"; |
333 |
warn "ERROR: Adding items to bib $biblionumber failed: $error_adding"; |
332 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
334 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
Lines 339-345
RECORD: while ( ) {
Link Here
|
339 |
} |
341 |
} |
340 |
if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) { |
342 |
if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) { |
341 |
# Find the record called 'barcode' |
343 |
# Find the record called 'barcode' |
342 |
my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode', ''); |
344 |
my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode', $framework); |
343 |
# Now remove any items that didn't have a duplicate_barcode error, |
345 |
# Now remove any items that didn't have a duplicate_barcode error, |
344 |
# erase the barcodes on items that did, and re-add those items. |
346 |
# erase the barcodes on items that did, and re-add those items. |
345 |
my %dupes; |
347 |
my %dupes; |
Lines 372-378
RECORD: while ( ) {
Link Here
|
372 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
374 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
373 |
# if we failed because of an exception, assume that |
375 |
# if we failed because of an exception, assume that |
374 |
# the MARC columns in biblioitems were not set. |
376 |
# the MARC columns in biblioitems were not set. |
375 |
ModBiblioMarc( $record, $biblionumber, '' ); |
377 |
ModBiblioMarc( $record, $biblionumber, $framework ); |
376 |
next RECORD; |
378 |
next RECORD; |
377 |
} else { |
379 |
} else { |
378 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insert",status=>"ok"}) if ($logfile); |
380 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insert",status=>"ok"}) if ($logfile); |
Lines 594-599
to add the record is retried, thereby giving the record a blank barcode. This
Link Here
|
594 |
is useful when something has set barcodes to be a biblio ID, or similar |
596 |
is useful when something has set barcodes to be a biblio ID, or similar |
595 |
(usually other software.) |
597 |
(usually other software.) |
596 |
|
598 |
|
|
|
599 |
=item B<-framework> |
600 |
|
601 |
This is the code for the framework that the requested records will have attached |
602 |
to them when they are created. If not specified, then the default framework |
603 |
will be used. |
604 |
|
597 |
=back |
605 |
=back |
598 |
|
606 |
|
599 |
=cut |
607 |
=cut |
600 |
- |
|
|