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

(-)a/Koha/Biblio.pm (-6 / +4 lines)
Lines 427-435 sub host_items { Link Here
427
        $analyticfield = '461';
427
        $analyticfield = '461';
428
    }
428
    }
429
429
430
    my $record;
430
    my $record = eval { $self->metadata->record };
431
    $record = eval { $self->metadata->record; };
431
    unless ( $record ) { warn $@ ; return }
432
    return if !$record;
433
432
434
    my @itemnumbers;
433
    my @itemnumbers;
435
    foreach my $field ( $record->field($analyticfield) ) {
434
    foreach my $field ( $record->field($analyticfield) ) {
Lines 568-576 sub get_components_query { Link Here
568
    my $builder = Koha::SearchEngine::QueryBuilder->new(
567
    my $builder = Koha::SearchEngine::QueryBuilder->new(
569
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
568
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
570
569
571
    my $record;
570
    my $record = eval { $self->metadata->record };
572
    eval { $record = $self->metadata->record };
571
    unless ( $record ) { warn $@ ; return }
573
    return if !$record;
574
572
575
    my $searchstr;
573
    my $searchstr;
576
    if ( C4::Context->preference('UseControlNumber') ) {
574
    if ( C4::Context->preference('UseControlNumber') ) {
(-)a/t/db_dependent/Koha/Biblio.t (-3 / +5 lines)
Lines 565-571 subtest 'get_marc_components() tests' => sub { Link Here
565
};
565
};
566
566
567
subtest 'get_components_query' => sub {
567
subtest 'get_components_query' => sub {
568
    plan tests => 4;
568
    plan tests => 5;
569
569
570
    my $biblio = $builder->build_sample_biblio();
570
    my $biblio = $builder->build_sample_biblio();
571
    my $biblionumber = $biblio->biblionumber;
571
    my $biblionumber = $biblio->biblionumber;
Lines 592-598 subtest 'get_components_query' => sub { Link Here
592
    $biblio->metadata->metadata('This is invalid for a MARC record')->store();
592
    $biblio->metadata->metadata('This is invalid for a MARC record')->store();
593
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
593
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
594
594
595
    is($biblio->get_components_query, undef, "Invalid MARC record returns undefined and does not die");
595
    my $components_query;
596
    warning_like { $biblio->get_components_query }
597
        qr{^Invalid data, cannot decode metadata object};
598
    is( $components_query, undef, "Invalid MARC record returns undefined and does not die");
596
};
599
};
597
600
598
subtest 'orders() and active_orders() tests' => sub {
601
subtest 'orders() and active_orders() tests' => sub {
599
- 

Return to bug 29690