Lines 442-477
Returns item record
Link Here
|
442 |
|
442 |
|
443 |
=cut |
443 |
=cut |
444 |
|
444 |
|
445 |
my %default_values_for_mod_from_marc = ( |
445 |
our %default_values_for_mod_from_marc; |
446 |
barcode => undef, |
446 |
|
447 |
booksellerid => undef, |
447 |
sub _build_default_values_for_mod_marc { |
448 |
ccode => undef, |
448 |
my ( $frameworkcode ) = @_; |
449 |
'items.cn_source' => undef, |
449 |
return $default_values_for_mod_from_marc{$frameworkcode} if exists $default_values_for_mod_from_marc{$frameworkcode}; |
450 |
coded_location_qualifier => undef, |
450 |
my $marc_structure = C4::Biblio::GetMarcStructure( 1 , $frameworkcode ); |
451 |
copynumber => undef, |
451 |
my $default_values = { |
452 |
damaged => 0, |
452 |
barcode => undef, |
453 |
# dateaccessioned => undef, |
453 |
booksellerid => undef, |
454 |
enumchron => undef, |
454 |
ccode => undef, |
455 |
holdingbranch => undef, |
455 |
'items.cn_source' => undef, |
456 |
homebranch => undef, |
456 |
coded_location_qualifier => undef, |
457 |
itemcallnumber => undef, |
457 |
copynumber => undef, |
458 |
itemlost => 0, |
458 |
damaged => 0, |
459 |
itemnotes => undef, |
459 |
enumchron => undef, |
460 |
itype => undef, |
460 |
holdingbranch => undef, |
461 |
location => undef, |
461 |
homebranch => undef, |
462 |
permanent_location => undef, |
462 |
itemcallnumber => undef, |
463 |
materials => undef, |
463 |
itemlost => 0, |
464 |
notforloan => 0, |
464 |
itemnotes => undef, |
465 |
paidfor => undef, |
465 |
itype => undef, |
466 |
price => undef, |
466 |
location => undef, |
467 |
replacementprice => undef, |
467 |
permanent_location => undef, |
468 |
replacementpricedate => undef, |
468 |
materials => undef, |
469 |
restricted => undef, |
469 |
notforloan => 0, |
470 |
stack => undef, |
470 |
paidfor => undef, |
471 |
stocknumber => undef, |
471 |
price => undef, |
472 |
uri => undef, |
472 |
replacementprice => undef, |
473 |
withdrawn => 0, |
473 |
replacementpricedate => undef, |
474 |
); |
474 |
restricted => undef, |
|
|
475 |
stack => undef, |
476 |
stocknumber => undef, |
477 |
uri => undef, |
478 |
withdrawn => 0, |
479 |
}; |
480 |
while ( my ( $field, $default_value ) = each %$default_values ) { |
481 |
$field =~ s|[^\.]*\.?(.*)|items.$1|; |
482 |
$default_values_for_mod_from_marc{$frameworkcode}{$field} = |
483 |
$default_value |
484 |
if C4::Koha::IsKohaFieldLinked( |
485 |
{ kohafield => $field, frameworkcode => $frameworkcode } ); |
486 |
} |
487 |
return $default_values_for_mod_from_marc{$frameworkcode}; |
488 |
}; |
475 |
|
489 |
|
476 |
sub ModItemFromMarc { |
490 |
sub ModItemFromMarc { |
477 |
my $item_marc = shift; |
491 |
my $item_marc = shift; |
Lines 485-492
sub ModItemFromMarc {
Link Here
|
485 |
my $localitemmarc = MARC::Record->new; |
499 |
my $localitemmarc = MARC::Record->new; |
486 |
$localitemmarc->append_fields( $item_marc->field($itemtag) ); |
500 |
$localitemmarc->append_fields( $item_marc->field($itemtag) ); |
487 |
my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' ); |
501 |
my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' ); |
488 |
foreach my $item_field ( keys %default_values_for_mod_from_marc ) { |
502 |
my $default_values = _build_default_values_for_mod_marc(); |
489 |
$item->{$item_field} = $default_values_for_mod_from_marc{$item_field} unless (exists $item->{$item_field}); |
503 |
foreach my $item_field ( keys %$default_values ) { |
|
|
504 |
$item->{$item_field} = $default_values->{$item_field} |
505 |
unless exists $item->{$item_field}; |
490 |
} |
506 |
} |
491 |
my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); |
507 |
my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); |
492 |
|
508 |
|