Lines 25-30
use C4::Koha;
Link Here
|
25 |
use C4::Charset; |
25 |
use C4::Charset; |
26 |
use MARC::File::USMARC; |
26 |
use MARC::File::USMARC; |
27 |
use C4::ImportBatch; |
27 |
use C4::ImportBatch; |
|
|
28 |
use List::MoreUtils qw(uniq); |
28 |
|
29 |
|
29 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
30 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
30 |
|
31 |
|
Lines 71-77
C4::Breeding : module to add biblios to import_records via
Link Here
|
71 |
=cut |
72 |
=cut |
72 |
|
73 |
|
73 |
sub ImportBreeding { |
74 |
sub ImportBreeding { |
74 |
my ($marcrecords,$overwrite_biblio,$filename,$encoding,$z3950random,$batch_type) = @_; |
75 |
my ( $marcrecords, $overwrite_biblio, $filename, $encoding, $z3950random, $batch_type, $update_counts ) = @_; |
75 |
my @marcarray = split /\x1D/, $marcrecords; |
76 |
my @marcarray = split /\x1D/, $marcrecords; |
76 |
|
77 |
|
77 |
my $dbh = C4::Context->dbh; |
78 |
my $dbh = C4::Context->dbh; |
Lines 140-146
sub ImportBreeding {
Link Here
|
140 |
if ($breedingid && $overwrite_biblio eq '1') { |
141 |
if ($breedingid && $overwrite_biblio eq '1') { |
141 |
ModBiblioInBatch($breedingid, $marcrecord); |
142 |
ModBiblioInBatch($breedingid, $marcrecord); |
142 |
} else { |
143 |
} else { |
143 |
my $import_id = AddBiblioToBatch($batch_id, $imported, $marcrecord, $encoding, $z3950random); |
144 |
my $import_id = AddBiblioToBatch($batch_id, $imported, $marcrecord, $encoding, $z3950random, $update_counts); |
144 |
$breedingid = $import_id; |
145 |
$breedingid = $import_id; |
145 |
} |
146 |
} |
146 |
$imported++; |
147 |
$imported++; |
Lines 148-154
sub ImportBreeding {
Link Here
|
148 |
} |
149 |
} |
149 |
} |
150 |
} |
150 |
} |
151 |
} |
151 |
return ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$breedingid); |
152 |
return ( $notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid, $batch_id ); |
152 |
} |
153 |
} |
153 |
|
154 |
|
154 |
|
155 |
|
Lines 341-346
sub Z3950Search {
Link Here
|
341 |
$oResult[$z] = $oConnection[$z]->search_pqf($query); |
342 |
$oResult[$z] = $oConnection[$z]->search_pqf($query); |
342 |
} |
343 |
} |
343 |
|
344 |
|
|
|
345 |
my @batch_id; |
344 |
while ( $nremaining-- ) { |
346 |
while ( $nremaining-- ) { |
345 |
my $k; |
347 |
my $k; |
346 |
my $event; |
348 |
my $event; |
Lines 382-388
sub Z3950Search {
Link Here
|
382 |
# pad | and ( with spaces to allow line breaks in the HTML |
384 |
# pad | and ( with spaces to allow line breaks in the HTML |
383 |
$oldbiblio->{issn} =~ s/\|/ \| /g if $oldbiblio->{issn}; |
385 |
$oldbiblio->{issn} =~ s/\|/ \| /g if $oldbiblio->{issn}; |
384 |
$oldbiblio->{issn} =~ s/\(/ \(/g if $oldbiblio->{issn}; |
386 |
$oldbiblio->{issn} =~ s/\(/ \(/g if $oldbiblio->{issn}; |
385 |
my ($notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid)= ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' ); |
387 |
|
|
|
388 |
my ( $notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid, $batch_id ) = |
389 |
ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950', 0 ); |
390 |
|
391 |
# Delay the updating of batch record counts until the very end |
392 |
push( @batch_id, $batch_id ); |
393 |
|
386 |
my %row_data; |
394 |
my %row_data; |
387 |
$row_data{server} = $servername[$k]; |
395 |
$row_data{server} = $servername[$k]; |
388 |
$row_data{isbn} = $oldbiblio->{isbn}; |
396 |
$row_data{isbn} = $oldbiblio->{isbn}; |
Lines 403-408
sub Z3950Search {
Link Here
|
403 |
} |
411 |
} |
404 |
} # if $k !=0 |
412 |
} # if $k !=0 |
405 |
|
413 |
|
|
|
414 |
# Process the delayed batch record count updates |
415 |
my @batch_id = uniq( @batch_id ); |
416 |
foreach my $id ( @batch_id ) { |
417 |
UpdateBatchRecordCounts( $id ); |
418 |
} |
419 |
|
406 |
$template->param( |
420 |
$template->param( |
407 |
numberpending => $nremaining, |
421 |
numberpending => $nremaining, |
408 |
current_page => $page, |
422 |
current_page => $page, |