From 834119ac7ca17468d5e9d8122bd5ebf73dc03c4d Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Mon, 19 Aug 2024 20:55:42 +0000 Subject: [PATCH] Bug 37680: inconsistencies with the search results when selecting the "Limit to records with available items" option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There seem to be inconsistencies with the search results when selecting the "Limit to records with available items" option, when we have a notice with two items if the first item is «notforloan» and the second is «notforloan» too or «withdrawn» the notice is still available. And these conditions also are showing : Case : 1- Record with first item as «notforloan» - The second is «notforloan» 2- Record with first item as «notforloan» - The second is «withdrawn» 3- Record with first item as «itemlost» - The second is «notforloan» 4- Record with first item as «itemlost» - The second is «withdrawn» 5- Record with first item «onloan» - The second is «notforloan» 6- Record with first item «onloan» - The second is «withdrawn» To reproduce: 1. Catalog a new record (record test 1) 1.1. Go to Cataloging 1.2. Click New record 1.3. Fill out the mandatory fields (000, 003, 005, 008, 040$c, 245$a, 942$c) 1.4. Click Save (No need to add an item) 1.5. Add two items, set a negative notforloan (ordered) for the two items 2. Repeat step 1, by creating a record (record test 2) with two items one negative notforloan item and the second as «withdrawn» item 3. Repeat step 1, and creating all the record in «Case» section 4. Go to the Opac and search for the created record 5. Click on «Limit to records with available items» ----> All the created items is still showing 6. Apply the patch 7. Rebuild bibliographic index ./misc/search_tools/rebuild_elasticsearch.pl -d -v -r -b 8. Repeat step 4 and 5 ----> the created items is no more showing --- Koha/SearchEngine/Elasticsearch.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 5ef5235720..c52019599b 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -841,6 +841,8 @@ sub marc_records_to_documents { my $avail_items = Koha::Items->search({ biblionumber => $biblionumber, onloan => undef, + notforloan => { '<=' => 0 }, + withdrawn => 0, itemlost => 0, })->count; -- 2.34.1