|
Lines 183-189
sub MARCfindbreeding {
Link Here
|
| 183 |
=cut |
183 |
=cut |
| 184 |
|
184 |
|
| 185 |
sub CreateKey { |
185 |
sub CreateKey { |
| 186 |
return int(rand(10000000)); |
186 |
my ($unique_keys) = @_; |
|
|
187 |
my $max_num = 10000000; |
| 188 |
#TODO: Note this could lead to a near infinite loop |
| 189 |
while (my $value = int(rand($max_num)) ){ |
| 190 |
if ( ! $unique_keys->{$value} ){ |
| 191 |
$unique_keys->{$value} = 1; |
| 192 |
return $value; |
| 193 |
} |
| 194 |
} |
| 187 |
} |
195 |
} |
| 188 |
|
196 |
|
| 189 |
=head2 GetMandatoryFieldZ3950 |
197 |
=head2 GetMandatoryFieldZ3950 |
|
Lines 228-233
sub format_indicator {
Link Here
|
| 228 |
sub build_tabs { |
236 |
sub build_tabs { |
| 229 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
237 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
| 230 |
|
238 |
|
|
|
239 |
my $unique_keys = {}; |
| 240 |
|
| 231 |
# fill arrays |
241 |
# fill arrays |
| 232 |
my @loop_data = (); |
242 |
my @loop_data = (); |
| 233 |
my $tag; |
243 |
my $tag; |
|
Lines 279-285
sub build_tabs {
Link Here
|
| 279 |
$i++; |
289 |
$i++; |
| 280 |
next if ! $tag; |
290 |
next if ! $tag; |
| 281 |
my ($indicator1, $indicator2); |
291 |
my ($indicator1, $indicator2); |
| 282 |
my $index_tag = CreateKey; |
292 |
my $index_tag = CreateKey($unique_keys); |
| 283 |
|
293 |
|
| 284 |
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab. |
294 |
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab. |
| 285 |
# if MARC::Record is empty => use tab as master loop. |
295 |
# if MARC::Record is empty => use tab as master loop. |
|
Lines 409-415
sub build_tabs {
Link Here
|
| 409 |
important => $tagslib->{$tag}->{important}, |
419 |
important => $tagslib->{$tag}->{important}, |
| 410 |
subfield_loop => \@subfields_data, |
420 |
subfield_loop => \@subfields_data, |
| 411 |
fixedfield => $tag < 10?1:0, |
421 |
fixedfield => $tag < 10?1:0, |
| 412 |
random => CreateKey, |
422 |
random => CreateKey($unique_keys), |
| 413 |
); |
423 |
); |
| 414 |
if ($tag >= 10){ # no indicator for 00x tags |
424 |
if ($tag >= 10){ # no indicator for 00x tags |
| 415 |
$tag_data{indicator1} = format_indicator($field->indicator(1)), |
425 |
$tag_data{indicator1} = format_indicator($field->indicator(1)), |
| 416 |
- |
|
|