Lines 26-31
use Koha::Database;
Link Here
|
26 |
use Koha::DateUtils qw( dt_from_string ); |
26 |
use Koha::DateUtils qw( dt_from_string ); |
27 |
|
27 |
|
28 |
use C4::Context; |
28 |
use C4::Context; |
|
|
29 |
|
29 |
use Koha::Checkouts; |
30 |
use Koha::Checkouts; |
30 |
use Koha::IssuingRules; |
31 |
use Koha::IssuingRules; |
31 |
use Koha::Item::Transfer::Limits; |
32 |
use Koha::Item::Transfer::Limits; |
Lines 385-390
sub has_pending_hold {
Link Here
|
385 |
return !C4::Context->preference('AllowItemsOnHoldCheckout') && $pending_hold->count ? 1: 0; |
386 |
return !C4::Context->preference('AllowItemsOnHoldCheckout') && $pending_hold->count ? 1: 0; |
386 |
} |
387 |
} |
387 |
|
388 |
|
|
|
389 |
=head3 as_marc_field |
390 |
|
391 |
my $mss = C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } ); |
392 |
my $field = $item->as_marc_field({ [ mss => $mss ] }); |
393 |
|
394 |
This method returns a MARC::Field object representing the Koha::Item object |
395 |
with the current mappings configuration. |
396 |
|
397 |
=cut |
398 |
|
399 |
sub as_marc_field { |
400 |
my ( $self, $params ) = @_; |
401 |
|
402 |
my $mss = $params->{mss} // C4::Biblio::GetMarcSubfieldStructure( '', { unsafe => 1 } ); |
403 |
my $item_tag = $mss->{'items.itemnumber'}[0]->{tagfield}; |
404 |
|
405 |
my @subfields; |
406 |
|
407 |
my @columns = $self->_result->result_source->columns; |
408 |
|
409 |
foreach my $item_field ( @columns ) { |
410 |
my $mapping = $mss->{ "items.$item_field"}[0]; |
411 |
my $tagfield = $mapping->{tagfield}; |
412 |
my $tagsubfield = $mapping->{tagsubfield}; |
413 |
next if !$tagfield; # TODO: Should we raise an exception instead? |
414 |
# Feels like safe fallback is better |
415 |
|
416 |
push @subfields, $tagsubfield => $self->$item_field; |
417 |
} |
418 |
|
419 |
my $unlinked_item_subfields = C4::Items::_parse_unlinked_item_subfields_from_xml($self->more_subfields_xml); |
420 |
push( @subfields, @{$unlinked_item_subfields} ) |
421 |
if defined $unlinked_item_subfields and $#$unlinked_item_subfields > -1; |
422 |
|
423 |
my $field; |
424 |
|
425 |
$field = MARC::Field->new( |
426 |
"$item_tag", ' ', ' ', @subfields |
427 |
) if @subfields; |
428 |
|
429 |
return $field; |
430 |
} |
431 |
|
388 |
=head2 Internal methods |
432 |
=head2 Internal methods |
389 |
|
433 |
|
390 |
=head3 _type |
434 |
=head3 _type |
391 |
- |
|
|