|
Lines 38-92
$marcrecord->add_fields(
Link Here
|
| 38 |
); |
38 |
); |
| 39 |
my $samplehash = [ |
39 |
my $samplehash = [ |
| 40 |
{ |
40 |
{ |
| 41 |
'field' => [ |
41 |
'value' => '1234', |
| 42 |
{ |
42 |
'tag' => '001', |
| 43 |
'value' => '1234', |
|
|
| 44 |
'tag' => '001', |
| 45 |
} |
| 46 |
] |
| 47 |
}, |
43 |
}, |
| 48 |
{ |
44 |
{ |
| 49 |
'field' => [ |
45 |
'subfield' => [ |
| 50 |
{ |
46 |
{ |
| 51 |
'subfield' => [ |
47 |
'value' => 'Cooking', |
| 52 |
{ |
48 |
'subtag' => 'a' |
| 53 |
'value' => 'Cooking', |
|
|
| 54 |
'subtag' => 'a' |
| 55 |
} |
| 56 |
], |
| 57 |
'indicator2' => ' ', |
| 58 |
'tag' => 150, |
| 59 |
'indicator1' => ' ', |
| 60 |
} |
49 |
} |
| 61 |
] |
50 |
], |
|
|
51 |
'indicator2' => ' ', |
| 52 |
'tag' => 150, |
| 53 |
'indicator1' => ' ', |
| 62 |
}, |
54 |
}, |
| 63 |
{ |
55 |
{ |
| 64 |
'field' => [ |
56 |
'subfield' => [ |
|
|
57 |
{ |
| 58 |
'value' => 'Cookery', |
| 59 |
'subtag' => 'a' |
| 60 |
}, |
| 65 |
{ |
61 |
{ |
| 66 |
'subfield' => [ |
62 |
'value' => 'Instructional manuals', |
| 67 |
{ |
63 |
'subtag' => 'z' |
| 68 |
'value' => 'Cookery', |
|
|
| 69 |
'subtag' => 'a' |
| 70 |
}, |
| 71 |
{ |
| 72 |
'value' => 'Instructional manuals', |
| 73 |
'subtag' => 'z' |
| 74 |
} |
| 75 |
], |
| 76 |
'indicator2' => ' ', |
| 77 |
'tag' => 450, |
| 78 |
'indicator1' => ' ', |
| 79 |
} |
64 |
} |
| 80 |
] |
65 |
], |
|
|
66 |
'indicator2' => ' ', |
| 67 |
'tag' => 450, |
| 68 |
'indicator1' => ' ', |
| 81 |
} |
69 |
} |
| 82 |
]; |
70 |
]; |
| 83 |
|
71 |
|
| 84 |
my $hash = Koha::Util::MARC::createMergeHash($marcrecord); |
72 |
my $hash = Koha::Util::MARC::createMergeHash($marcrecord); |
| 85 |
my %fieldkeys; |
73 |
my %fieldkeys; |
| 86 |
foreach my $field (@$hash) { |
74 |
foreach my $field (@$hash) { |
| 87 |
$fieldkeys{delete $field->{'field'}->[0]->{'key'}}++; |
75 |
$fieldkeys{delete $field->{'key'}}++; |
| 88 |
if (defined $field->{'field'}->[0]->{'subfield'}) { |
76 |
if (defined $field->{'subfield'}) { |
| 89 |
foreach my $subfield (@{$field->{'field'}->[0]->{'subfield'}}) { |
77 |
foreach my $subfield (@{$field->{'subfield'}}) { |
| 90 |
$fieldkeys{delete $subfield->{'subkey'}}++; |
78 |
$fieldkeys{delete $subfield->{'subkey'}}++; |
| 91 |
} |
79 |
} |
| 92 |
} |
80 |
} |
| 93 |
- |
|
|