From 1c04583f6070fe62b791188740fd9ae08daf6f90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Wed, 7 Oct 2015 20:42:23 +0200 Subject: [PATCH] Bug 14922: (followup) Fix string output This patch makes YYYY MM and DD display correctly. Signed-off-by: Hector Castro Works as advertised Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- cataloguing/additem.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 4be75f7144..19279b35c2 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -129,10 +129,11 @@ sub generate_subfield_form { if ( ! defined( $value ) || $value eq '') { $value = $subfieldlib->{defaultvalue}; # get today date & replace YYYY, MM, DD if provided in the default value - my $today = dt_from_string; - $value =~ s/YYYY/$today->year/g; - $value =~ s/MM/$today->month/g; - $value =~ s/DD/$today->day/g; + my $today_iso = output_pref( { dt=>dt_from_string, dateonly => 1, dateformat => 'iso' } ); + my ( $year, $month, $day ) = split ('-', $today_iso); + $value =~ s/YYYY/$year/g; + $value =~ s/MM/$month/g; + $value =~ s/DD/$day/g; } $subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4)); -- 2.39.5