Lines 210-216
sub ModBiblioInBatch {
Link Here
|
210 |
=head2 BatchStageMarcRecords |
210 |
=head2 BatchStageMarcRecords |
211 |
|
211 |
|
212 |
($batch_id, $num_records, $num_items, @invalid_records) = |
212 |
($batch_id, $num_records, $num_items, @invalid_records) = |
213 |
BatchStageMarcRecords($marc_flavor, $marc_records, $file_name, |
213 |
BatchStageMarcRecords($encoding, $marc_records, $file_name, |
214 |
$comments, $branch_code, $parse_items, |
214 |
$comments, $branch_code, $parse_items, |
215 |
$leave_as_staging, |
215 |
$leave_as_staging, |
216 |
$progress_interval, $progress_callback); |
216 |
$progress_interval, $progress_callback); |
Lines 218-224
sub ModBiblioInBatch {
Link Here
|
218 |
=cut |
218 |
=cut |
219 |
|
219 |
|
220 |
sub BatchStageMarcRecords { |
220 |
sub BatchStageMarcRecords { |
221 |
my $marc_flavor = shift; |
221 |
my $encoding = shift; |
222 |
my $marc_records = shift; |
222 |
my $marc_records = shift; |
223 |
my $file_name = shift; |
223 |
my $file_name = shift; |
224 |
my $comments = shift; |
224 |
my $comments = shift; |
Lines 258-270
sub BatchStageMarcRecords {
Link Here
|
258 |
&$progress_callback($rec_num); |
258 |
&$progress_callback($rec_num); |
259 |
} |
259 |
} |
260 |
my ($marc_record, $charset_guessed, $char_errors) = |
260 |
my ($marc_record, $charset_guessed, $char_errors) = |
261 |
MarcToUTF8Record($marc_blob, C4::Context->preference("marcflavour")); |
261 |
MarcToUTF8Record($marc_blob, C4::Context->preference("marcflavour"), $encoding); |
|
|
262 |
|
263 |
$encoding = $charset_guessed unless $encoding; |
264 |
|
262 |
my $import_record_id; |
265 |
my $import_record_id; |
263 |
if (scalar($marc_record->fields()) == 0) { |
266 |
if (scalar($marc_record->fields()) == 0) { |
264 |
push @invalid_records, $marc_blob; |
267 |
push @invalid_records, $marc_blob; |
265 |
} else { |
268 |
} else { |
266 |
$num_valid++; |
269 |
$num_valid++; |
267 |
$import_record_id = AddBiblioToBatch($batch_id, $rec_num, $marc_record, $marc_flavor, int(rand(99999)), 0); |
270 |
$import_record_id = AddBiblioToBatch($batch_id, $rec_num, $marc_record, $encoding, int(rand(99999)), 0); |
268 |
if ($parse_items) { |
271 |
if ($parse_items) { |
269 |
my @import_items_ids = AddItemsToImportBiblio($batch_id, $import_record_id, $marc_record, 0); |
272 |
my @import_items_ids = AddItemsToImportBiblio($batch_id, $import_record_id, $marc_record, 0); |
270 |
$num_items += scalar(@import_items_ids); |
273 |
$num_items += scalar(@import_items_ids); |