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

(-)a/Koha/Biblio.pm (-22 / +5 lines)
Lines 112-126 sub get_all_biblios_iterator { Link Here
112
    my $database = Koha::Database->new();
112
    my $database = Koha::Database->new();
113
    my $schema   = $database->schema();
113
    my $schema   = $database->schema();
114
    my $rs =
114
    my $rs =
115
      $schema->resultset('Biblioitem')->search( { marc => { '!=', undef } },
115
      $schema->resultset('Biblio')->search( {},
116
        { columns => [qw/ biblionumber marc /] } );
116
        { columns => [qw/ biblionumber /] } );
117
    my $next_func = sub {
117
    my $next_func = sub {
118
        my $row = $rs->next();
118
        my $row = $rs->next();
119
        return undef if !$row;
119
        return undef if !$row;
120
        my $marc = MARC::Record->new_from_usmarc( $row->marc );
120
        my $marc = C4::Biblio::GetMarcBiblio( $row->biblionumber, 1 );
121
        my $bibnum = $row->get_column('biblionumber');
121
        return __PACKAGE__->new($marc, $row->biblionumber);
122
        C4::Biblio::EmbedItemsInMarcBiblio( $marc, $bibnum );
123
        return __PACKAGE__->new($marc, $bibnum);
124
    };
122
    };
125
    return Koha::MetadataIterator->new($next_func);
123
    return Koha::MetadataIterator->new($next_func);
126
}
124
}
Lines 148-168 If set to true, item data is embedded in the record. Default is to not do this. Link Here
148
sub get_marc_biblio {
146
sub get_marc_biblio {
149
    my ($class, $bibnum, %options) = @_;
147
    my ($class, $bibnum, %options) = @_;
150
148
151
    my $database = Koha::Database->new();
149
    return C4::Biblio::GetMarcBiblio( $bibnum, ($options{item_data} ? 1 : 0 ) );
152
    my $schema   = $database->schema();
153
    my $rs =
154
      $schema->resultset('Biblioitem')
155
      ->search( { marc => { '!=', undef }, biblionumber => $bibnum },
156
        { columns => [qw/ marc /] } );
157
158
    my $row = $rs->next();
159
    return unless $row;
160
    my $marc = MARC::Record->new_from_usmarc($row->marc);
161
162
    # TODO implement this in this module
163
    C4::Biblio::EmbedItemsInMarcBiblio($marc, $bibnum) if $options{item_data};
164
165
    return $marc;
166
}
150
}
167
151
168
1;
152
1;
169
- 

Return to bug 12478