Bugzilla – Attachment 166456 Details for
Bug 34360
[WARN] DBIx::Class::ResultSetColumn::new(): Attempting to retrieve non-unique column 'biblionumber' on a resultset containing one-to-many joins will return duplicate results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34360: Get distinct biblionumber
Bug-34360-Get-distinct-biblionumber.patch (text/plain), 1.98 KB, created by
Baptiste Bayche
on 2024-05-09 13:53:26 UTC
(
hide
)
Description:
Bug 34360: Get distinct biblionumber
Filename:
MIME Type:
Creator:
Baptiste Bayche
Created:
2024-05-09 13:53:26 UTC
Size:
1.98 KB
patch
obsolete
>From 5cab8aa590a021fedd477d184602586b00de809e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 11 Jan 2024 11:53:42 +0000 >Subject: [PATCH] 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 > >Signed-off-by: baptiste <baptiste.bayche@inlibro.com> >--- > Koha/Items.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index f3edb77685..7c594e6798 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -450,7 +450,7 @@ sub search_ordered { > > $self = $self->search($params, $attributes); > >- my @biblionumbers = uniq $self->get_column('biblionumber'); >+ my @biblionumbers = uniq $self->search(undef,{distinct=>1})->get_column('biblionumber'); > > if ( scalar ( @biblionumbers ) == 1 > && Koha::Biblios->find( $biblionumbers[0] )->serial ) >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34360
:
160842
|
166456
|
166499