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

(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 218-224 sub GetRecords { Link Here
218
218
219
        my $biblioitem = $biblio->biblioitem->unblessed;
219
        my $biblioitem = $biblio->biblioitem->unblessed;
220
220
221
        my $record = $biblio->metadata->record({ embed_items => 1 });
221
        my $record = $biblio->metadata_record({ embed_items => 1 });
222
        if ($record) {
222
        if ($record) {
223
            $biblioitem->{marcxml} = $record->as_xml_record();
223
            $biblioitem->{marcxml} = $record->as_xml_record();
224
        }
224
        }
(-)a/Koha/BiblioUtils.pm (-2 / +2 lines)
Lines 146-152 sub get_all_biblios_iterator { Link Here
146
            my $row = $rs->next();
146
            my $row = $rs->next();
147
            return if !$row;
147
            return if !$row;
148
            my $next = eval {
148
            my $next = eval {
149
                my $marc = $row->metadata->record({ embed_items => 1 });
149
                my $marc = $row->metadata_record({ embed_items => 1 });
150
                $class->new($marc, $row->biblionumber);
150
                $class->new($marc, $row->biblionumber);
151
            };
151
            };
152
            if ($@) {
152
            if ($@) {
Lines 183-189 sub get_marc_biblio { Link Here
183
    my ($class, $bibnum, %options) = @_;
183
    my ($class, $bibnum, %options) = @_;
184
184
185
    my $record = Koha::Biblios->find($bibnum)
185
    my $record = Koha::Biblios->find($bibnum)
186
      ->metadata->record( { $options{item_data} ? ( embed_items => 1 ) : () } );
186
      ->metadata_record( { $options{item_data} ? ( embed_items => 1 ) : () } );
187
    return $record;
187
    return $record;
188
}
188
}
189
189
(-)a/Koha/OAI/Server/Repository.pm (-1 / +8 lines)
Lines 185-191 sub get_biblio_marcxml { Link Here
185
185
186
    # Koha::Biblio::Metadata->record throws an exception on bad encoding,
186
    # Koha::Biblio::Metadata->record throws an exception on bad encoding,
187
    # we don't want OAI harvests to die, so we catch and warn, and try to clean the record
187
    # we don't want OAI harvests to die, so we catch and warn, and try to clean the record
188
    eval { $record = $biblio->metadata->record( { embed_items => $with_items, opac => 1 } ); };
188
    eval {
189
        $record = $biblio->metadata_record(
190
            {
191
                embed_items => $with_items,
192
                interface   => 'opac'
193
            }
194
        );
195
    };
189
    my $decoding_error;
196
    my $decoding_error;
190
    if ($@) {
197
    if ($@) {
191
        my $exception = $@;
198
        my $exception = $@;
(-)a/Koha/SearchEngine/Elasticsearch/Indexer.pm (-1 / +1 lines)
Lines 349-355 sub _get_record { Link Here
349
349
350
    if ( $self->index eq $Koha::SearchEngine::BIBLIOS_INDEX ) {
350
    if ( $self->index eq $Koha::SearchEngine::BIBLIOS_INDEX ) {
351
        my $biblio = Koha::Biblios->find($record_id);
351
        my $biblio = Koha::Biblios->find($record_id);
352
        $record = $biblio->metadata->record( { embed_items => 1 } )
352
        $record = $biblio->metadata_record( { embed_items => 1 } )
353
          if $biblio;
353
          if $biblio;
354
    } else {
354
    } else {
355
        $record = C4::AuthoritiesMarc::GetAuthority($record_id);
355
        $record = C4::AuthoritiesMarc::GetAuthority($record_id);
(-)a/basket/downloadcart.pl (-1 / +1 lines)
Lines 64-70 if ($bib_list && $format) { Link Here
64
        foreach my $biblionumber (@bibs) {
64
        foreach my $biblionumber (@bibs) {
65
65
66
            my $biblio = Koha::Biblios->find($biblionumber);
66
            my $biblio = Koha::Biblios->find($biblionumber);
67
            my $record = $biblio->metadata->record({ embed_items => 1 });
67
            my $record = $biblio->metadata_record({ embed_items => 1 });
68
            next unless $record;
68
            next unless $record;
69
69
70
            if ($format eq 'iso2709') {
70
            if ($format eq 'iso2709') {
(-)a/basket/sendbasket.pl (-1 / +1 lines)
Lines 67-73 if ($email_add) { Link Here
67
67
68
    foreach my $bib (@bibs) {
68
    foreach my $bib (@bibs) {
69
        my $biblio = Koha::Biblios->find($bib) or next;
69
        my $biblio = Koha::Biblios->find($bib) or next;
70
        $iso2709 .= $biblio->metadata->record->as_usmarc();
70
        $iso2709 .= $biblio->metadata_record()->as_usmarc();
71
    }
71
    }
72
72
73
    if ( !defined $iso2709 ) {
73
    if ( !defined $iso2709 ) {
(-)a/catalogue/ISBDdetail.pl (-11 / +2 lines)
Lines 76-83 unless ( $biblionumber && $biblio ) { Link Here
76
   exit;
76
   exit;
77
}
77
}
78
78
79
my $record = $biblio->metadata->record({ embed_items => 1 });
79
my $record =
80
80
  $biblio->metadata_record( { embed_items => 1, interface => 'intranet' } );
81
if ( not defined $record ) {
81
if ( not defined $record ) {
82
       # biblionumber invalid -> report and exit
82
       # biblionumber invalid -> report and exit
83
       $template->param( unknownbiblionumber => 1,
83
       $template->param( unknownbiblionumber => 1,
Lines 88-102 if ( not defined $record ) { Link Here
88
}
88
}
89
89
90
my $framework = $biblio->frameworkcode;
90
my $framework = $biblio->frameworkcode;
91
my $record_processor = Koha::RecordProcessor->new({
92
    filters => 'ViewPolicy',
93
    options => {
94
        interface => 'intranet',
95
        frameworkcode => $framework
96
    },
97
});
98
$record_processor->process($record);
99
100
my $res = GetISBDView({
91
my $res = GetISBDView({
101
    'record'    => $record,
92
    'record'    => $record,
102
    'template'  => 'intranet',
93
    'template'  => 'intranet',
(-)a/catalogue/MARCdetail.pl (-1 / +1 lines)
Lines 90-96 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
90
);
90
);
91
91
92
my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
92
my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
93
my $record = $biblio_object->metadata->record({ embed_items => 1 });
93
my $record = $biblio_object->metadata_record({ embed_items => 1 });
94
94
95
if ( not defined $record ) {
95
if ( not defined $record ) {
96
    # biblionumber invalid -> report and exit
96
    # biblionumber invalid -> report and exit
(-)a/catalogue/export.pl (-1 / +1 lines)
Lines 28-34 if ($op eq "export") { Link Here
28
            my $file_pre = "bib-";
28
            my $file_pre = "bib-";
29
29
30
            my $biblio = Koha::Biblios->find($biblionumber);
30
            my $biblio = Koha::Biblios->find($biblionumber);
31
            my $marc   = $biblio->metadata->record({ embed_items => 1 });
31
            my $marc   = $biblio->metadata_record({ embed_items => 1 });
32
32
33
            if( C4::Context->preference('DefaultSaveRecordFileID') eq 'controlnumber' ){
33
            if( C4::Context->preference('DefaultSaveRecordFileID') eq 'controlnumber' ){
34
                my $marcflavour = C4::Context->preference('marcflavour'); #FIXME This option is required but does not change control num behaviour
34
                my $marcflavour = C4::Context->preference('marcflavour'); #FIXME This option is required but does not change control num behaviour
(-)a/misc/batchRebuildItemsTables.pl (-1 / +1 lines)
Lines 74-80 while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow Link Here
74
    $count++;
74
    $count++;
75
    warn $count unless $count % 1000;
75
    warn $count unless $count % 1000;
76
    my $biblio = Koha::Biblios->find($biblionumber);
76
    my $biblio = Koha::Biblios->find($biblionumber);
77
    my $record = $biblio->metadata->record({ embed_items => 1 });
77
    my $record = $biblio->metadata_record({ embed_items => 1 });
78
78
79
    unless ($record) { push @errors, "bad record biblionumber $biblionumber"; next; }
79
    unless ($record) { push @errors, "bad record biblionumber $biblionumber"; next; }
80
80
(-)a/misc/migration_tools/rebuild_zebra.pl (-1 / +1 lines)
Lines 682-688 sub get_raw_marc_record { Link Here
682
    if ($record_type eq 'biblio') {
682
    if ($record_type eq 'biblio') {
683
        eval {
683
        eval {
684
            my $biblio = Koha::Biblios->find($record_number);
684
            my $biblio = Koha::Biblios->find($record_number);
685
            $marc = $biblio->metadata->record({ embed_items => 1 });
685
            $marc = $biblio->metadata_record({ embed_items => 1 });
686
        };
686
        };
687
        if ($@ || !$marc) {
687
        if ($@ || !$marc) {
688
            # here we do warn since catching an exception
688
            # here we do warn since catching an exception
(-)a/opac/opac-downloadcart.pl (-2 / +2 lines)
Lines 77-86 if ($bib_list && $format) { Link Here
77
        foreach my $biblionumber (@bibs) {
77
        foreach my $biblionumber (@bibs) {
78
78
79
            my $biblio = Koha::Biblios->find($biblionumber);
79
            my $biblio = Koha::Biblios->find($biblionumber);
80
            my $record = $biblio->metadata->record(
80
            my $record = $biblio->metadata_record(
81
                {
81
                {
82
                    embed_items => 1,
82
                    embed_items => 1,
83
                    opac        => 1,
83
                    interface   => 'opac',
84
                    patron      => $patron,
84
                    patron      => $patron,
85
                }
85
                }
86
            );
86
            );
(-)a/opac/opac-downloadshelf.pl (-2 / +2 lines)
Lines 90-99 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
90
                my $biblionumber = $content->biblionumber;
90
                my $biblionumber = $content->biblionumber;
91
91
92
                my $biblio = Koha::Biblios->find($biblionumber);
92
                my $biblio = Koha::Biblios->find($biblionumber);
93
                my $record = $biblio->metadata->record(
93
                my $record = $biblio->metadata_record(
94
                    {
94
                    {
95
                        embed_items => 1,
95
                        embed_items => 1,
96
                        opac        => 1,
96
                        interface   => 'opac',
97
                        patron      => $patron,
97
                        patron      => $patron,
98
                    }
98
                    }
99
                );
99
                );
(-)a/opac/opac-export.pl (-2 / +2 lines)
Lines 54-63 if ($userenv) { Link Here
54
my $include_items = ($format =~ /bibtex/) ? 0 : 1;
54
my $include_items = ($format =~ /bibtex/) ? 0 : 1;
55
my $biblio = Koha::Biblios->find($biblionumber);
55
my $biblio = Koha::Biblios->find($biblionumber);
56
my $marc = $biblio
56
my $marc = $biblio
57
  ? $biblio->metadata->record(
57
  ? $biblio->metadata_record(
58
    {
58
    {
59
        embed_items => 1,
59
        embed_items => 1,
60
        opac        => 1,
60
        interface   => 'opac',
61
        patron      => $patron,
61
        patron      => $patron,
62
    }
62
    }
63
  )
63
  )
(-)a/opac/opac-sendbasket.pl (-1 / +1 lines)
Lines 66-72 if ( $email_add ) { Link Here
66
    my $iso2709;
66
    my $iso2709;
67
    foreach my $bib (@bibs) {
67
    foreach my $bib (@bibs) {
68
        my $biblio = Koha::Biblios->find($bib) or next;
68
        my $biblio = Koha::Biblios->find($bib) or next;
69
        $iso2709 .= $biblio->metadata->record->as_usmarc();
69
        $iso2709 .= $biblio->metadata_record( { interface => 'opac' } )->as_usmarc();
70
    }
70
    }
71
71
72
    if ( !defined $iso2709 ) {
72
    if ( !defined $iso2709 ) {
(-)a/opac/opac-sendshelf.pl (-1 / +1 lines)
Lines 70-76 if ( $shelf and $shelf->can_be_viewed($borrowernumber) ) { Link Here
70
        while ( my $content = $contents->next ) {
70
        while ( my $content = $contents->next ) {
71
            push @biblionumbers, $content->biblionumber;
71
            push @biblionumbers, $content->biblionumber;
72
            my $biblio = Koha::Biblios->find( $content->biblionumber );
72
            my $biblio = Koha::Biblios->find( $content->biblionumber );
73
            $iso2709 .= $biblio->metadata->record->as_usmarc();
73
            $iso2709 .= $biblio->metadata_record( { interface => 'opac' } )->as_usmarc();
74
        }
74
        }
75
75
76
        if ( !defined $iso2709 ) {
76
        if ( !defined $iso2709 ) {
(-)a/opac/opac-tags.pl (-2 / +2 lines)
Lines 250-259 if ($loggedinuser) { Link Here
250
    foreach my $tag (@$my_tags) {
250
    foreach my $tag (@$my_tags) {
251
        $tag->{visible} = 0;
251
        $tag->{visible} = 0;
252
        my $biblio = Koha::Biblios->find( $tag->{biblionumber} );
252
        my $biblio = Koha::Biblios->find( $tag->{biblionumber} );
253
        my $record = $biblio->metadata->record(
253
        my $record = $biblio->metadata_record(
254
            {
254
            {
255
                embed_items => 1,
255
                embed_items => 1,
256
                opac        => 1,
256
                interface   => 'opac',
257
                patron      => $patron,
257
                patron      => $patron,
258
            }
258
            }
259
        );
259
        );
(-)a/opac/opac-user.pl (-1 / +7 lines)
Lines 301-307 if ( $pending_checkouts->count ) { # Useless test Link Here
301
            || C4::Context->preference('SyndeticsEnabled')
301
            || C4::Context->preference('SyndeticsEnabled')
302
            || C4::Context->preference('SyndeticsCoverImages') )
302
            || C4::Context->preference('SyndeticsCoverImages') )
303
        {
303
        {
304
            my $marcrecord = $biblio_object->metadata->record( { embed_items => 1, opac => 1, patron => $patron, } );
304
            my $marcrecord = $biblio_object->metadata_record(
305
                {
306
                    embed_items => 1,
307
                    interface   => 'opac',
308
                    patron      => $patron
309
                }
310
            );
305
            $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
311
            $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
306
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
312
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
307
        }
313
        }
(-)a/svc/bib (-2 / +2 lines)
Lines 70-76 sub fetch_bib { Link Here
70
    my $record;
70
    my $record;
71
    my $exception;
71
    my $exception;
72
    my $invalid_metadata = 0;
72
    my $invalid_metadata = 0;
73
    eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) };
73
    eval { $record = $biblio->metadata_record( { embed_items => scalar $query->param('items') } ) };
74
    if ($@) {
74
    if ($@) {
75
        $exception = $@;
75
        $exception = $@;
76
        $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
76
        $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
Lines 126-132 sub update_bib { Link Here
126
126
127
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
127
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
128
        my $biblio = Koha::Biblios->find( $biblionumber );
128
        my $biblio = Koha::Biblios->find( $biblionumber );
129
        my $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') });
129
        my $new_record = $biblio->metadata_record({ embed_items => scalar $query->url_param('items') });
130
130
131
        $result->{'status'} = "ok";
131
        $result->{'status'} = "ok";
132
        $result->{'biblionumber'} = $biblionumber;
132
        $result->{'biblionumber'} = $biblionumber;
(-)a/svc/new_bib (-1 / +1 lines)
Lines 88-94 sub add_bib { Link Here
88
        }
88
        }
89
89
90
        $biblio = Koha::Biblios->find( $biblionumber );
90
        $biblio = Koha::Biblios->find( $biblionumber );
91
        $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') });
91
        $new_record = $biblio->metadata_record({ embed_items => scalar $query->url_param('items') });
92
        $result->{'status'} = "ok";
92
        $result->{'status'} = "ok";
93
        $result->{'biblionumber'} = $biblionumber;
93
        $result->{'biblionumber'} = $biblionumber;
94
        my $xml = $new_record->as_xml_record();
94
        my $xml = $new_record->as_xml_record();
(-)a/tools/showdiffmarc.pl (-1 / +1 lines)
Lines 62-68 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
62
62
63
if ( $type eq 'biblio' ) {
63
if ( $type eq 'biblio' ) {
64
    my $biblio = Koha::Biblios->find( $recordid );
64
    my $biblio = Koha::Biblios->find( $recordid );
65
    $record = $biblio->metadata->record({ embed_items => 1 });
65
    $record = $biblio->metadata_record({ embed_items => 1 });
66
    $recordTitle = $biblio->title;
66
    $recordTitle = $biblio->title;
67
}
67
}
68
elsif ( $type eq 'auth' ) {
68
elsif ( $type eq 'auth' ) {
(-)a/virtualshelves/downloadshelf.pl (-1 / +1 lines)
Lines 69-75 if ($shelfid && $format) { Link Here
69
                while ( my $content = $contents->next ) {
69
                while ( my $content = $contents->next ) {
70
                    my $biblionumber = $content->biblionumber;
70
                    my $biblionumber = $content->biblionumber;
71
                    my $biblio = Koha::Biblios->find($biblionumber);
71
                    my $biblio = Koha::Biblios->find($biblionumber);
72
                    my $record = $biblio->metadata->record({ embed_items => 1 });
72
                    my $record = $biblio->metadata_record({ embed_items => 1 });
73
                    if ($format eq 'iso2709') {
73
                    if ($format eq 'iso2709') {
74
                        $output .= $record->as_usmarc();
74
                        $output .= $record->as_usmarc();
75
                    }
75
                    }
(-)a/virtualshelves/sendshelf.pl (-2 / +1 lines)
Lines 69-75 if ($to_address) { Link Here
69
    while ( my $content = $contents->next ) {
69
    while ( my $content = $contents->next ) {
70
        push @biblionumbers, $content->biblionumber;
70
        push @biblionumbers, $content->biblionumber;
71
        my $biblio = Koha::Biblios->find( $content->biblionumber );
71
        my $biblio = Koha::Biblios->find( $content->biblionumber );
72
        $iso2709 .= $biblio->metadata->record->as_usmarc();
72
        $iso2709 .= $biblio->metadata_record()->as_usmarc();
73
    }
73
    }
74
74
75
    if ( !defined $iso2709 ) {
75
    if ( !defined $iso2709 ) {
76
- 

Return to bug 31224