From 64bb62fca5c9dee4665f2119277d804af0ac0459 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Fri, 6 Nov 2020 16:44:25 -0300
Subject: [PATCH] Bug 20212: Make all biblioitems.* fields searchable

Prior to this bug, only a few bilbio fields were actually searchable through
the orders API. This patch adds all of them to the mapping, so other
pages can take advantage of them.

My first approach was to add things as needed. But this is trivial to
make complete.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
---
 Koha/REST/V1/Acquisitions/Orders.pm | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/Koha/REST/V1/Acquisitions/Orders.pm b/Koha/REST/V1/Acquisitions/Orders.pm
index 06e125e24a..ff8a8f77a0 100644
--- a/Koha/REST/V1/Acquisitions/Orders.pm
+++ b/Koha/REST/V1/Acquisitions/Orders.pm
@@ -312,10 +312,34 @@ sub fix_query {
 
     my $query = $args->{query};
     my $biblioitem_fields = {
-        'biblio.isbn'      => 'biblio.biblioitem.isbn',
-        'biblio.ean'       => 'biblio.biblioitem.ean',
-        'biblio.publisher' => 'biblio.biblioitem.publisher',
-        'biblio.publication_year' => 'biblio.biblioitem.publication_year'
+        'biblio.age_restriction'     => 'biblio.biblioitem.age_restriction',
+        'biblio.cn_class'            => 'biblio.biblioitem.cn_class',
+        'biblio.cn_item'             => 'biblio.biblioitem.cn_item',
+        'biblio.cn_sort'             => 'biblio.biblioitem.cn_sort',
+        'biblio.cn_source'           => 'biblio.biblioitem.cn_source',
+        'biblio.cn_suffix'           => 'biblio.biblioitem.cn_suffix',
+        'biblio.collection_issn'     => 'biblio.biblioitem.collection_issn',
+        'biblio.collection_title'    => 'biblio.biblioitem.collection_title',
+        'biblio.collection_volume'   => 'biblio.biblioitem.collection_volume',
+        'biblio.ean'                 => 'biblio.biblioitem.ean',
+        'biblio.edition_statement'   => 'biblio.biblioitem.edition_statement',
+        'biblio.illustrations'       => 'biblio.biblioitem.illustrations',
+        'biblio.isbn'                => 'biblio.biblioitem.isbn',
+        'biblio.issn'                => 'biblio.biblioitem.issn',
+        'biblio.item_type'           => 'biblio.biblioitem.item_type',
+        'biblio.lc_control_number'   => 'biblio.biblioitem.lc_control_number',
+        'biblio.material_size'       => 'biblio.biblioitem.material_size',
+        'biblio.notes'               => 'biblio.biblioitem.notes',
+        'biblio.number'              => 'biblio.biblioitem.number',
+        'biblio.pages'               => 'biblio.biblioitem.pages',
+        'biblio.publication_place'   => 'biblio.biblioitem.publication_place',
+        'biblio.publication_year'    => 'biblio.biblioitem.publication_year',
+        'biblio.publisher'           => 'biblio.biblioitem.publisher',
+        'biblio.serial_total_issues' => 'biblio.biblioitem.serial_total_issues'
+        'biblio.url'                 => 'biblio.biblioitem.url',
+        'biblio.volume'              => 'biblio.biblioitem.volume',
+        'biblio.volume_date'         => 'biblio.biblioitem.volume_date',
+        'biblio.volume_description'  => 'biblio.biblioitem.volume_description',
     };
 
     if ( ref($query) eq 'HASH' ) {
-- 
2.11.0