Bugzilla – Attachment 162719 Details for
Bug 35963
Problem using some filters in the bundled items table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35963: Fix bundled items table ordering and filtering
Bug-35963-Fix-bundled-items-table-ordering-and-fil.patch (text/plain), 2.79 KB, created by
Martin Renvoize (ashimema)
on 2024-03-04 16:37:58 UTC
(
hide
)
Description:
Bug 35963: Fix bundled items table ordering and filtering
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-03-04 16:37:58 UTC
Size:
2.79 KB
patch
obsolete
>From 0892d3e4f0346c273cb5da41e41295afe8f66f13 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 7 Feb 2024 14:36:01 +0100 >Subject: [PATCH] Bug 35963: Fix bundled items table ordering and filtering > >Using the many-to-many relationship results in the table alias `me` to >be used for table `item_bundles` instead of the expected table `items`. >This causes ordering and filtering to fail for columns Callnumber and >Barcode. >Using Koha::Items->search does not have this problem. > >This patch also disables ordering by status because it does not work >(error message is: "Cannot find Koha::Object class for return_claim'") > >Test plan: >1. Create an item bundle > https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles >2. Add at least 2 items to this bundle >3. Verify that ordering/filtering by callnumber or barcode works >4. Run `prove t/db_dependent/api/v1/items/bundled_items.t` > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Items.pm | 11 +++++++++-- > .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 2 +- > 2 files changed, 10 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index 5db12b669d1..69333c1bdf6 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -294,8 +294,15 @@ sub bundled_items { > } > > return try { >- my $items_set = $item->bundle_items; >- my $items = $c->objects->search( $items_set ); >+ my $items_set = Koha::Items->search( >+ { >+ 'item_bundles_item.host' => $item_id, >+ }, >+ { >+ join => 'item_bundles_item', >+ } >+ ); >+ my $items = $c->objects->search($items_set); > return $c->render( > status => 200, > openapi => $items >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 863ae272f23..b8aa4e04860 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1906,7 +1906,7 @@ > "data": "lost_status:last_seen_date:return_claim.patron", > "title": _("Status"), > "searchable": false, >- "orderable": true, >+ "orderable": false, > "render": function(data, type, row, meta) { > if ( row.lost_status == bundle_lost_value ) { > let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>'; >-- >2.44.0
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 35963
:
161812
|
162521
|
162522
|
162523
|
162718
| 162719 |
162720