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 339-345
sub export_marc_records_from_sth {
Link Here
|
339 |
} |
339 |
} |
340 |
} |
340 |
} |
341 |
if ( $marcxml ) { |
341 |
if ( $marcxml ) { |
342 |
print OUT $marcxml if $marcxml; |
342 |
print {$fh} $marcxml if $marcxml; |
343 |
$num_exported++; |
343 |
$num_exported++; |
344 |
} |
344 |
} |
345 |
next; |
345 |
next; |
Lines 352-358
sub export_marc_records_from_sth {
Link Here
|
352 |
# to care, though, at least if you're using the GRS-1 filter. It does |
352 |
# to care, though, at least if you're using the GRS-1 filter. It does |
353 |
# care if you're using the DOM filter, which requires valid XML file(s). |
353 |
# care if you're using the DOM filter, which requires valid XML file(s). |
354 |
eval { |
354 |
eval { |
355 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
355 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
356 |
$num_exported++; |
356 |
$num_exported++; |
357 |
}; |
357 |
}; |
358 |
if ($@) { |
358 |
if ($@) { |
Lines 361-367
sub export_marc_records_from_sth {
Link Here
|
361 |
} |
361 |
} |
362 |
} |
362 |
} |
363 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
363 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
364 |
close OUT; |
364 |
close $fh; |
365 |
return $num_exported; |
365 |
return $num_exported; |
366 |
} |
366 |
} |
367 |
|
367 |
|
Lines 369-375
sub export_marc_records_from_list {
Link Here
|
369 |
my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_; |
369 |
my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_; |
370 |
|
370 |
|
371 |
my $num_exported = 0; |
371 |
my $num_exported = 0; |
372 |
open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; |
372 |
open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; |
373 |
my $i = 0; |
373 |
my $i = 0; |
374 |
|
374 |
|
375 |
# Skip any deleted records. We check for this anyway, but this reduces error spam |
375 |
# Skip any deleted records. We check for this anyway, but this reduces error spam |
Lines 386-397
sub export_marc_records_from_list {
Link Here
|
386 |
# strung together with no single root element. zebraidx doesn't seem |
386 |
# strung together with no single root element. zebraidx doesn't seem |
387 |
# to care, though, at least if you're using the GRS-1 filter. It does |
387 |
# to care, though, at least if you're using the GRS-1 filter. It does |
388 |
# care if you're using the DOM filter, which requires valid XML file(s). |
388 |
# care if you're using the DOM filter, which requires valid XML file(s). |
389 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
389 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
390 |
$num_exported++; |
390 |
$num_exported++; |
391 |
} |
391 |
} |
392 |
} |
392 |
} |
393 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
393 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
394 |
close OUT; |
394 |
close $fh; |
395 |
return $num_exported; |
395 |
return $num_exported; |
396 |
} |
396 |
} |
397 |
|
397 |
|
Lines 399-405
sub generate_deleted_marc_records {
Link Here
|
399 |
my ($record_type, $entries, $directory, $as_xml) = @_; |
399 |
my ($record_type, $entries, $directory, $as_xml) = @_; |
400 |
|
400 |
|
401 |
my $records_deleted = {}; |
401 |
my $records_deleted = {}; |
402 |
open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; |
402 |
open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; |
403 |
my $i = 0; |
403 |
my $i = 0; |
404 |
foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) { |
404 |
foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) { |
405 |
print "\r$i" unless ($i++ %100 or !$verbose_logging); |
405 |
print "\r$i" unless ($i++ %100 or !$verbose_logging); |
Lines 415-426
sub generate_deleted_marc_records {
Link Here
|
415 |
fix_unimarc_100($marc); |
415 |
fix_unimarc_100($marc); |
416 |
} |
416 |
} |
417 |
|
417 |
|
418 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); |
418 |
print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); |
419 |
|
419 |
|
420 |
$records_deleted->{$record_number} = 1; |
420 |
$records_deleted->{$record_number} = 1; |
421 |
} |
421 |
} |
422 |
print "\nRecords exported: $i\n" if ( $verbose_logging ); |
422 |
print "\nRecords exported: $i\n" if ( $verbose_logging ); |
423 |
close OUT; |
423 |
close $fh; |
424 |
return $records_deleted; |
424 |
return $records_deleted; |
425 |
|
425 |
|
426 |
|
426 |
|
Lines 830-837
if ($authorities) {
Link Here
|
830 |
# AUTHORITIES : copying mandatory files |
830 |
# AUTHORITIES : copying mandatory files |
831 |
# |
831 |
# |
832 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
832 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
833 |
open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config}; |
833 |
open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config}; |
834 |
print ZD " |
834 |
print {$zd} " |
835 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
835 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
836 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
836 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
837 |
|
837 |
|
Lines 975-982
if ($biblios) {
Link Here
|
975 |
# BIBLIOS : copying mandatory files |
975 |
# BIBLIOS : copying mandatory files |
976 |
# |
976 |
# |
977 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
977 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
978 |
open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config}; |
978 |
open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config}; |
979 |
print ZD " |
979 |
print {$zd} " |
980 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
980 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
981 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
981 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
982 |
|
982 |
|