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

(-)a/Koha/Schema/Result/Biblio.pm (-6 lines)
Lines 331-340 __PACKAGE__->many_to_many("sets", "oai_sets_biblios", "set"); Link Here
331
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
331
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
332
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0//8OGf7OteNnwT03g4QsA
332
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0//8OGf7OteNnwT03g4QsA
333
333
334
sub biblioitem {
335
    my ( $self ) = @_;
336
    my @biblioitems = $self->biblioitems;
337
    return $biblioitems[0];
338
}
339
340
1;
334
1;
(-)a/Koha/Schema/Result/Item.pm (-7 / +1 lines)
Lines 612-623 __PACKAGE__->might_have( Link Here
612
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-10-24 09:58:16
612
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-10-24 09:58:16
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2slVK/FjcRDiYLeufoOFQQ
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2slVK/FjcRDiYLeufoOFQQ
614
614
615
sub biblioitem {
616
    my ( $self ) = @_;
617
    my @biblioitems = $self->biblioitemnumber;
618
    return $biblioitems[0];
619
}
620
621
sub effective_itemtype {
615
sub effective_itemtype {
622
    my ( $self ) = @_;
616
    my ( $self ) = @_;
623
617
Lines 625-631 sub effective_itemtype { Link Here
625
    if ( $pref->value() ) {
619
    if ( $pref->value() ) {
626
        return $self->itype();
620
        return $self->itype();
627
    } else {
621
    } else {
628
        return $self->biblioitem()->itemtype();
622
        return $self->biblioitemnumber()->itemtype();
629
    }
623
    }
630
}
624
}
631
625
(-)a/t/db_dependent/Items.t (-2 / +2 lines)
Lines 215-221 subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { Link Here
215
        }
215
        }
216
    );
216
    );
217
217
218
    my ( $item ) = $biblio->biblioitem->items();
218
    my @bi = $biblio->biblioitems();
219
    my ( $item ) = $bi[0]->items();
219
220
220
    C4::Context->set_preference( 'item-level_itypes', 0 );
221
    C4::Context->set_preference( 'item-level_itypes', 0 );
221
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
222
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
222
- 

Return to bug 13713