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

(-)a/C4/Biblio.pm (-19 / +105 lines)
Lines 76-81 BEGIN { Link Here
76
      &GetMarcISSN
76
      &GetMarcISSN
77
      &GetMarcSubjects
77
      &GetMarcSubjects
78
      &GetMarcBiblio
78
      &GetMarcBiblio
79
      &GetMarcBiblioForOpac
79
      &GetMarcAuthors
80
      &GetMarcAuthors
80
      &GetMarcSeries
81
      &GetMarcSeries
81
      &GetMarcHosts
82
      &GetMarcHosts
Lines 137-142 BEGIN { Link Here
137
      &TransformHtmlToMarc
138
      &TransformHtmlToMarc
138
      &TransformHtmlToXml
139
      &TransformHtmlToXml
139
      prepare_host_field
140
      prepare_host_field
141
      &RemoveHiddenSubfields
140
    );
142
    );
141
}
143
}
142
144
Lines 899-914 sub GetBiblioFromItemNumber { Link Here
899
901
900
=head2 GetISBDView 
902
=head2 GetISBDView 
901
903
902
  $isbd = &GetISBDView($biblionumber);
904
  $isbd = &GetISBDView($biblionumber, [$template]);
903
905
904
Return the ISBD view which can be included in opac and intranet
906
Returns the ISBD view which can be included in opac and intranet.
907
908
C<$template> - 'opac' or 'intranet', default 'intranet'
905
909
906
=cut
910
=cut
907
911
908
sub GetISBDView {
912
sub GetISBDView {
909
    my ( $biblionumber, $template ) = @_;
913
    my $biblionumber = shift;
910
    my $record   = GetMarcBiblio($biblionumber, 1);
914
    my $template = shift || 'intranet';
915
916
    my $record = ($template eq 'opac') ? GetMarcBiblioForOpac($biblionumber, 1) : GetMarcBiblio($biblionumber, 1);
911
    return unless defined $record;
917
    return unless defined $record;
918
912
    my $itemtype = &GetFrameworkCode($biblionumber);
919
    my $itemtype = &GetFrameworkCode($biblionumber);
913
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
920
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
914
    my $tagslib = &GetMarcStructure( 1, $itemtype );
921
    my $tagslib = &GetMarcStructure( 1, $itemtype );
Lines 1239-1276 sub GetMarcSubfieldStructureFromKohaField { Link Here
1239
1246
1240
=head2 GetMarcBiblio
1247
=head2 GetMarcBiblio
1241
1248
1242
  my $record = GetMarcBiblio($biblionumber, [$embeditems]);
1249
  my $record = GetMarcBiblio($biblionumber, [$embeditems], [$template], [$withouthidden]);
1250
1251
Returns MARC::Record representing bib. If no bib exists, returns undef.
1252
1253
C<$biblionumber> - the biblionumber of the biblio
1243
1254
1244
Returns MARC::Record representing bib identified by
1255
C<$embeditems> - if set to true items data are included, default false
1245
C<$biblionumber>.  If no bib exists, returns undef.
1256
1246
C<$embeditems>.  If set to true, items data are included.
1257
C<$template> - 'opac' or 'intranet', default 'intranet'
1247
The MARC record contains biblio data, and items data if $embeditems is set to true.
1258
1259
C<$withouthidden> - if set to true hidden subfields are not included, default false
1248
1260
1249
=cut
1261
=cut
1250
1262
1251
sub GetMarcBiblio {
1263
sub GetMarcBiblio {
1252
    my $biblionumber = shift;
1264
    my $biblionumber = shift;
1253
    my $embeditems   = shift || 0;
1265
    my $embeditems   = shift || 0;
1266
    my $template      = shift || 'intranet';
1267
    my $withouthidden = shift || 0;
1268
1254
    my $dbh          = C4::Context->dbh;
1269
    my $dbh          = C4::Context->dbh;
1255
    my $sth          = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1270
    my $sth          = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
1256
    $sth->execute($biblionumber);
1271
    $sth->execute($biblionumber);
1257
    my $row     = $sth->fetchrow_hashref;
1272
    my $row     = $sth->fetchrow_hashref;
1258
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1273
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1274
    return unless $marcxml;
1275
1259
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1276
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1260
    my $record = MARC::Record->new();
1277
    my $record = MARC::Record->new();
1278
    $record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour') ) };
1279
    if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1280
    return unless $record;
1261
1281
1262
    if ($marcxml) {
1282
    C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $biblionumber);
1263
        $record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour') ) };
1283
    C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
1264
        if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1265
        return unless $record;
1266
1267
        C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $biblionumber);
1268
	C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
1269
1284
1270
        return $record;
1285
    if ($withouthidden) {
1271
    } else {
1286
        my $frameworkcode = GetFrameworkCode( $biblionumber );
1272
        return;
1287
        RemoveHiddenSubfields($record, $frameworkcode, $template);
1273
    }
1288
    }
1289
1290
    return $record;
1291
}
1292
1293
=head2 GetMarcBiblioForOpac
1294
1295
  my $record = GetMarcBiblioForOpac($biblionumber, [$embeditems]);
1296
1297
Returns MARC::Record representing bib. If no bib exists, returns undef.
1298
The record does not contain subfields hidden at OPAC.
1299
1300
C<$biblionumber> - the biblionumber of the biblio
1301
1302
C<$embeditems> - if set to true items data are included, default false
1303
1304
=cut
1305
1306
sub GetMarcBiblioForOpac {
1307
    my $biblionumber = shift;
1308
    my $embeditems   = shift || 0;
1309
    return GetMarcBiblio($biblionumber, $embeditems, 'opac', 1);
1274
}
1310
}
1275
1311
1276
=head2 GetXmlBiblio
1312
=head2 GetXmlBiblio
Lines 3659-3664 sub RemoveAllNsb { Link Here
3659
    return $record;
3695
    return $record;
3660
}
3696
}
3661
3697
3698
=head2 RemoveHiddenSubfields
3699
3700
  RemoveHiddenSubfields( $record, [$frameworkcode], [$template] );
3701
3702
  Removes from record all subfields marked as hidden.
3703
3704
=cut
3705
3706
sub RemoveHiddenSubfields {
3707
    my $record        = shift;
3708
    my $frameworkcode = shift || '';
3709
    my $template      = shift || 'intranet';
3710
3711
    my $tagslib = GetMarcStructure( 1, $frameworkcode );
3712
3713
    foreach my $tag ( keys %$tagslib ) {
3714
        my @fields = $record->field($tag);
3715
        next unless @fields;
3716
3717
        my @subfields_to_remove;
3718
        foreach my $subfield ( keys %{ $tagslib->{$tag} } ) {
3719
            # skip tag infos
3720
            next unless ( ref( $tagslib->{$tag}->{$subfield} ) eq "HASH" );
3721
            if ( $template eq 'opac' ) {
3722
                push @subfields_to_remove, $subfield
3723
                  if $tagslib->{$tag}->{$subfield}->{'hidden'} > 0;
3724
            }
3725
            else {
3726
                push @subfields_to_remove, $subfield
3727
                  if $tagslib->{$tag}->{$subfield}->{'hidden'} =~
3728
                      /-7|-4|-3|-2|2|3|5|8/;
3729
            }
3730
        }
3731
        if ( @subfields_to_remove ) {
3732
            foreach my $field (@fields) {
3733
                if ( $tag < 10 ) {
3734
                    # control field so delete entire field
3735
                    $record->delete_field($field);
3736
                }
3737
                else {
3738
                    $field->delete_subfield( code => \@subfields_to_remove );
3739
                    # delete field if no subfield anymore
3740
                    $record->delete_field($field)
3741
                      unless ( $field->subfields() );
3742
                }
3743
            }
3744
        }
3745
    }
3746
}
3747
3662
1;
3748
1;
3663
3749
3664
3750
(-)a/C4/Record.pm (-21 / +35 lines)
Lines 358-364 sub marc2endnote { Link Here
358
358
359
=head2 marc2csv - Convert several records from UNIMARC to CSV
359
=head2 marc2csv - Convert several records from UNIMARC to CSV
360
360
361
  my ($csv) = marc2csv($biblios, $csvprofileid, $itemnumbers);
361
  my ($csv) = marc2csv($biblios, $csvprofileid, [$itemnumbers], [$template]);
362
362
363
Pre and postprocessing can be done through a YAML file
363
Pre and postprocessing can be done through a YAML file
364
364
Lines 370-382 C<$csvprofileid> - the id of the CSV profile to use for the export (see export_f Link Here
370
370
371
C<$itemnumbers> - a list of itemnumbers to export
371
C<$itemnumbers> - a list of itemnumbers to export
372
372
373
C<$template> - 'opac' or 'intranet', default 'intranet'
374
373
=cut
375
=cut
374
376
375
sub marc2csv {
377
sub marc2csv {
376
    my ($biblios, $id, $itemnumbers) = @_;
378
    my ($biblios, $id, $itemnumbers, $template) = @_;
379
    $template ||= 'intranet';
377
    my $output;
380
    my $output;
378
    my $csv = Text::CSV::Encoded->new();
381
    my $csv = Text::CSV::Encoded->new();
379
382
383
    # Getting information about the csv profile
384
    my $profile = GetCsvProfile($id);
385
    return unless $profile;
386
380
    # Getting yaml file
387
    # Getting yaml file
381
    my $configfile = "../tools/csv-profiles/$id.yaml";
388
    my $configfile = "../tools/csv-profiles/$id.yaml";
382
    my ($preprocess, $postprocess, $fieldprocessing);
389
    my ($preprocess, $postprocess, $fieldprocessing);
Lines 390-402 sub marc2csv { Link Here
390
    my $firstpass = 1;
397
    my $firstpass = 1;
391
    if ( $itemnumbers ) {
398
    if ( $itemnumbers ) {
392
        for my $itemnumber ( @$itemnumbers) {
399
        for my $itemnumber ( @$itemnumbers) {
400
393
            my $biblionumber = GetBiblionumberFromItemnumber $itemnumber;
401
            my $biblionumber = GetBiblionumberFromItemnumber $itemnumber;
394
            $output .= marcrecord2csv( $biblionumber, $id, $firstpass, $csv, $fieldprocessing, [$itemnumber] );
402
            next unless $biblionumber;
403
404
            my $record = ($template eq 'opac') ? GetMarcBiblioForOpac($biblionumber) : GetMarcBiblio($biblionumber);
405
            next unless $record;
406
            C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, $itemnumbers );
407
408
            my $frameworkcode = GetFrameworkCode($biblionumber);
409
410
            $output .= _marcrecord2csv( $record, $frameworkcode, $profile, $firstpass, $csv, $fieldprocessing, [$itemnumber] );
395
            $firstpass = 0;
411
            $firstpass = 0;
396
        }
412
        }
397
    } else {
413
    } else {
398
        foreach my $biblio (@$biblios) {
414
        foreach my $biblio (@$biblios) {
399
            $output .= marcrecord2csv( $biblio, $id, $firstpass, $csv, $fieldprocessing );
415
416
            my $record = ($template eq 'opac') ? GetMarcBiblioForOpac($biblio) : GetMarcBiblio($biblio);
417
            next unless $record;
418
419
            my $frameworkcode = GetFrameworkCode($biblio);
420
421
            $output .= _marcrecord2csv( $record, $frameworkcode, $profile, $firstpass, $csv, $fieldprocessing );
400
            $firstpass = 0;
422
            $firstpass = 0;
401
        }
423
        }
402
    }
424
    }
Lines 407-421 sub marc2csv { Link Here
407
    return $output;
429
    return $output;
408
}
430
}
409
431
410
=head2 marcrecord2csv - Convert a single record from UNIMARC to CSV
432
=head2 _marcrecord2csv - Convert a single record from UNIMARC to CSV
411
433
412
  my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header);
434
  my ($csv) = _marcrecord2csv($biblio, $csvprofileid, $header);
413
435
414
Returns a CSV scalar
436
Returns a CSV scalar
415
437
416
C<$biblio> - a biblionumber
438
C<$record> - a bib MARC::Record
417
439
418
C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv)
440
C<$frameworkcode> - framework code of record
441
442
C<$csvprofile> - the CSV profile to use for the export
419
443
420
C<$header> - true if the headers are to be printed (typically at first pass)
444
C<$header> - true if the headers are to be printed (typically at first pass)
421
445
Lines 423-447 C<$csv> - an already initialised Text::CSV object Link Here
423
447
424
C<$fieldprocessing>
448
C<$fieldprocessing>
425
449
426
C<$itemnumbers> a list of itemnumbers to export
450
C<$itemnumbers> a list of item numbers to export
427
451
428
=cut
452
=cut
429
453
430
454
431
sub marcrecord2csv {
455
sub _marcrecord2csv {
432
    my ($biblio, $id, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
456
    my ($record, $frameworkcode, $profile, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
433
    my $output;
457
    my $output;
434
458
435
    # Getting the record
436
    my $record = GetMarcBiblio($biblio);
437
    next unless $record;
438
    C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblio, $itemnumbers );
439
    # Getting the framework
440
    my $frameworkcode = GetFrameworkCode($biblio);
441
442
    # Getting information about the csv profile
443
    my $profile = GetCsvProfile($id);
444
445
    # Getting output encoding
459
    # Getting output encoding
446
    my $encoding          = $profile->{encoding} || 'utf8';
460
    my $encoding          = $profile->{encoding} || 'utf8';
447
    # Getting separators
461
    # Getting separators
(-)a/C4/Search.pm (+1 lines)
Lines 1704-1709 sub searchResults { Link Here
1704
             : $bibliotag < 10
1704
             : $bibliotag < 10
1705
               ? GetFrameworkCode($marcrecord->field($bibliotag)->data)
1705
               ? GetFrameworkCode($marcrecord->field($bibliotag)->data)
1706
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1706
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1707
        RemoveHiddenSubfields($marcrecord, $fw, $search_context) if ($search_context eq 'opac');
1707
        my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, $fw );
1708
        my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, $fw );
1708
        $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw);
1709
        $oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw);
1709
        $oldbiblio->{result_number} = $i + 1;
1710
        $oldbiblio->{result_number} = $i + 1;
(-)a/opac/opac-ISBDdetail.pl (-1 / +1 lines)
Lines 84-90 $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHo Link Here
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
85
85
86
my $marcflavour      = C4::Context->preference("marcflavour");
86
my $marcflavour      = C4::Context->preference("marcflavour");
87
my $record = GetMarcBiblio($biblionumber);
87
my $record = GetMarcBiblioForOpac($biblionumber);
88
if ( ! $record ) {
88
if ( ! $record ) {
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
90
    exit;
90
    exit;
(-)a/opac/opac-MARCdetail.pl (-6 / +2 lines)
Lines 62-68 my $itemtype = &GetFrameworkCode($biblionumber); Link Here
62
my $tagslib      = &GetMarcStructure( 0, $itemtype );
62
my $tagslib      = &GetMarcStructure( 0, $itemtype );
63
my $biblio = GetBiblioData($biblionumber);
63
my $biblio = GetBiblioData($biblionumber);
64
$biblionumber = $biblio->{biblionumber};
64
$biblionumber = $biblio->{biblionumber};
65
my $record = GetMarcBiblio($biblionumber, 1);
65
my $record = GetMarcBiblioForOpac($biblionumber, 1);
66
if ( ! $record ) {
66
if ( ! $record ) {
67
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
67
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
68
    exit;
68
    exit;
Lines 114-121 for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) { Link Here
114
    my @subfields_data;
114
    my @subfields_data;
115
115
116
    # deal with leader
116
    # deal with leader
117
    unless ( $tagslib->{'000'}->{'@'}->{tab} ne $tabloop
117
    unless ( $tagslib->{'000'}->{'@'}->{tab} ne $tabloop )
118
        or $tagslib->{'000'}->{'@'}->{hidden} > 0 )
119
    {
118
    {
120
        my %subfield_data;
119
        my %subfield_data;
121
        $subfield_data{marc_lib}      = $tagslib->{'000'}->{'@'}->{lib};
120
        $subfield_data{marc_lib}      = $tagslib->{'000'}->{'@'}->{lib};
Lines 138-144 for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) { Link Here
138
            next
137
            next
139
              if (
138
              if (
140
                $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{tab} ne $tabloop );
139
                $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{tab} ne $tabloop );
141
            next if ( $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{hidden} > 0 );
142
            my %subfield_data;
140
            my %subfield_data;
143
            $subfield_data{marc_lib} =
141
            $subfield_data{marc_lib} =
144
              $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{lib};
142
              $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{lib};
Lines 155-161 for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) { Link Here
155
                $subf[$i][0] = "@" unless defined($subf[$i][0]);
153
                $subf[$i][0] = "@" unless defined($subf[$i][0]);
156
                my $sf_def = $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] };
154
                my $sf_def = $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] };
157
                next if ( ($sf_def->{tab}||0) != $tabloop );
155
                next if ( ($sf_def->{tab}||0) != $tabloop );
158
                next if ( ($sf_def->{hidden}||0) > 0 );
159
                my %subfield_data;
156
                my %subfield_data;
160
                $subfield_data{marc_lib} = ($sf_def->{lib} eq $previous) ?  '--' : $sf_def->{lib};
157
                $subfield_data{marc_lib} = ($sf_def->{lib} eq $previous) ?  '--' : $sf_def->{lib};
161
                $previous = $sf_def->{lib};
158
                $previous = $sf_def->{lib};
Lines 228-234 foreach my $field (@fields) { Link Here
228
    for my $i ( 0 .. $#subf ) {
225
    for my $i ( 0 .. $#subf ) {
229
        my $sf_def = $tagslib->{ $field->tag() }->{ $subf[$i][0] };
226
        my $sf_def = $tagslib->{ $field->tag() }->{ $subf[$i][0] };
230
        next if ( ($sf_def->{tab}||0) != 10 );
227
        next if ( ($sf_def->{tab}||0) != 10 );
231
        next if ( ($sf_def->{hidden}||0) > 0 );
232
        $witness{ $subf[$i][0] } = $sf_def->{lib};
228
        $witness{ $subf[$i][0] } = $sf_def->{lib};
233
229
234
        if ( $sf_def->{isurl} ) {
230
        if ( $sf_def->{isurl} ) {
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 63-69 foreach my $biblionumber ( @bibs ) { Link Here
63
    $template->param( biblionumber => $biblionumber );
63
    $template->param( biblionumber => $biblionumber );
64
64
65
    my $dat              = &GetBiblioData($biblionumber);
65
    my $dat              = &GetBiblioData($biblionumber);
66
    my $record           = &GetMarcBiblio($biblionumber);
66
    my $record           = &GetMarcBiblioForOpac($biblionumber);
67
    next unless $record;
67
    next unless $record;
68
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
68
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 84-90 if (scalar @itemsmatchingbiblionumber >= 1) { Link Here
84
    }
84
    }
85
}
85
}
86
86
87
my $record       = GetMarcBiblio($biblionumber);
87
my $record       = GetMarcBiblioForOpac($biblionumber);
88
if ( ! $record ) {
88
if ( ! $record ) {
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
90
    exit;
90
    exit;
(-)a/opac/opac-downloadcart.pl (-2 / +2 lines)
Lines 58-70 if ($bib_list && $format) { Link Here
58
    # CSV   
58
    # CSV   
59
    if ($format =~ /^\d+$/) {
59
    if ($format =~ /^\d+$/) {
60
60
61
        $output = marc2csv(\@bibs, $format);
61
        $output = marc2csv(\@bibs, $format, undef, 'opac');
62
62
63
        # Other formats
63
        # Other formats
64
    } else {
64
    } else {
65
        foreach my $biblio (@bibs) {
65
        foreach my $biblio (@bibs) {
66
66
67
            my $record = GetMarcBiblio($biblio, 1);
67
            my $record = GetMarcBiblioForOpac($biblio, 1);
68
            next unless $record;
68
            next unless $record;
69
69
70
            if ($format eq 'iso2709') {
70
            if ($format eq 'iso2709') {
(-)a/opac/opac-downloadshelf.pl (-2 / +2 lines)
Lines 62-75 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh Link Here
62
            foreach (@$items) {
62
            foreach (@$items) {
63
                push @biblios, $_->{biblionumber};
63
                push @biblios, $_->{biblionumber};
64
            }
64
            }
65
            $output = marc2csv(\@biblios, $format);
65
            $output = marc2csv(\@biblios, $format, undef, 'opac');
66
                
66
                
67
        # Other formats
67
        # Other formats
68
        } else {
68
        } else {
69
            foreach my $biblio (@$items) {
69
            foreach my $biblio (@$items) {
70
                my $biblionumber = $biblio->{biblionumber};
70
                my $biblionumber = $biblio->{biblionumber};
71
71
72
                my $record = GetMarcBiblio($biblionumber, 1);
72
                my $record = GetMarcBiblioForOpac($biblionumber, 1);
73
                next unless $record;
73
                next unless $record;
74
74
75
                if ($format eq 'iso2709') {
75
                if ($format eq 'iso2709') {
(-)a/opac/opac-export.pl (-2 / +2 lines)
Lines 35-41 my $biblionumber = $query->param("bib")||0; Link Here
35
$biblionumber = int($biblionumber);
35
$biblionumber = int($biblionumber);
36
my ($marc, $error)= ('','');
36
my ($marc, $error)= ('','');
37
37
38
$marc = GetMarcBiblio($biblionumber, 1) if $biblionumber;
38
$marc = GetMarcBiblioForOpac($biblionumber, 1) if $biblionumber;
39
if(!$marc) {
39
if(!$marc) {
40
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
40
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
41
    exit;
41
    exit;
Lines 57-63 elsif ($format =~ /ris/) { Link Here
57
    $format = 'ris';
57
    $format = 'ris';
58
}
58
}
59
elsif ($format =~ /bibtex/) {
59
elsif ($format =~ /bibtex/) {
60
    $marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber);
60
    $marc = marc2bibtex(C4::Biblio::GetMarcBiblioForOpac($biblionumber),$biblionumber);
61
    $format = 'bibtex';
61
    $format = 'bibtex';
62
}
62
}
63
elsif ($format =~ /dc/) {
63
elsif ($format =~ /dc/) {
(-)a/opac/opac-reserve.pl (-3 / +5 lines)
Lines 130-136 foreach my $biblioNumber (@biblionumbers) { Link Here
130
130
131
    my @itemInfos = GetItemsInfo($biblioNumber);
131
    my @itemInfos = GetItemsInfo($biblioNumber);
132
132
133
    my $marcrecord= GetMarcBiblio($biblioNumber);
133
    my $marcrecord= GetMarcBiblioForOpac($biblioNumber);
134
135
    # subtitle
136
    $biblioData->{subtitle} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($biblioNumber));
134
137
135
    # flag indicating existence of at least one item linked via a host record
138
    # flag indicating existence of at least one item linked via a host record
136
    my $hostitemsflag;
139
    my $hostitemsflag;
Lines 355-361 $template->param('item_level_itypes' => $itemLevelTypes); Link Here
355
358
356
foreach my $biblioNum (@biblionumbers) {
359
foreach my $biblioNum (@biblionumbers) {
357
360
358
    my $record = GetMarcBiblio($biblioNum);
359
    # Init the bib item with the choices for branch pickup
361
    # Init the bib item with the choices for branch pickup
360
    my %biblioLoopIter = ( branchloop => $branchloop );
362
    my %biblioLoopIter = ( branchloop => $branchloop );
361
363
Lines 368-374 foreach my $biblioNum (@biblionumbers) { Link Here
368
370
369
    $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
371
    $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
370
    $biblioLoopIter{title} = $biblioData->{title};
372
    $biblioLoopIter{title} = $biblioData->{title};
371
    $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($biblioData->{biblionumber}));
373
    $biblioLoopIter{subtitle} = $biblioData->{subtitle};
372
    $biblioLoopIter{author} = $biblioData->{author};
374
    $biblioLoopIter{author} = $biblioData->{author};
373
    $biblioLoopIter{rank} = $biblioData->{rank};
375
    $biblioLoopIter{rank} = $biblioData->{rank};
374
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
376
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 568-574 for (my $i=0;$i<@servers;$i++) { Link Here
568
            }
568
            }
569
569
570
            if (C4::Context->preference('COinSinOPACResults')) {
570
            if (C4::Context->preference('COinSinOPACResults')) {
571
                my $record = GetMarcBiblio($res->{'biblionumber'});
571
                my $record = GetMarcBiblioForOpac($_->{'biblionumber'});
572
                $res->{coins} = GetCOinSBiblio($record);
572
                $res->{coins} = GetCOinSBiblio($record);
573
            }
573
            }
574
            if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) {
574
            if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) {
(-)a/opac/opac-sendbasket.pl (-1 / +1 lines)
Lines 87-93 if ( $email_add ) { Link Here
87
        $template2->param( biblionumber => $biblionumber );
87
        $template2->param( biblionumber => $biblionumber );
88
88
89
        my $dat              = GetBiblioData($biblionumber);
89
        my $dat              = GetBiblioData($biblionumber);
90
        my $record           = GetMarcBiblio($biblionumber);
90
        my $record           = GetMarcBiblioForOpac($biblionumber);
91
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
91
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
92
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
92
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
93
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
93
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
(-)a/opac/opac-sendshelf.pl (-1 / +1 lines)
Lines 83-89 if ( $email ) { Link Here
83
        my $biblionumber = $biblio->{biblionumber};
83
        my $biblionumber = $biblio->{biblionumber};
84
        my $fw               = GetFrameworkCode($biblionumber);
84
        my $fw               = GetFrameworkCode($biblionumber);
85
        my $dat              = GetBiblioData($biblionumber);
85
        my $dat              = GetBiblioData($biblionumber);
86
        my $record           = GetMarcBiblio($biblionumber);
86
        my $record           = GetMarcBiblioForOpac($biblionumber);
87
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
87
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
88
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
88
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
89
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
89
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
(-)a/opac/opac-showmarc.pl (-2 / +3 lines)
Lines 52-62 if ($importid) { Link Here
52
    $record = MARC::Record->new_from_usmarc($marc);
52
    $record = MARC::Record->new_from_usmarc($marc);
53
}
53
}
54
else {
54
else {
55
    $record =GetMarcBiblio($biblionumber);
55
    $record = GetMarcBiblioForOpac($biblionumber);
56
}
56
}
57
57
58
if ($view eq 'card' || $view eq 'html') {
58
if ($view eq 'card' || $view eq 'html') {
59
    my $xmlrecord= $importid? $record->as_xml(): GetXmlBiblio($biblionumber);
59
    my $xmlrecord= $record->as_xml();
60
60
    my $xslfile;
61
    my $xslfile;
61
    my $xslfilename;
62
    my $xslfilename;
62
    my $htdocs  = C4::Context->config('opachtdocs');
63
    my $htdocs  = C4::Context->config('opachtdocs');
(-)a/opac/opac-showreviews.pl (-2 / +1 lines)
Lines 84-90 my $latest_comment_date; Link Here
84
for my $result (@$reviews){
84
for my $result (@$reviews){
85
    my $biblionumber = $result->{biblionumber};
85
    my $biblionumber = $result->{biblionumber};
86
	my $bib = &GetBiblioData($biblionumber);
86
	my $bib = &GetBiblioData($biblionumber);
87
    my $record = GetMarcBiblio($biblionumber);
87
    my $record = GetMarcBiblioForOpac($biblionumber);
88
    my $frameworkcode = GetFrameworkCode($biblionumber);
88
    my $frameworkcode = GetFrameworkCode($biblionumber);
89
	my ( $borr ) = GetMemberDetails( $result->{borrowernumber} );
89
	my ( $borr ) = GetMemberDetails( $result->{borrowernumber} );
90
	$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
90
	$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
91
- 

Return to bug 7933