View | Details | Raw Unified | Return to bug 11518
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-07-11 09:26:55
612
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-07-11 09:26:55
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rc89LTrsDtt8Y6yXVUdhMA
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rc89LTrsDtt8Y6yXVUdhMA
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 204-210 subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { Link Here
204
        }
204
        }
205
    );
205
    );
206
206
207
    my ( $item ) = $biblio->biblioitem->items();
207
    my @bi = $biblio->biblioitems();
208
    my ( $item ) = $bi[0]->items();
208
209
209
    C4::Context->set_preference( 'item-level_itypes', 0 );
210
    C4::Context->set_preference( 'item-level_itypes', 0 );
210
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
211
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
211
- 

Return to bug 11518