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

--- Comment #5 from Nick Clemens <[email protected]> ---
Created attachment 160842
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160842&action=edit
Bug 34360: Get distinct biblionumber

This fixes the problem noted in the bug:
[WARN] DBIx::Class::ResultSetColumn::new(): Attempting to retrieve non-unique
column 'biblionumber' on a resultset containing one-to-many joins will return
duplicate results. at /usr/share/koha/Koha/Objects.pm line 421

We are taking a list of items, assuming the scenario is that these are from a
single biblio and possibly some host_items, then searching and ordering
conditionally on whether the biblio is a serial.

Current code gets the first biblio from the list - this patch adds a 'DISTINCT'
to the results ebfore fetching the column

To test:
1 - Find a biblio in the staff interface
2 - Transfer one of the items a few times
3 - Recreate the issue on the command line:
    export DBIC_TRACE=1
    perl -e 'use Koha::Items; my $items =
Koha::Items->search({biblionumber=>9})->search_ordered(undef,{ prefetch =>
['issue','current_branchtransfers'] }); $items->next'
4 - Note warning:
    DBIx::Class::ResultSetColumn::new(): Attempting to retrieve non-unique
column 'biblionumber' on a resultset containing one-to-many joins will return
duplicate results. at /kohadevbox/koha/Koha/Objects.pm line 426
5 - Apply patch
6 - Repeat 3
7 - Error is gone

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to