View | Details | Raw Unified | Return to bug 29333
Collapse All | Expand All

(-)a/C4/ImportBatch.pm (-8 / +11 lines)
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
(-)a/authorities/authorities.pl (-4 / +6 lines)
Lines 24-30 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth qw( get_template_and_user );
24
use C4::Auth qw( get_template_and_user );
25
use C4::Output qw( output_html_with_http_headers );
25
use C4::Output qw( output_html_with_http_headers );
26
use C4::AuthoritiesMarc qw( AddAuthority ModAuthority GetAuthority GetTagsLabels GetAuthMARCFromKohaField FindDuplicateAuthority );
26
use C4::AuthoritiesMarc qw( AddAuthority ModAuthority GetAuthority GetTagsLabels GetAuthMARCFromKohaField FindDuplicateAuthority );
27
use C4::ImportBatch qw( GetImportRecordMarc );
27
use C4::ImportBatch qw( GetImportRecordMarcXML );
28
use C4::Context;
28
use C4::Context;
29
use Date::Calc qw( Today );
29
use Date::Calc qw( Today );
30
use MARC::File::USMARC;
30
use MARC::File::USMARC;
Lines 51-59 builds list, depending on authorised value... Link Here
51
51
52
sub MARCfindbreeding_auth {
52
sub MARCfindbreeding_auth {
53
    my ( $id ) = @_;
53
    my ( $id ) = @_;
54
    my ($marc, $encoding) = GetImportRecordMarc($id);
54
    my ($xml, $encoding) = GetImportRecordMarcXML($id);
55
    if ($marc) {
55
    if ($xml) {
56
        my $record = MARC::Record->new_from_usmarc($marc);
56
        my $marcflavour = C4::Context->preference('marcflavour');
57
        my $format = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : 'USMARC';
58
        my $record = MARC::Record->new_from_xml($xml, $encoding, $format);
57
        if ( !defined(ref($record)) ) {
59
        if ( !defined(ref($record)) ) {
58
                return -1;
60
                return -1;
59
        } else {
61
        } else {
(-)a/catalogue/showmarc.pl (-2 / +3 lines)
Lines 61-67 if(!ref $record) { Link Here
61
}
61
}
62
62
63
if($view eq 'card' || $view eq 'html') {
63
if($view eq 'card' || $view eq 'html') {
64
    my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber);
64
    my $marcflavour = C4::Context->preference('marcflavour');
65
    my $format = $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : 'USMARC';
66
    my $xml = $importid ? $record->as_xml($format): GetXmlBiblio($biblionumber);
65
    my $xsl;
67
    my $xsl;
66
    if ( $view eq 'card' ){
68
    if ( $view eq 'card' ){
67
        $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC'
69
        $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC'
68
- 

Return to bug 29333