Lines 777-797
sub marc_records_to_documents {
Link Here
|
777 |
my ($tag, $code) = C4::Biblio::GetMarcFromKohaField('biblio.biblionumber'); |
777 |
my ($tag, $code) = C4::Biblio::GetMarcFromKohaField('biblio.biblionumber'); |
778 |
my $field = $record->field($tag); |
778 |
my $field = $record->field($tag); |
779 |
my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code); |
779 |
my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code); |
780 |
my $biblio = Koha::Biblios->find($biblionumber); |
780 |
my $avail_items = Koha::Items->search({ |
781 |
my $items = $biblio->items; |
781 |
biblionumber => $biblionumber, |
782 |
my $available = 0; |
782 |
onloan => undef, |
783 |
while (my $item = $items->next) { |
783 |
notforloan => 0, |
784 |
next if $item->onloan; |
784 |
withdrawn => 0, |
785 |
next if $item->notforloan; |
785 |
itemlost => 0, |
786 |
next if $item->withdrawn; |
786 |
damaged => 0 |
787 |
next if $item->itemlost; |
787 |
})->count; |
788 |
next if $item->damaged; |
788 |
|
789 |
|
789 |
$record_document->{available} = $avail_items ? \1 : \0; |
790 |
$available = 1; |
|
|
791 |
last; |
792 |
} |
793 |
|
794 |
$record_document->{available} = $available ? \1 : \0; |
795 |
} |
790 |
} |
796 |
|
791 |
|
797 |
push @record_documents, $record_document; |
792 |
push @record_documents, $record_document; |
798 |
- |
|
|