|
Lines 23-28
use Modern::Perl;
Link Here
|
| 23 |
use CGI; |
23 |
use CGI; |
| 24 |
use POSIX qw( strftime ); |
24 |
use POSIX qw( strftime ); |
| 25 |
use Try::Tiny qw(catch try); |
25 |
use Try::Tiny qw(catch try); |
|
|
26 |
use UUID; |
| 26 |
|
27 |
|
| 27 |
use C4::Output qw( output_html_with_http_headers ); |
28 |
use C4::Output qw( output_html_with_http_headers ); |
| 28 |
use C4::Auth qw( get_template_and_user haspermission ); |
29 |
use C4::Auth qw( get_template_and_user haspermission ); |
|
Lines 183-197
sub MARCfindbreeding {
Link Here
|
| 183 |
=cut |
184 |
=cut |
| 184 |
|
185 |
|
| 185 |
sub CreateKey { |
186 |
sub CreateKey { |
| 186 |
my ($unique_keys) = @_; |
187 |
my ($uuid, $key); |
| 187 |
my $max_num = 10000000; |
188 |
UUID::generate($uuid); |
| 188 |
#TODO: Note this could lead to a near infinite loop |
189 |
UUID::unparse($uuid, $key); |
| 189 |
while (my $value = int(rand($max_num)) ){ |
190 |
return $key; |
| 190 |
if ( ! $unique_keys->{$value} ){ |
|
|
| 191 |
$unique_keys->{$value} = 1; |
| 192 |
return $value; |
| 193 |
} |
| 194 |
} |
| 195 |
} |
191 |
} |
| 196 |
|
192 |
|
| 197 |
=head2 GetMandatoryFieldZ3950 |
193 |
=head2 GetMandatoryFieldZ3950 |
|
Lines 236-243
sub format_indicator {
Link Here
|
| 236 |
sub build_tabs { |
232 |
sub build_tabs { |
| 237 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
233 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
| 238 |
|
234 |
|
| 239 |
my $unique_keys = {}; |
|
|
| 240 |
|
| 241 |
# fill arrays |
235 |
# fill arrays |
| 242 |
my @loop_data = (); |
236 |
my @loop_data = (); |
| 243 |
my $tag; |
237 |
my $tag; |
|
Lines 423-429
sub build_tabs {
Link Here
|
| 423 |
important => $tagslib->{$tag}->{important}, |
417 |
important => $tagslib->{$tag}->{important}, |
| 424 |
subfield_loop => \@subfields_data, |
418 |
subfield_loop => \@subfields_data, |
| 425 |
fixedfield => $tag < 10?1:0, |
419 |
fixedfield => $tag < 10?1:0, |
| 426 |
random => CreateKey($unique_keys), |
420 |
random => CreateKey(), |
| 427 |
); |
421 |
); |
| 428 |
if ($tag >= 10){ # no indicator for 00x tags |
422 |
if ($tag >= 10){ # no indicator for 00x tags |
| 429 |
$tag_data{indicator1} = format_indicator($field->indicator(1)), |
423 |
$tag_data{indicator1} = format_indicator($field->indicator(1)), |