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

(-)a/C4/Context.pm (+20 lines)
Lines 1022-1027 sub _new_marcfromkohafield Link Here
1022
    return $marcfromkohafield;
1022
    return $marcfromkohafield;
1023
}
1023
}
1024
1024
1025
sub getItemFieldsForMARC {
1026
    my ($self, $frameworkcode) = @_;
1027
    # If the hash already exists, return it.
1028
    return $context->{itemFieldsForMARC}->{$frameworkcode} if defined($context->{itemFieldsForMARC}->{$frameworkcode});
1029
1030
    # No hash. Create one.
1031
    my $marcToDBMappings = &marcfromkohafield();
1032
    my $framework = $marcToDBMappings->{$frameworkcode};
1033
    my $itemFields = {};
1034
    foreach my $key (keys %$framework) {
1035
        if ($key =~ /^items\./) {
1036
            my $itemField = $framework->{$key}->[0];
1037
            $itemFields->{$itemField} = 1;
1038
        }
1039
    }
1040
    $context->{itemFieldsForMARC}->{$frameworkcode} = [keys($itemFields)];
1041
1042
    return $context->{itemFieldsForMARC}->{$frameworkcode};
1043
}
1044
1025
=head2 stopwords
1045
=head2 stopwords
1026
1046
1027
  $dbh = C4::Context->stopwords;
1047
  $dbh = C4::Context->stopwords;
(-)a/C4/Items.pm (-3 / +4 lines)
Lines 499-508 sub ModItemFromMarc { Link Here
499
499
500
    my $dbh           = C4::Context->dbh;
500
    my $dbh           = C4::Context->dbh;
501
    my $frameworkcode = GetFrameworkCode($biblionumber);
501
    my $frameworkcode = GetFrameworkCode($biblionumber);
502
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
502
    my $itemFieldCodes = C4::Context->getItemFieldsForMARC($frameworkcode);
503
503
504
    my $localitemmarc = MARC::Record->new;
504
    my $localitemmarc = MARC::Record->new;
505
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
505
    foreach my $fieldCode (@$itemFieldCodes) {
506
        $localitemmarc->append_fields( $item_marc->field($fieldCode) );
507
    }
506
    my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' );
508
    my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' );
507
    my $default_values = _build_default_values_for_mod_marc();
509
    my $default_values = _build_default_values_for_mod_marc();
508
    foreach my $item_field ( keys %$default_values ) {
510
    foreach my $item_field ( keys %$default_values ) {
509
- 

Return to bug 13708