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

(-)a/Koha/Schema/Result/Biblio.pm (-5 / +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
__PACKAGE__->belongs_to(
334
sub biblioitem {
335
    "biblioitem",
335
    my ( $self ) = @_;
336
    "Koha::Schema::Result::Biblioitem",
336
    my @biblioitems = $self->biblioitems;
337
    { "foreign.biblionumber" => "self.biblionumber" }
337
    return $biblioitems[0];
338
);
338
}
339
339
340
1;
340
1;
341
(-)a/Koha/Schema/Result/Item.pm (-11 / +5 lines)
Lines 612-628 __PACKAGE__->might_have( Link Here
612
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-19 06:29:02
612
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-19 06:29:02
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h6fPG62SifJ5T8QKPZNBBw
613
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h6fPG62SifJ5T8QKPZNBBw
614
614
615
__PACKAGE__->belongs_to(
615
sub biblioitem {
616
    "biblio",
616
    my ( $self ) = @_;
617
    "Koha::Schema::Result::Biblio",
617
    my @biblioitems = $self->biblioitemnumber;
618
    { "foreign.biblionumber" => "self.biblionumber" }
618
    return $biblioitems[0];
619
);
619
}
620
621
__PACKAGE__->belongs_to(
622
  "biblioitem",
623
  "Koha::Schema::Result::Biblioitem",
624
  { biblioitemnumber => "biblioitemnumber" },
625
);
626
620
627
sub effective_itemtype {
621
sub effective_itemtype {
628
    my ( $self ) = @_;
622
    my ( $self ) = @_;
(-)a/t/db_dependent/Items.t (-3 / +1 lines)
Lines 204-211 subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { Link Here
204
        }
204
        }
205
    );
205
    );
206
206
207
    my $biblioitem = $biblio->biblioitem();
207
    my ( $item ) = $biblio->biblioitem->items();
208
    my ( $item ) = $biblioitem->items();
209
208
210
    C4::Context->set_preference( 'item-level_itypes', 0 );
209
    C4::Context->set_preference( 'item-level_itypes', 0 );
211
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
210
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
212
- 

Return to bug 11518