Lines 195-202
sub GetImportRecordMarc {
Link Here
|
195 |
sub GetRecordFromImportBiblio { |
195 |
sub GetRecordFromImportBiblio { |
196 |
my ( $import_record_id, $embed_items ) = @_; |
196 |
my ( $import_record_id, $embed_items ) = @_; |
197 |
|
197 |
|
198 |
my ($marc) = GetImportRecordMarc($import_record_id); |
198 |
my ($xml, $encoding) = GetImportRecordMarcXML($import_record_id); |
199 |
my $record = MARC::Record->new_from_usmarc($marc); |
199 |
my $marcflavour = C4::Context->preference('marcflavour'); |
|
|
200 |
my $format = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : 'USMARC'; |
201 |
my $record = MARC::Record->new_from_xml($xml, $encoding, $format); |
200 |
|
202 |
|
201 |
EmbedItemsInImportBiblio( $record, $import_record_id ) if $embed_items; |
203 |
EmbedItemsInImportBiblio( $record, $import_record_id ) if $embed_items; |
202 |
|
204 |
|
Lines 223-229
sub EmbedItemsInImportBiblio {
Link Here
|
223 |
|
225 |
|
224 |
=head2 GetImportRecordMarcXML |
226 |
=head2 GetImportRecordMarcXML |
225 |
|
227 |
|
226 |
my $marcxml = GetImportRecordMarcXML($import_record_id); |
228 |
my ($marcxml, $encoding) = GetImportRecordMarcXML($import_record_id); |
227 |
|
229 |
|
228 |
=cut |
230 |
=cut |
229 |
|
231 |
|
Lines 231-242
sub GetImportRecordMarcXML {
Link Here
|
231 |
my ($import_record_id) = @_; |
233 |
my ($import_record_id) = @_; |
232 |
|
234 |
|
233 |
my $dbh = C4::Context->dbh; |
235 |
my $dbh = C4::Context->dbh; |
234 |
my $sth = $dbh->prepare("SELECT marcxml FROM import_records WHERE import_record_id = ?"); |
236 |
my ( $marc, $encoding ) = $dbh->selectrow_array(q| |
235 |
$sth->execute($import_record_id); |
237 |
SELECT marcxml, encoding |
236 |
my ($marcxml) = $sth->fetchrow(); |
238 |
FROM import_records |
237 |
$sth->finish(); |
239 |
WHERE import_record_id = ? |
238 |
return $marcxml; |
240 |
|, undef, $import_record_id ); |
239 |
|
241 |
|
|
|
242 |
return $marc, $encoding; |
240 |
} |
243 |
} |
241 |
|
244 |
|
242 |
=head2 AddImportBatch |
245 |
=head2 AddImportBatch |