View | Details | Raw Unified | Return to bug 25375
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-16 / +10 lines)
Lines 710-730 sub marc_records_to_documents { Link Here
710
            my ($tag, $code) = GetMarcFromKohaField('biblio.biblionumber');
710
            my ($tag, $code) = GetMarcFromKohaField('biblio.biblionumber');
711
            my $field = $record->field($tag);
711
            my $field = $record->field($tag);
712
            my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code);
712
            my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code);
713
            my $biblio = Koha::Biblios->find($biblionumber);
713
            my $avail_items = Koha::Items->search({
714
            my $items = $biblio->items;
714
                biblionumber => $biblionumber,
715
            my $available = 0;
715
                onloan       => undef,
716
            while (my $item = $items->next) {
716
                notforloan   => 0,
717
                next if $item->onloan;
717
                withdrawn    => 0,
718
                next if $item->notforloan;
718
                itemlost     => 0,
719
                next if $item->withdrawn;
719
                damaged      => 0
720
                next if $item->itemlost;
720
            })->count;
721
                next if $item->damaged;
721
722
722
            $record_document->{available} = $avail_items ? \1 : \0;
723
                $available = 1;
724
                last;
725
            }
726
727
            $record_document->{available} = $available ? \1 : \0;
728
        }
723
        }
729
724
730
        push @record_documents, $record_document;
725
        push @record_documents, $record_document;
731
- 

Return to bug 25375