Bug 12478: fix errors from rebase and new upstream version
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
c6d59cb756
commit
3949b628f4
|
|
@ -1,4 +1,4 @@
|
|||
package Koha::BiblioUtilsUtils;
|
||||
package Koha::BiblioUtils;
|
||||
|
||||
# This contains functions to do with managing biblio records.
|
||||
|
||||
|
|
@ -27,19 +27,21 @@ Koha::BiblioUtils - contains fundamental biblio-related functions
|
|||
|
||||
This contains functions for normal operations on biblio records.
|
||||
|
||||
Note: really, C4::BiblioUtils does the main functions, but the Koha namespace is
|
||||
Note: really, C4::Biblio does the main functions, but the Koha namespace is
|
||||
the new thing that should be used.
|
||||
|
||||
=cut
|
||||
|
||||
use C4::BiblioUtils; # EmbedItemsInMarcBiblio
|
||||
use C4::Biblio; # EmbedItemsInMarcBiblio
|
||||
use Koha::MetadataIterator;
|
||||
use Koha::Database;
|
||||
use Modern::Perl;
|
||||
|
||||
use Data::Dumper; # TODO remove
|
||||
|
||||
use base qw(Koha::MetadataRecord);
|
||||
|
||||
__PACKAGE__->mk_accessors(qw( record schema idnumber datatype ));
|
||||
__PACKAGE__->mk_accessors(qw( record schema id datatype ));
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ sub new {
|
|||
{
|
||||
'record' => $record,
|
||||
'schema' => lc C4::Context->preference("marcflavour"),
|
||||
'idnumber' => $biblionumber,
|
||||
'id' => $biblionumber,
|
||||
'datatype' => 'biblio',
|
||||
}
|
||||
);
|
||||
|
|
@ -115,10 +117,20 @@ sub get_all_biblios_iterator {
|
|||
$schema->resultset('Biblio')->search( {},
|
||||
{ columns => [qw/ biblionumber /] } );
|
||||
my $next_func = sub {
|
||||
my $row = $rs->next();
|
||||
return undef if !$row;
|
||||
my $marc = C4::Biblio::GetMarcBiblio( $row->biblionumber, 1 );
|
||||
return __PACKAGE__->new($marc, $row->biblionumber);
|
||||
# Warn and skip bad records, otherwise we break the loop
|
||||
while (1) {
|
||||
my $row = $rs->next();
|
||||
return undef if !$row;
|
||||
my $marc = C4::Biblio::GetMarcBiblio( $row->biblionumber, 1 );
|
||||
my $next = eval {
|
||||
__PACKAGE__->new($marc, $row->biblionumber);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Something went wrong reading record for biblio $row->biblionumber: $@\n";
|
||||
next;
|
||||
}
|
||||
return $next;
|
||||
}
|
||||
};
|
||||
return Koha::MetadataIterator->new($next_func);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ sub do_reindex {
|
|||
my $commit_count = $commit;
|
||||
my ( @id_buffer, @commit_buffer );
|
||||
while ( my $record = $next->() ) {
|
||||
my $id = $record->idnumber;
|
||||
my $id = $record->id;
|
||||
my $record = $record->record;
|
||||
_log( 1, "$id\n" );
|
||||
$count++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue