Koha/Koha
Nick Clemens b5388933b6
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>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-10 14:11:42 +02:00
..
Account Bug 22740: Automatically change lost status when item is paid for 2024-05-03 19:31:55 +02:00
Acquisition Bug 36002: Remove last references to purchaseordernumber 2024-04-30 17:09:44 +02:00
App Bug 29498: Remove usage of deprecated Mojolicious::Routes::Route::detour 2022-01-18 21:15:04 -10:00
ArticleRequest Bug 27944: (follow-up) Move statuses to constants 2021-10-05 10:58:14 +02:00
Auth Bug 30843: Add mfa_range configuration option for TOTP 2023-09-25 10:53:51 -03:00
Authority
BackgroundJob Bug 35979: (follow-up) Add check in ->enqueue 2024-04-26 08:52:54 +02:00
Biblio Bug 31791: Add Koha::Biblio::Metadata->record_source 2024-04-26 20:15:38 +02:00
Cache Bug 29623: (QA follow-up) Add POD to Koha::Cache::Lite 2022-06-14 08:26:59 -03:00
Cash Bug 36481: (QA follow-up) Rename branch_default to library_default 2024-05-01 13:51:41 +01:00
Charges
Checkouts Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database 2023-05-24 11:21:31 -03:00
Club Bug 29523: (QA follow-up) Fix failing test in club holds 2023-10-27 16:40:43 -03:00
CodeList/Unimarc Bug 30941: (QA follow-up) Only export what is needed 2022-08-19 11:00:42 -03:00
Config Bug 32478: Remove Koha::Config::SysPref->find since bypasses cache 2023-06-07 15:25:18 -03:00
Course Bug 33568: Course reserves 2024-04-05 15:34:52 +02:00
Database Bug 36796: (follow-up) Fix column descriptions for the statistics table 2024-05-07 17:41:17 +02:00
DateTime/Format Bug 36432: Remove circular dependency from Koha::Object 2024-04-04 15:24:32 +02:00
Edifact Bug 35724: (QA follow-up) Also account for port in FTP 2024-04-19 18:31:37 +02:00
ERM Bug 36618: Make biblio creation optional for ERM local titles 2024-05-08 20:04:07 +02:00
Exceptions Bug 32610: (QA follow-up) Tidy exceptions file 2024-04-30 17:09:52 +02:00
Exporter Bug 31286: (QA follow-up): tidy up code 2024-03-25 09:53:24 +01:00
ExternalContent Bug 33697: Remove RecordedBooks (rbdigital) integration 2023-06-05 15:36:11 -03:00
Filter/MARC Bug 33749: (QA follow-up) Tidy code for qa script 2023-11-03 12:08:07 -03:00
Hold Bug 28966: (QA follow-up) Changes for Koha objects 2023-07-25 16:25:39 -03:00
ILL Bug 36416: Fix cud-check_out 2024-04-26 08:52:49 +02:00
Import Bug 32437: (QA follow-up) Change to replace POD 2023-03-31 13:13:28 +02:00
Indexer
Installer Bug 35681: Add Koha::Installer::Output 2024-05-02 16:47:40 +02:00
Item Bug 33568: Display library names instead of codes for transfers 2024-04-05 15:34:56 +02:00
Library Bug 6796: Add library_hours table and set opening hours for library 2024-04-12 11:26:03 +02:00
List Bug 16446: Add ability to add patrons to list by borrowernumber 2021-10-21 12:24:04 +02:00
MetadataRecord Bug 35345: Add --where option to rebuild_elasticsearch.pl 2024-04-22 12:39:26 +02:00
Middleware Bug 36700: Fix underscore in CSRF header 2024-05-01 13:40:12 +01:00
Misc
Notice Bug 30287: (follow-up) Add content wrap matching send time 2023-12-19 13:42:10 +01:00
Number
OAI/Server Bug 34467: OAI GetRecord bad encoding for Unimarc 2023-10-09 16:41:29 -03:00
Object Bug 32894: Remove wrong caching from Koha:: methods - simple 2023-06-07 16:44:03 -03:00
Objects Bug 32735: (follow-up) Make Koha::Objects::Record::Collections->print_collection work with Authorities and Biblios 2023-05-05 12:13:50 -03:00
Old Bug 35353: Add REST API endpoint to retrieve old holds 2024-04-26 18:06:09 +02:00
Patron Bug 25996: (follow-up) Log the entire object on deletion 2024-05-03 18:02:18 +02:00
Patrons Bug 34621: implement Patron import option to 'Renew existing patrons' 'from the current membership expiry date' 2024-04-12 14:02:41 +02:00
pdfformat Bug 33393: tidy layout1page.pm 2024-04-19 19:54:46 +02:00
Plugins Bug 35536: Add RemovePlugins calls in plugin unit tests 2024-03-22 12:26:39 +01:00
Policy Bug 30825: Move holds_control_library to Koha::Policy::Holds 2023-09-22 12:35:46 -03:00
Preservation Bug 33547: (QA follow-up) Tidy 2023-10-23 11:33:53 -03:00
RecordProcessor
REST Bug 36618: Make biblio creation optional for ERM local titles 2024-05-08 20:04:07 +02:00
Result Bug 29746: (it-doesn't-hurt follow-up) More tests 2022-01-05 13:33:46 -10:00
Schema Bug 36687: DBIC schema update 2024-05-08 18:23:46 +02:00
SearchEngine Bug 36396: Export/import the yaml config 2024-05-07 15:53:54 +02:00
Serial Bug 33568: enumchron/volinfo 2024-04-05 15:34:47 +02:00
Sitemapper Bug 33870: Make $MAX in Sitemapper::Writer global 2023-09-01 11:23:23 -03:00
SMS
SMTP Bug 29523: (QA follow-up) Catch remaining SUPER::to_api cases 2023-10-27 16:40:42 -03:00
Subscription
SuggestionEngine Bug 31069: Remove ExplodedTerms dependency on templates 2022-07-18 12:37:35 -03:00
Tags
Template/Plugin Bug 36700: Fix underscore in CSRF header 2024-05-01 13:40:12 +01:00
Ticket Bug 35657: Add support for assignee_id to ticket_updates endpoint 2024-05-02 15:03:35 +02:00
UI Bug 34266: Default to biblioitems.itemtype only if it's a valid itemtype 2023-09-01 12:08:35 -03:00
Util Bug 30678: (follow-up) Add oclc_number routine and friends 2022-07-22 14:58:11 -03:00
XSLT Bug 12758: Add new module call in Koha::XSLT::Base 2022-11-09 09:52:25 -03:00
Z3950Responder Bug 24295: Remove GetTransfer from Z3950Responder 2022-08-26 15:42:07 -03:00
Account.pm Bug 31427: Remove a few refs to CanBookBeRenewed 2024-03-07 16:36:44 +01:00
ActionLog.pm
ActionLogs.pm
AdditionalContent.pm Bug 31383: Create a parent-child DB relation for additional content 2023-10-20 14:43:56 -03:00
AdditionalContents.pm Bug 31383: Use one query in search_for_display instead of four 2023-10-20 14:44:02 -03:00
AdditionalContentsLocalization.pm Bug 31383: (QA follow-up) Tidy 2023-10-20 14:44:03 -03:00
AdditionalContentsLocalizations.pm Bug 31383: Create a parent-child DB relation for additional content 2023-10-20 14:43:56 -03:00
AdditionalField.pm Bug 11844: Fix QA issues (POD, TT filters, file exec flag) 2023-05-16 12:58:38 +02:00
AdditionalFields.pm
AdditionalFieldValue.pm
AdditionalFieldValues.pm
AdvancedEditorMacro.pm
AdvancedEditorMacros.pm
ApiKey.pm Bug 28772: Make validate_secret return 1|0 2021-09-30 09:48:41 +02:00
ApiKeys.pm
ArticleRequest.pm Bug 35030: Add 'article' to patron activity triggers 2023-10-24 10:05:26 -03:00
ArticleRequests.pm Bug 29082: Add filtering methods to Koha::ArticleRequests 2021-10-07 10:54:59 +02:00
AudioAlert.pm
AudioAlerts.pm Bug 29859: Use iterator instead of as_list 2022-02-09 15:36:23 -10:00
AuthorisedValue.pm Bug 30920: (follow-up) Flush on delete 2023-03-13 15:11:44 -03:00
AuthorisedValueCategories.pm
AuthorisedValueCategory.pm Bug 32997: Add REST API endpoint to list authorised values for multiple given categories 2023-03-02 12:00:15 -03:00
AuthorisedValues.pm Bug 35579: Cache authorised value lookup by MARC field 2023-12-28 12:16:09 +01:00
Authorities.pm Bug 33083: Add a generic class to handle methods for collections of records 2023-03-13 15:11:59 -03:00
Authority.pm Bug 33996: (QA follow-up) Fix mappings to match guidelines 2023-06-29 11:11:13 -03:00
AuthUtils.pm Bug 33341: Address some perlcritic errors in 5.36 2023-03-28 14:50:33 +02:00
BackgroundJob.pm Bug 35843: Correct invalid exception 2024-01-26 15:13:47 +01:00
BackgroundJobs.pm Bug 31969: Use filter_by_last_update 2022-11-25 09:40:09 -03:00
Biblio.pm Bug 36120: Add pickup_items to the pickup_locations response 2024-05-03 16:02:46 +02:00
BiblioFramework.pm
BiblioFrameworks.pm
Biblioitem.pm Bug 32711: Add 'public_read_list' appropriately 2023-07-24 13:58:25 -03:00
Biblioitems.pm
Biblios.pm Bug 33974: (follow-up) biblionumber column needs special handling 2023-07-03 14:51:46 -03:00
BiblioUtils.pm Bug 35345: Add --where option to rebuild_elasticsearch.pl 2024-04-22 12:39:26 +02:00
Booking.pm Bug 36120: Add pickup_library support to bookings API 2024-05-03 16:02:46 +02:00
Bookings.pm Bug 35788: Simplify code 2024-03-15 09:38:43 +01:00
Cache.pm
Caches.pm
Calendar.pm Bug 27249: Prevent infinite loop when searching for an open day 2023-10-17 14:45:31 -03:00
Checkout.pm Bug 34924: Handle final renewal errors 2023-10-31 11:02:47 -03:00
Checkouts.pm Bug 33887: (QA follow-up) Perltidy and fix some formatting issues 2023-10-25 12:09:53 -03:00
CirculationRule.pm Bug 32894: Remove wrong caching from Koha:: methods - simple 2023-06-07 16:44:03 -03:00
CirculationRules.pm Bug 8367: Add holds_pickup_period circulation rule 2023-11-01 18:01:30 -03:00
Cities.pm
City.pm
ClassSortRule.pm
ClassSortRules.pm
ClassSource.pm Bug 30920: (follow-up) Flush on delete 2023-03-13 15:11:44 -03:00
ClassSources.pm
ClassSplitRule.pm
ClassSplitRules.pm
Club.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Clubs.pm Bug 29844: Simplify Koha::Clubs->get_enrollable 2022-02-09 15:36:23 -10:00
Config.pm Bug 31393: Koha::Config: handle the special case for 'content' attribute 2023-10-30 09:02:17 -03:00
CookieManager.pm Bug 31250: (QA follow-up) The future will be easier 2022-09-12 15:34:11 -03:00
Course.pm
Courses.pm
CoverImage.pm
CoverImages.pm
CsvProfile.pm
CsvProfiles.pm
CurbsidePickup.pm Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
CurbsidePickupIssue.pm Bug 30650: Add some useful modules and tests 2022-07-29 14:59:57 -03:00
CurbsidePickupIssues.pm Bug 30650: Add some useful modules and tests 2022-07-29 14:59:57 -03:00
CurbsidePickupOpeningSlot.pm Bug 30650: Add some useful modules and tests 2022-07-29 14:59:57 -03:00
CurbsidePickupOpeningSlots.pm Bug 30650: Add some useful modules and tests 2022-07-29 14:59:57 -03:00
CurbsidePickupPolicies.pm Bug 30650: Add some useful modules and tests 2022-07-29 14:59:57 -03:00
CurbsidePickupPolicy.pm Bug 32891: Fix slot selection in last hour 2023-02-21 10:22:28 -03:00
CurbsidePickups.pm Bug 30650: Add filter_by_scheduled_today 2022-07-29 15:00:47 -03:00
Database.pm Bug 19821: Use database_test entry if exists 2021-10-25 11:27:40 +02:00
DateUtils.pm Bug 36432: Remove circular dependency from Koha::Object 2024-04-04 15:24:32 +02:00
Desk.pm Bug 36480: Add GET /libraries/:library_id/desks 2024-04-26 18:06:10 +02:00
Desks.pm
EDI.pm Bug 19097: Adjust some GetMarcFromKohaField calls 2024-04-29 09:35:47 +02:00
Edifact.pm
Email.pm Bug 12532: (QA follow-up) Undo changes to Koha::Email 2023-10-10 09:58:47 -03:00
Encryption.pm Bug 33934: Add more detail to 'No encryption_key in koha-conf.xml' 2023-06-07 15:25:18 -03:00
Exception.pm Bug 29857: (QA follow-up) Add license 2022-03-01 22:47:47 -10:00
Exceptions.pm Bug 17499: Add Koha-objects for messaging preferences 2023-09-12 10:16:06 -03:00
ExternalContent.pm
FrameworkPlugin.pm Bug 35012: Apply change to all events 2023-11-14 10:32:40 -03:00
Hold.pm Bug 25159: Implement diffs in action logs for holds 2024-05-02 16:47:43 +02:00
Holds.pm Bug 32529: Add Koha::Holds->filter_by_found 2023-01-05 09:21:10 -03:00
I18N.pm Bug 35174: Do not explode if po dir does not exist 2023-11-16 08:56:36 +01:00
ImportBatch.pm
ImportBatches.pm
ImportBatchProfile.pm
ImportBatchProfiles.pm
Item.pm Bug 36535: (bug 33568 follow-up) Add missing tests 2024-04-26 14:14:48 +02:00
Items.pm Bug 34360: Get distinct biblionumber 2024-05-10 14:11:42 +02:00
ItemType.pm Bug 34008: Harmonize attribute names 2023-11-01 17:23:15 -03:00
ItemTypes.pm
KeyboardShortcut.pm
KeyboardShortcuts.pm
Libraries.pm
Library.pm Bug 36480: Add Koha::Library->desks 2024-04-26 18:06:09 +02:00
Linktracker.pm
Localization.pm Bug 30920: (follow-up) Flush on delete 2023-03-13 15:11:44 -03:00
Localizations.pm
Logger.pm Bug 33020: (QA follow-up) POD and chmod 2023-02-27 11:33:50 -03:00
Manual.pm Bug 35463: More preservation manual links 2023-12-20 15:13:45 +01:00
MarcOverlayRule.pm Bug 14957: (QA follow-up) Rename 'merge' => 'overlay' 2021-10-26 16:46:02 +02:00
MarcOverlayRules.pm Bug 14957: Fix field order issue 2021-10-26 16:46:03 +02:00
MarcSubfieldStructure.pm
MarcSubfieldStructures.pm
MetadataIterator.pm
MetadataRecord.pm Bug 33749: Use TrimFields instead of stripWhitespaceChars 2023-11-03 12:08:06 -03:00
MetaSearcher.pm Bug 30813: (QA follow-up) Adjust three use statements 2022-06-08 11:40:32 -03:00
MoreUtils.pm
OAuth.pm Bug 28772: Make secret validation use the new method 2021-09-30 09:19:05 +02:00
OAuthAccessToken.pm
OAuthAccessTokens.pm
Object.pm Bug 36432: Remove circular dependency from Koha::Object 2024-04-04 15:24:32 +02:00
Objects.pm Bug 36526: Remove circular dependency from Koha::Objects 2024-05-03 16:02:44 +02:00
OverdueRule.pm Bug 29145: (QA follow-up) Use objects instead of straight SQL queries 2023-10-03 09:24:41 -04:00
OverdueRules.pm Bug 29145: (QA follow-up) Use objects instead of straight SQL queries 2023-10-03 09:24:41 -04:00
Patron.pm Bug 12802: Clarify system preferences 2024-04-29 17:37:55 +02:00
Patrons.pm Bug 36508: Refresh patron object when updating category 2024-04-30 14:32:05 +02:00
Plugins.pm Bug 30897: Remove recursive parent identification loop 2024-04-11 16:53:43 +02:00
ProblemReport.pm
ProblemReports.pm
PseudonymizedTransaction.pm Bug 34611: Add pseudonymize routine to Koha::Statistics 2024-03-19 10:25:05 +01:00
PseudonymizedTransactions.pm
Quote.pm
Quotes.pm
Rating.pm
Ratings.pm
Recall.pm Bug 33568: Display library names instead of codes for recall 2024-04-05 15:34:57 +02:00
Recalls.pm Bug 31147: Recalls should not adjust due time for related checkouts 2023-07-13 15:19:31 -03:00
RecordProcessor.pm
RecordSource.pm Bug 35919: Add Koha::RecordSource(s) classes 2024-04-26 17:06:03 +02:00
RecordSources.pm Bug 35919: Add Koha::RecordSource(s) classes 2024-04-26 17:06:03 +02:00
Report.pm Bug 35746: add multiselect to report dropdowns 2024-04-26 18:06:19 +02:00
Reports.pm
Review.pm
Reviews.pm
Schema.pm
Script.pm Bug 29857: Rename base class as Koha::Exception 2022-03-01 22:47:47 -10:00
SearchEngine.pm
SearchField.pm Bug 20388: (QA follow-up) Tidy 2024-04-16 17:59:47 +02:00
SearchFields.pm
SearchFilter.pm Bug 17170: (QA follow-up) Spec cleanup 2022-10-21 11:15:22 -03:00
SearchFilters.pm Bug 17170: DB Updates 2022-10-21 11:15:13 -03:00
SearchMarcMap.pm
SearchMarcMaps.pm
Serial.pm
Serials.pm
Session.pm Bug 36098: Default to 'file' if pref does not exist 2024-03-01 10:55:51 +01:00
SharedContent.pm
SimpleMARC.pm Bug 35993: Add SimpleMarc::update_last_transaction_time 2024-04-29 09:35:55 +02:00
Sitemapper.pm Bug 33871: Use Koha object in Sitemapper, add optional filter 2023-09-01 11:23:25 -03:00
Statistic.pm Bug 34611: Add pseudonymize routine to Koha::Statistics 2024-03-19 10:25:05 +01:00
Statistics.pm
StockRotationItem.pm Bug 30518: Correct DateTime maths for needs_advancing 2022-04-19 21:25:50 -10:00
StockRotationItems.pm
StockRotationRota.pm
StockRotationRotas.pm
StockRotationStage.pm
StockRotationStages.pm
Subscription.pm
Subscriptions.pm
Suggestion.pm Bug 36122: NEW_SUGGESTION is sent for every modification to the suggestion 2024-05-02 15:03:32 +02:00
SuggestionEngine.pm
Suggestions.pm Bug 33238: Fix bad suggestions query (Bug 29886 follow-up) 2023-04-17 09:39:43 -03:00
Tag.pm
Tags.pm
TemplateUtils.pm Bug 33030: Add standardized subroutine for processing Template Toolkit syntax outside of notices 2023-07-14 16:52:05 -03:00
Ticket.pm Bug 36612: (QA follow-up) Add 'source' to public_read_list 2024-05-07 15:54:03 +02:00
Tickets.pm Bug 31028: Add new Koha::Object(s) classes 2023-03-06 11:23:17 -03:00
Token.pm Bug 36102: If CSRF check fails, try with anonymous 2024-03-01 11:00:34 +01:00
TrackedLink.pm
TrackedLinks.pm
UploadedFile.pm Bug 29156: File missing warning in Koha::UploadedFile for permanent files only 2022-01-21 21:34:51 -10:00
UploadedFiles.pm
Uploader.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Virtualshelf.pm Bug 32894: Remove wrong caching from Koha:: methods - simple 2023-06-07 16:44:03 -03:00
Virtualshelfcontent.pm
Virtualshelfcontents.pm
Virtualshelfshare.pm Bug 32894: Make ->sharee looks like others 2023-06-07 16:44:05 -03:00
Virtualshelfshares.pm
Virtualshelves.pm Bug 30418: Add ability for permitted staff to edit list contents 2023-05-15 18:23:57 -03:00
Z3950Responder.pm
Z3950Server.pm
Z3950Servers.pm