Koha-clms/Koha
Tomas Cohen Arazi d3dc05279c Bug 29570: Fix sorting orders by biblioitems columns
The API representation of Koha::Biblio objects includes the
biblioitems.* columns too. This proved problematic as queries had to get
translated so they work (i.e. if a query passes q={"biblio.ean":"123%"}
then the query needs to be tweaked so biblio.ean is translated into
biblio.biblioitem.ean. This is solved, locally, in the controller.

But sorting needs the same kind of tweak, and it was missing. This patch
solves that by doing a similar conversion.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> FAIL: Tests fail, searching on a 'biblioitems' column generates a 500
error.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! We can sort on those fields
5. Sign off :-D

Note: you will notice the tests only cover sorting by ISBN. I consider
it enough as sorting is a DB problem, and we only want to know if the
generated ORDER BY is valid for the underlying query, and MySQL would
complain if it wasn't the case.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2022-02-16 13:38:45 -05:00
..
Account Bug 29139: Add exceptions to relation accessors 2021-10-01 16:28:55 +02:00
Acquisition Bug 28640: Expose EDI Status on basket details page 2021-07-26 12:46:32 +02:00
App Bug 29498: Remove usage of deprecated Mojolicious::Routes::Route::detour 2022-02-04 14:20:16 -05:00
ArticleRequest Bug 27944: (follow-up) Move statuses to constants 2021-10-05 10:58:14 +02:00
Authority Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
BackgroundJob Bug 29387: Stringify exceptions for other background job modules 2021-11-19 15:23:27 +01:00
Biblio Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
BiblioUtils Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Cache Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Cash Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Charges Bug 22435: (follow-up) Update POS for reduced offset types 2021-08-04 14:06:43 +02:00
Checkouts Bug 29495: (follow-up) Use 'item' relationship 2022-02-04 13:27:06 -05:00
Club Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Config Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Course Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Edifact Bug 29670: Fix EDI for AcqCreateItem = 'placing on order' 2022-01-25 07:01:12 -05:00
Exceptions Bug 14957: (QA follow-up) Rename 'merge' => 'overlay' 2021-10-26 16:46:02 +02:00
Exporter Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ExternalContent Bug 29686: Adapt Koha to use new fulfillment API for OverDrive 2022-02-07 08:12:44 -05:00
Filter/MARC Bug 29764: Fix incorrect EmbedItems RecordProcessor filter POD 2022-02-07 06:47:36 -05:00
Illrequest Bug 22614: Migrate original request 2021-09-21 20:22:57 +02:00
Import Bug 26326: (follow-up) Add ability to check for existence of any primary key 2021-11-03 15:40:52 +01:00
Indexer
…
Item Bug 28445: Split and join on ' | ' instead of '|' for repeatable 2021-10-18 11:28:40 +02:00
Library Bug 29702: Fetch group libraries in a single call 2022-01-14 09:40:37 -05:00
List Bug 16446: Add ability to add patrons to list by borrowernumber 2021-10-21 12:24:04 +02:00
MetadataRecord Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Middleware
…
Misc
…
Notice Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Number
…
OAI/Server Bug 29484: Make ListSets return noSetHierarchy when no sets defined 2021-12-17 08:35:19 -05:00
Object Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Objects Bug 23271: Prevent crash if called without parameters 2021-04-21 15:25:07 +02:00
Old Bug 29290: Rename relationships borrower => patron 2021-10-28 17:32:34 +02:00
Patron Bug 29395: use EXPORT_OK from Koha::Patron::Debarments 2021-11-03 15:40:52 +01:00
Patrons Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Plugins Bug 29121: Catch errors in ->install and ->upgrade calls on plugins 2021-10-01 16:28:55 +02:00
REST Bug 29570: Fix sorting orders by biblioitems columns 2022-02-16 13:38:45 -05:00
RecordProcessor
…
SMS Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SMTP Bug 29427: Make SMTP transport set debug mode correctly 2021-11-08 12:16:31 +01:00
Schema Bug 29605: Update DBIC schema 2022-02-07 12:34:17 -05:00
SearchEngine Bug 29284: (follow-up) Improve error logging to prevent warns 2021-10-25 14:08:06 +02:00
Serial Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Sitemapper Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Subscription Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SuggestionEngine Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Tags Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Template/Plugin Bug 29807: Make Branches plugin handle empty pickup locations list 2022-02-07 06:38:08 -05:00
UI Bug 29146: Same for item editor 2021-11-15 12:38:39 +01:00
Util Bug 11175: (QA follow-up) Move get_component_part_query 2021-10-26 16:46:02 +02:00
XSLT Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Z3950Responder Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
pdfformat Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
Account.pm Bug 29785: Rename Koha::Object->message with ->object_messages 2022-02-11 06:39:53 -05:00
ActionLog.pm
…
ActionLogs.pm
…
AdditionalContent.pm Bug 24387: Rename "News" with "Additional contents" 2021-08-16 11:55:55 +02:00
AdditionalContents.pm Bug 29332: Set default library limits in search_for_display 2021-10-28 12:16:37 +02:00
AdditionalField.pm
…
AdditionalFieldValue.pm
…
AdditionalFieldValues.pm
…
AdditionalFields.pm
…
AdvancedEditorMacro.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AdvancedEditorMacros.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ApiKey.pm Bug 28772: Make validate_secret return 1|0 2021-09-30 09:48:41 +02:00
ApiKeys.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ArticleRequest.pm Bug 29182: (follow-up) Simplify Koha::ArticleRequest->store 2021-10-07 15:49:01 +02:00
ArticleRequests.pm Bug 29082: Add filtering methods to Koha::ArticleRequests 2021-10-07 10:54:59 +02:00
AudioAlert.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AudioAlerts.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthUtils.pm Bug 28772: Add a warning about hash_password usage in updatedatabase.pl 2021-09-30 09:19:05 +02:00
AuthorisedValue.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthorisedValueCategories.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthorisedValueCategory.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthorisedValues.pm Bug 28554: In Koha::AuthorisedValues sort by description 2021-08-30 17:02:07 +02:00
Authorities.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Authority.pm
…
BackgroundJob.pm Bug 28413: Reduce background job worker memory footprint 2021-11-05 12:17:08 +01:00
BackgroundJobs.pm
…
Biblio.pm Bug 29288: Add current_checkouts and old_checkouts methods to Koha::Biblio 2021-10-28 17:32:34 +02:00
BiblioFramework.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
BiblioFrameworks.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
BiblioUtils.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblioitem.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblioitems.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblios.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Cache.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Caches.pm
…
Calendar.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Checkout.pm Bug 29290: Rename relationships borrower => patron 2021-10-28 17:32:34 +02:00
Checkouts.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CirculationRule.pm
…
CirculationRules.pm Bug 27945: Terminology: max daily => open requests limit 2021-10-06 10:08:17 +02:00
Cities.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
City.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSortRule.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSortRules.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSource.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSources.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSplitRule.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSplitRules.pm
…
Club.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Clubs.pm Bug 29736: Restore searching 2022-01-14 09:35:15 -05:00
Config.pm Bug 28306: Allow to query database with minimal memory footprint 2021-08-31 10:27:52 +02:00
Course.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Courses.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CoverImage.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CoverImages.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CsvProfile.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CsvProfiles.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Database.pm Bug 19821: Use database_test entry if exists 2021-10-25 11:27:40 +02:00
DateUtils.pm Bug 24850: (QA follow-up) Add more comments 2021-11-02 14:57:14 +01:00
Desk.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Desks.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
EDI.pm Bug 28960: Explicitly call get_column 2021-09-20 12:06:53 +02:00
Edifact.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Email.pm Bug 29330: Add Koha::Email->new_from_string 2021-11-15 12:38:39 +01:00
Exceptions.pm Bug 26518: Raise exception if the insert failed 2020-11-25 15:18:17 +01:00
ExternalContent.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
FrameworkPlugin.pm Bug 28769: Remove tabloop from cataloguing plugins 2021-10-18 11:28:40 +02:00
Hold.pm Bug 21652: Simplify code 2022-02-07 10:46:02 -05:00
Holds.pm Bug 29786: Select only specific items for item level holds 2022-02-04 13:58:29 -05:00
I18N.pm Bug 17600: (follow-up) Fix wrong import in Koha::I18N - LC_MESSAGES 2021-07-27 14:49:22 +02:00
Illcomment.pm
…
Illcomments.pm
…
Illrequest.pm Bug 28932: Fix duplicate next_action & prev_action 2022-02-04 13:57:24 -05:00
Illrequestattribute.pm
…
Illrequestattributes.pm
…
Illrequests.pm
…
ImportBatch.pm Bug 23019: Add profiles to stage-import-batch and magnage-import-batch pages 2020-11-11 15:55:49 +01:00
ImportBatchProfile.pm Bug 23019: (follow-up) Fix other things 2020-11-11 15:55:49 +01:00
ImportBatchProfiles.pm Bug 23019: (follow-up) Fix other things 2020-11-11 15:55:49 +01:00
ImportBatches.pm Bug 23019: Add profiles to stage-import-batch and magnage-import-batch pages 2020-11-11 15:55:49 +01:00
Item.pm Bug 28692: Get from storage before log actions 2021-11-16 14:00:20 +01:00
ItemType.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ItemTypes.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Items.pm Bug 28445: Fix LostItem call and display errors 2021-10-28 12:05:43 +02:00
KeyboardShortcut.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
KeyboardShortcuts.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Libraries.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Library.pm Bug 28948: (QA follow-up) Convert to allow-list 2021-10-28 17:32:34 +02:00
Linktracker.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Localization.pm
…
Localizations.pm
…
Logger.pm Bug 25464: Add ability to specify client IP and SIP account used in SIP2 logging 2021-07-26 12:46:32 +02:00
Manual.pm Bug 24387: Rename "News" with "Additional contents" 2021-08-16 11:55:55 +02: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 Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MarcSubfieldStructures.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MessageAttribute.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MessageAttributes.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MetaSearcher.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MetadataIterator.pm
…
MetadataRecord.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02: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 29785: Rename Koha::Object->message with ->object_messages 2022-02-11 06:39:53 -05:00
Objects.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Patron.pm Bug 29230: Add Koha::Patron->messages 2022-02-11 06:58:35 -05:00
Patrons.pm Bug 29086: (follow-up) Remove unrequired Koha::ArticleRequest::Status uses 2021-10-07 10:54:59 +02:00
Plugins.pm Bug 28211: (QA follow-up) POD changes 2021-10-18 11:28:41 +02:00
ProblemReport.pm
…
ProblemReports.pm
…
PseudonymizedTransaction.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
PseudonymizedTransactions.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Quote.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Quotes.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
RDF.pm
…
Rating.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Ratings.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
RecordProcessor.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Report.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reports.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Review.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reviews.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Schema.pm
…
Script.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SearchEngine.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SearchField.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SearchFields.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SearchMarcMap.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SearchMarcMaps.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Serial.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Serials.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SharedContent.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SimpleMARC.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Sitemapper.pm
…
Statistic.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Statistics.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
StockRotationItem.pm Bug 29809: Rename item relation accessor from itemnumber 2022-02-07 11:47:38 -05:00
StockRotationItems.pm
…
StockRotationRota.pm
…
StockRotationRotas.pm
…
StockRotationStage.pm
…
StockRotationStages.pm
…
Subscription.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Subscriptions.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Suggestion.pm Bug 17314: Implement /suggestions routes 2021-10-28 17:32:34 +02:00
SuggestionEngine.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Suggestions.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Tag.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Tags.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Token.pm Bug 29812: Add missing use C4::Context in Koha::Token 2022-02-04 14:24:05 -05:00
TrackedLink.pm Bug 22690: (QA follow-up) Add TrackedLink classes and use them 2021-08-27 11:02:41 +02:00
TrackedLinks.pm Bug 22690: (QA follow-up) Add TrackedLink classes and use them 2021-08-27 11:02:41 +02:00
UploadedFile.pm Bug 29156: File missing warning in Koha::UploadedFile for permanent files only 2022-02-07 06:58:20 -05:00
UploadedFiles.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Uploader.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelf.pm Bug 28959: Add virtualshelves.public as a boolean 2021-10-28 17:47:38 +02:00
Virtualshelfcontent.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelfcontents.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelfshare.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelfshares.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelves.pm Bug 28959: Add virtualshelves.public as a boolean 2021-10-28 17:47:38 +02:00
Z3950Responder.pm Bug 25292: Flushing L1 on every Z3950 server search 2021-01-11 10:27:37 +01:00
Z3950Server.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Z3950Servers.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00