bug 1372: count MARC records correctly
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
b549d7e1f1
commit
b88682f1bb
|
|
@ -266,6 +266,9 @@ sub BatchStageMarcRecords {
|
|||
# FIXME - for now, we're dealing only with bibs
|
||||
my $rec_num = 0;
|
||||
foreach my $marc_blob (split(/\x1D/, $marc_records)) {
|
||||
$marc_blob =~ s/^\s+//g;
|
||||
$marc_blob =~ s/\s+$//g;
|
||||
next unless $marc_blob;
|
||||
$rec_num++;
|
||||
if ($progress_interval and (0 == ($rec_num % $progress_interval))) {
|
||||
&$progress_callback($rec_num);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ sub process_batch {
|
|||
$/ = "\035";
|
||||
my $num_input_records = 0;
|
||||
while (<IN>) {
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
next unless $_; # skip if record has only whitespace, as might occur
|
||||
# if file includes newlines between each MARC record
|
||||
$marc_records .= $_; # FIXME - this sort of string concatenation
|
||||
# is probably rather inefficient
|
||||
$num_input_records++;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ if ($completedJobID) {
|
|||
my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
|
||||
my $fh = $uploaded_file->fh();
|
||||
my $marcrecord='';
|
||||
$/ = "\035";
|
||||
while (<$fh>) {
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
$marcrecord.=$_;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue