From 451c89cc7dbb34dd42c2713ebbb9a96f02dacecb Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 12 May 2015 17:49:04 +0200 Subject: [PATCH] Bug 13437: Preliminary changes for marc21 plugins field 008 Content-Type: text/plain; charset=utf-8 Preliminary work on marc21_field_008.pl and 008_authorities.pl. Moving $dateentered en $defaultval to lower scope level. Test plan: Use both plugins in the marc21 editor (biblios/authorities). --- cataloguing/value_builder/marc21_field_008.pl | 15 +++++++++------ .../value_builder/marc21_field_008_authorities.pl | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl index cc2d28d..e3de19c 100755 --- a/cataloguing/value_builder/marc21_field_008.pl +++ b/cataloguing/value_builder/marc21_field_008.pl @@ -34,12 +34,13 @@ plugin_parameters : other parameters added when the plugin is called by the dopo =cut -# find today's date -my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); - -$year += 1900; -$mon += 1; -my $dateentered = substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday); +sub date_entered { + # find today's date + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); + $year += 1900; + $mon += 1; + return substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday); +} sub plugin_javascript { my $lang = C4::Context->preference('DefaultLanguageField008' ); @@ -48,6 +49,7 @@ sub plugin_javascript { my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; my $function_name = $field_number; + my $dateentered = date_entered(); my $res = "