[Koha-bugs] [Bug 12388] IssueSlip output should be sorted by date_due, not timestamp

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 14 10:08:48 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12388

--- Comment #18 from Emmi Takkinen <emmi.takkinen at koha-suomi.fi> ---
(In reply to Joonas Kylmälä from comment #17)
> Running prove t/db_dependent/Members/IssueSlip.t gives the following warning:
> 
> t/db_dependent/Members/IssueSlip.t ..
> DBIx::Class::ResultSet::_construct_results(): Unable to properly collapse
> has_many results in iterator mode due to order criteria - performed an eager
> cursor slurp underneath. Consider using ->all() instead at
> /kohadevbox/koha/Koha/Objects.pm line 312
> 
If I understand correctly (and correct me if I'm wrong), this happens because
sub pending_checkouts uses prefetch to get data (at least) from biblio table.
Bug 28561 handled same kind of problem, comment from there:

> DBIx says about prefetching and collapse the following:
> If an "order_by" is already declared, and orders the resultset in a way that 
> makes collapsing as described above impossible (e.g. ORDER BY 
> has_many_rel.column or ORDER BY RANDOM()), DBIC will automatically switch to 
> "eager" mode and slurp the entire resultset before constructing the first 
> object returned by "next".

In bug 28561 this was handled by replacing prefetch with join. However using
this same approach here would mean we lose data from biblio table since join
returns data only from, in this case, issues table.

At least one solution for this would be to move those order_by statements
(date_due, issuedate) from sub IssuesSlip to sub pending_reserves. However I'm
not sure if this could have some side effects in other parts of Koha.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list