Lines 309-315
sub export_marc_records_from_sth {
Link Here
|
309 |
my ($record_type, $sth, $directory, $as_xml, $noxml, $nosanitize) = @_; |
309 |
my ($record_type, $sth, $directory, $as_xml, $noxml, $nosanitize) = @_; |
310 |
|
310 |
|
311 |
my $num_exported = 0; |
311 |
my $num_exported = 0; |
312 |
open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; |
312 |
open my $fh, '>:encoding(UTF-8) ', "$directory/exported_records" or die $!; |
313 |
my $i = 0; |
313 |
my $i = 0; |
314 |
my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",''); |
314 |
my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",''); |
315 |
while (my ($record_number) = $sth->fetchrow_array) { |
315 |
while (my ($record_number) = $sth->fetchrow_array) { |
Lines 337-343
sub export_marc_records_from_sth {
Link Here
|
337 |
} |
337 |
} |
338 |
} |
338 |
} |
339 |
if ( $marcxml ) { |
339 |
if ( $marcxml ) { |
340 |
print OUT $marcxml if $marcxml; |
340 |
print {$fh} $marcxml if $marcxml; |
341 |
$num_exported++; |
341 |
$num_exported++; |
342 |
} |
342 |
} |
343 |
next; |
343 |
next; |
Lines 350-356
sub export_marc_records_from_sth {
Link Here
|
350 |
# to care, though, at least if you're using the GRS-1 filter. It does |
350 |
# to care, though, at least if you're using the GRS-1 filter. It does |
351 |
# care if you're using the DOM filter, which requires valid XML file(s). |
351 |
# care if you're using the DOM filter, which requires valid XML file(s). |
352 |
eval { |
352 |
eval { |
353 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
353 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
354 |
$num_exported++; |
354 |
$num_exported++; |
355 |
}; |
355 |
}; |
356 |
if ($@) { |
356 |
if ($@) { |
Lines 359-365
sub export_marc_records_from_sth {
Link Here
|
359 |
} |
359 |
} |
360 |
} |
360 |
} |
361 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
361 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
362 |
close OUT; |
362 |
close $fh; |
363 |
return $num_exported; |
363 |
return $num_exported; |
364 |
} |
364 |
} |
365 |
|
365 |
|
Lines 367-373
sub export_marc_records_from_list {
Link Here
|
367 |
my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_; |
367 |
my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_; |
368 |
|
368 |
|
369 |
my $num_exported = 0; |
369 |
my $num_exported = 0; |
370 |
open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; |
370 |
open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; |
371 |
my $i = 0; |
371 |
my $i = 0; |
372 |
|
372 |
|
373 |
# Skip any deleted records. We check for this anyway, but this reduces error spam |
373 |
# Skip any deleted records. We check for this anyway, but this reduces error spam |
Lines 384-395
sub export_marc_records_from_list {
Link Here
|
384 |
# strung together with no single root element. zebraidx doesn't seem |
384 |
# strung together with no single root element. zebraidx doesn't seem |
385 |
# to care, though, at least if you're using the GRS-1 filter. It does |
385 |
# to care, though, at least if you're using the GRS-1 filter. It does |
386 |
# care if you're using the DOM filter, which requires valid XML file(s). |
386 |
# care if you're using the DOM filter, which requires valid XML file(s). |
387 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
387 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
388 |
$num_exported++; |
388 |
$num_exported++; |
389 |
} |
389 |
} |
390 |
} |
390 |
} |
391 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
391 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
392 |
close OUT; |
392 |
close $fh; |
393 |
return $num_exported; |
393 |
return $num_exported; |
394 |
} |
394 |
} |
395 |
|
395 |
|
Lines 397-403
sub generate_deleted_marc_records {
Link Here
|
397 |
my ($record_type, $entries, $directory, $as_xml) = @_; |
397 |
my ($record_type, $entries, $directory, $as_xml) = @_; |
398 |
|
398 |
|
399 |
my $records_deleted = {}; |
399 |
my $records_deleted = {}; |
400 |
open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; |
400 |
open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; |
401 |
my $i = 0; |
401 |
my $i = 0; |
402 |
foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) { |
402 |
foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) { |
403 |
print "\r$i" unless ($i++ %100 or !$verbose_logging); |
403 |
print "\r$i" unless ($i++ %100 or !$verbose_logging); |
Lines 413-424
sub generate_deleted_marc_records {
Link Here
|
413 |
fix_unimarc_100($marc); |
413 |
fix_unimarc_100($marc); |
414 |
} |
414 |
} |
415 |
|
415 |
|
416 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); |
416 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); |
417 |
|
417 |
|
418 |
$records_deleted->{$record_number} = 1; |
418 |
$records_deleted->{$record_number} = 1; |
419 |
} |
419 |
} |
420 |
print "\nRecords exported: $i\n" if ( $verbose_logging ); |
420 |
print "\nRecords exported: $i\n" if ( $verbose_logging ); |
421 |
close OUT; |
421 |
close $fh; |
422 |
return $records_deleted; |
422 |
return $records_deleted; |
423 |
|
423 |
|
424 |
|
424 |
|
Lines 824-831
if ($authorities) {
Link Here
|
824 |
# AUTHORITIES : copying mandatory files |
824 |
# AUTHORITIES : copying mandatory files |
825 |
# |
825 |
# |
826 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
826 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
827 |
open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config}; |
827 |
open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config}; |
828 |
print ZD " |
828 |
print {$zd} " |
829 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
829 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
830 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
830 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
831 |
|
831 |
|
Lines 969-976
if ($biblios) {
Link Here
|
969 |
# BIBLIOS : copying mandatory files |
969 |
# BIBLIOS : copying mandatory files |
970 |
# |
970 |
# |
971 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
971 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
972 |
open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config}; |
972 |
open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config}; |
973 |
print ZD " |
973 |
print {$zd} " |
974 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
974 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
975 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
975 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
976 |
|
976 |
|