Bug 17835: Add an additional LEFT JOIN condition using DBIx::Class
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 3 Jan 2017 12:35:46 +0000 (13:35 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 14 Apr 2017 14:43:52 +0000 (10:43 -0400)
commitcb0e33f046547c919aff6684c47dcee282ab4d16
tree28b31a885688bfdd79ab791f3e15cd5f93de4c5c
parent72dd80fae9acedab5bc9512bbbbfa79e0f57aa99
Bug 17835: Add an additional LEFT JOIN condition using DBIx::Class

The previous query was wrong. If an item type did not contain the
translation in the interface's language, the ->search_with_localization
did not return it at all.

What we need is definitely to add a second condition on the join.

For reference:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Relationship/Base.pm#condition
https://blog.afoolishmanifesto.com/posts/dbix-class-parameterized-relationships/

That sounds hacky but seems to be the DBIx::Class path to follow.

Bug 17835: follow-up

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/ItemTypes.pm
Koha/Schema/Result/Itemtype.pm
koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
suggestion/suggestion.pl
t/db_dependent/Koha/ItemTypes.t