Bugzilla – Attachment 140055 Details for
Bug 25375
Elasticsearch: Limit on available items does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25375: (QA follow-up) Count available items rather than iterating
Bug-25375-QA-follow-up-Count-available-items-rathe.patch (text/plain), 2.00 KB, created by
Joonas Kylmälä
on 2022-09-01 18:00:37 UTC
(
hide
)
Description:
Bug 25375: (QA follow-up) Count available items rather than iterating
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2022-09-01 18:00:37 UTC
Size:
2.00 KB
patch
obsolete
>From f51549daf34ce95da40d435a71ae78cdc867bd18 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 11 Sep 2020 15:23:02 +0000 >Subject: [PATCH] Bug 25375: (QA follow-up) Count available items rather than > iterating >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >--- > Koha/SearchEngine/Elasticsearch.pm | 25 ++++++++++--------------- > 1 file changed, 10 insertions(+), 15 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index c49aa17b6d..20462ccd03 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -777,21 +777,16 @@ sub marc_records_to_documents { > my ($tag, $code) = C4::Biblio::GetMarcFromKohaField('biblio.biblionumber'); > my $field = $record->field($tag); > my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code); >- my $biblio = Koha::Biblios->find($biblionumber); >- my $items = $biblio->items; >- my $available = 0; >- while (my $item = $items->next) { >- next if $item->onloan; >- next if $item->notforloan; >- next if $item->withdrawn; >- next if $item->itemlost; >- next if $item->damaged; >- >- $available = 1; >- last; >- } >- >- $record_document->{available} = $available ? \1 : \0; >+ my $avail_items = Koha::Items->search({ >+ biblionumber => $biblionumber, >+ onloan => undef, >+ notforloan => 0, >+ withdrawn => 0, >+ itemlost => 0, >+ damaged => 0 >+ })->count; >+ >+ $record_document->{available} = $avail_items ? \1 : \0; > } > > push @record_documents, $record_document; >-- >2.30.2
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 25375
:
104356
|
109647
|
109659
|
109660
|
109951
|
109952
|
109953
|
109954
|
131310
|
131311
|
131312
|
131313
|
132327
|
132328
|
132329
|
132330
|
138800
|
138802
|
138803
|
140053
|
140054
| 140055 |
140056
|
140057
|
140572
|
140899
|
140900
|
140979