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( C4::Context->preference('marcflavour') );
223
            $biblioitem->{marcxml} = $record->as_xml_record( C4::Context->preference('marcflavour') );
224
        }
224
        }
(-)a/Koha/BiblioUtils.pm (-3 / +2 lines)
Lines 151-157 sub get_all_biblios_iterator { Link Here
151
            my $row = $rs->next();
151
            my $row = $rs->next();
152
            return if !$row;
152
            return if !$row;
153
            my $next = eval {
153
            my $next = eval {
154
                my $marc = $row->metadata->record({ embed_items => 1 });
154
                my $marc = $row->metadata_record( { embed_items => 1 } );
155
                $class->new($marc, $row->biblionumber);
155
                $class->new($marc, $row->biblionumber);
156
            };
156
            };
157
            if ($@) {
157
            if ($@) {
Lines 187-194 If set to true, item data is embedded in the record. Default is to not do this. Link Here
187
sub get_marc_biblio {
187
sub get_marc_biblio {
188
    my ($class, $bibnum, %options) = @_;
188
    my ($class, $bibnum, %options) = @_;
189
189
190
    my $record = Koha::Biblios->find($bibnum)
190
    my $record = Koha::Biblios->find($bibnum)->metadata_record( { $options{item_data} ? ( embed_items => 1 ) : () } );
191
      ->metadata->record( { $options{item_data} ? ( embed_items => 1 ) : () } );
192
    return $record;
191
    return $record;
193
}
192
}
194
193
(-)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 60-66 if ( $op eq "cud-send" && $email_add ) { Link Here
60
60
61
    foreach my $bib (@bibs) {
61
    foreach my $bib (@bibs) {
62
        my $biblio = Koha::Biblios->find($bib) or next;
62
        my $biblio = Koha::Biblios->find($bib) or next;
63
        $iso2709 .= $biblio->metadata->record->as_usmarc();
63
        $iso2709 .= $biblio->metadata_record()->as_usmarc();
64
    }
64
    }
65
65
66
    if ( !defined $iso2709 ) {
66
    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 (-3 / +2 lines)
Lines 90-99 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;
93
my $record = $biblio_object ? $biblio_object->metadata_record( { embed_items => 1 } ) : undef;
94
$record = $biblio_object->metadata->record({ embed_items => 1 }) if $biblio_object;
95
94
96
if ( not defined $record ) {
95
if ( !$record ) {
97
    # biblionumber invalid -> report and exit
96
    # biblionumber invalid -> report and exit
98
    $template->param( unknownbiblionumber => 1,
97
    $template->param( unknownbiblionumber => 1,
99
                biblionumber => $biblionumber
98
                biblionumber => $biblionumber
(-)a/catalogue/export.pl (-1 / +1 lines)
Lines 27-33 if ($op eq "export") { Link Here
27
            my $file_pre = "bib-";
27
            my $file_pre = "bib-";
28
28
29
            my $biblio = Koha::Biblios->find($biblionumber);
29
            my $biblio = Koha::Biblios->find($biblionumber);
30
            my $marc   = $biblio->metadata->record({ embed_items => 1 });
30
            my $marc   = $biblio->metadata_record( { embed_items => 1 } );
31
31
32
            my $metadata_extractor = $biblio->metadata_extractor;
32
            my $metadata_extractor = $biblio->metadata_extractor;
33
33
(-)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 697-703 sub get_raw_marc_record { Link Here
697
    if ($record_type eq 'biblio') {
697
    if ($record_type eq 'biblio') {
698
        eval {
698
        eval {
699
            my $biblio = Koha::Biblios->find($record_number);
699
            my $biblio = Koha::Biblios->find($record_number);
700
            $marc = $biblio->metadata->record({ embed_items => 1 });
700
            $marc = $biblio->metadata_record( { embed_items => 1 } );
701
        };
701
        };
702
        if ($@ || !$marc) {
702
        if ($@ || !$marc) {
703
            # here we do warn since catching an exception
703
            # 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 70-79 if ($userenv) { Link Here
70
my $include_items = ($format =~ /bibtex/) ? 0 : 1;
70
my $include_items = ($format =~ /bibtex/) ? 0 : 1;
71
my $biblio = Koha::Biblios->find($biblionumber);
71
my $biblio = Koha::Biblios->find($biblionumber);
72
my $marc = $biblio
72
my $marc = $biblio
73
  ? $biblio->metadata->record(
73
  ? $biblio->metadata_record(
74
    {
74
    {
75
        embed_items => 1,
75
        embed_items => 1,
76
        opac        => 1,
76
        interface   => 'opac',
77
        patron      => $patron,
77
        patron      => $patron,
78
    }
78
    }
79
  )
79
  )
(-)a/opac/opac-sendbasket.pl (-1 / +1 lines)
Lines 54-60 if ( $op eq "cud-send" && $email_add && $user_email ) { Link Here
54
    foreach my $bib (@bibs) {
54
    foreach my $bib (@bibs) {
55
        $bib = int($bib);
55
        $bib = int($bib);
56
        my $biblio = Koha::Biblios->find($bib) or next;
56
        my $biblio = Koha::Biblios->find($bib) or next;
57
        $iso2709 .= $biblio->metadata->record->as_usmarc();
57
        $iso2709 .= $biblio->metadata_record( { interface => 'opac' } )->as_usmarc();
58
    }
58
    }
59
59
60
    if ( !defined $iso2709 ) {
60
    if ( !defined $iso2709 ) {
(-)a/opac/opac-sendshelf.pl (-1 / +1 lines)
Lines 71-77 if ( $shelf and $shelf->can_be_viewed($borrowernumber) ) { Link Here
71
        while ( my $content = $contents->next ) {
71
        while ( my $content = $contents->next ) {
72
            push @biblionumbers, $content->biblionumber;
72
            push @biblionumbers, $content->biblionumber;
73
            my $biblio = Koha::Biblios->find( $content->biblionumber );
73
            my $biblio = Koha::Biblios->find( $content->biblionumber );
74
            $iso2709 .= $biblio->metadata->record->as_usmarc();
74
            $iso2709 .= $biblio->metadata_record( { interface => 'opac' } )->as_usmarc();
75
        }
75
        }
76
76
77
        if ( !defined $iso2709 ) {
77
        if ( !defined $iso2709 ) {
(-)a/opac/opac-tags.pl (-2 / +2 lines)
Lines 254-263 if ($loggedinuser) { Link Here
254
    foreach my $tag (@$my_tags) {
254
    foreach my $tag (@$my_tags) {
255
        $tag->{visible} = 0;
255
        $tag->{visible} = 0;
256
        my $biblio = Koha::Biblios->find( $tag->{biblionumber} );
256
        my $biblio = Koha::Biblios->find( $tag->{biblionumber} );
257
        my $record = $biblio->metadata->record(
257
        my $record = $biblio->metadata_record(
258
            {
258
            {
259
                embed_items => 1,
259
                embed_items => 1,
260
                opac        => 1,
260
                interface   => 'opac',
261
                patron      => $patron,
261
                patron      => $patron,
262
            }
262
            }
263
        );
263
        );
(-)a/opac/opac-user.pl (-1 / +7 lines)
Lines 293-299 if ( $pending_checkouts->count ) { # Useless test Link Here
293
            || C4::Context->preference('SyndeticsEnabled')
293
            || C4::Context->preference('SyndeticsEnabled')
294
            || C4::Context->preference('SyndeticsCoverImages') )
294
            || C4::Context->preference('SyndeticsCoverImages') )
295
        {
295
        {
296
            my $marcrecord = $biblio_object->metadata->record( { embed_items => 1, opac => 1, patron => $patron, } );
296
            my $marcrecord = $biblio_object->metadata_record(
297
                {
298
                    embed_items => 1,
299
                    interface   => 'opac',
300
                    patron      => $patron
301
                }
302
            );
297
            $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
303
            $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
298
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
304
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
299
        }
305
        }
(-)a/svc/bib (-5 / +4 lines)
Lines 64-77 if ($query->request_method eq "GET") { Link Here
64
exit 0;
64
exit 0;
65
65
66
sub fetch_bib {
66
sub fetch_bib {
67
    my $query = shift;
67
    my ( $query, $biblionumber ) = @_;
68
    my $biblionumber = shift;
68
    my $biblio = Koha::Biblios->find($biblionumber);
69
    my $biblio = Koha::Biblios->find( $biblionumber );
70
    my $record;
69
    my $record;
71
    my $exception;
70
    my $exception;
72
    my $invalid_metadata = 0;
71
    my $invalid_metadata = 0;
73
    if ( defined $biblio ) {
72
    if ( defined $biblio ) {
74
        eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) };
73
        eval { $record = $biblio->metadata_record( { embed_items => scalar $query->param('items') } ) };
75
        if ($@) {
74
        if ($@) {
76
            $exception = $@;
75
            $exception = $@;
77
            $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
125
127
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
126
        C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode );
128
        my $biblio = Koha::Biblios->find( $biblionumber );
127
        my $biblio = Koha::Biblios->find( $biblionumber );
129
        my $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') });
128
        my $new_record = $biblio->metadata_record( { embed_items => scalar $query->url_param('items') } );
130
129
131
        $result->{'status'} = "ok";
130
        $result->{'status'} = "ok";
132
        $result->{'biblionumber'} = $biblionumber;
131
        $result->{'biblionumber'} = $biblionumber;
(-)a/svc/new_bib (-2 / +2 lines)
Lines 87-94 sub add_bib { Link Here
87
            }
87
            }
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 70-76 if ( $to_address && $op eq 'cud-send' ) { 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()->as_usmarc();
74
    }
74
    }
75
75
76
    if ( !defined $iso2709 ) {
76
    if ( !defined $iso2709 ) {
77
- 

Return to bug 31224