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

(-)a/Koha/Schema/Result/Biblio.pm (-5 / +5 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;
(-)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.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
__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 215-222 subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { Link Here
215
        }
215
        }
216
    );
216
    );
217
217
218
    my $biblioitem = $biblio->biblioitem();
218
    my ( $item ) = $biblio->biblioitem->items();
219
    my ( $item ) = $biblioitem->items();
220
219
221
    C4::Context->set_preference( 'item-level_itypes', 0 );
220
    C4::Context->set_preference( 'item-level_itypes', 0 );
222
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
221
    ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
223
- 

Return to bug 13713