X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=Koha%2FSchema%2FResult%2FItemtype.pm;h=959f8a3956ad3a1d0eac54366452b3ae3136e4b1;hb=cb0e33f046547c919aff6684c47dcee282ab4d16;hp=5af2466e1cc760ded23dc562f74fb73bf9c0d0f5;hpb=72dd80fae9acedab5bc9512bbbbfa79e0f57aa99;p=koha.git diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index 5af2466e1c..959f8a3956 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -199,11 +199,20 @@ __PACKAGE__->has_many( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1GiikODklVISOurHX37qjA # Use the ItemtypeLocalization view to create the join on localization +our $LANGUAGE; __PACKAGE__->has_many( - "localization", - "Koha::Schema::Result::ItemtypeLocalization", - { "foreign.code" => "self.itemtype" }, - { cascade_copy => 0, cascade_delete => 0 }, + "localization" => "Koha::Schema::Result::ItemtypeLocalization", + sub { + my $args = shift; + + die "no lang specified!" unless $LANGUAGE; + + return ({ + "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" }, + "$args->{foreign_alias}.lang" => $LANGUAGE, + }); + + } ); 1;