From 95e94766af653de4bc721af64981140cacecf567 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 18 Jan 2017 11:29:57 +0100 Subject: [PATCH] Bug 17922: Use correct number of digits when replacing date placeholders This patch also fixes a typo ("<<" should be "<>") Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- cataloguing/addbiblio.pl | 6 +++--- cataloguing/additem.pl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 1929d0c5bc..54950a57de 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -293,9 +293,9 @@ sub create_input { # get today date & replace <>, <>, <
> if provided in the default value my $today_dt = dt_from_string; - my $year = $today_dt->year; - my $month = $today_dt->month; - my $day = $today_dt->day; + my $year = $today_dt->strftime('%Y'); + my $month = $today_dt->strftime('%m'); + my $day = $today_dt->strftime('%d'); $value =~ s/<>/$year/g; $value =~ s/<>/$month/g; $value =~ s/<
>/$day/g; diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 9f0f146b48..5d8c0d085c 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -130,11 +130,11 @@ sub generate_subfield_form { $value = $subfieldlib->{defaultvalue}; # get today date & replace <>, <>, <
> if provided in the default value my $today_dt = dt_from_string; - my $year = $today_dt->year; - my $month = $today_dt->month; - my $day = $today_dt->day; + my $year = $today_dt->strftime('%Y'); + my $month = $today_dt->strftime('%m'); + my $day = $today_dt->strftime('%d'); $value =~ s/<>/$year/g; - $value =~ s/<>/$month/g; $value =~ s/<
>/$day/g; # And <> with surname (?) my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); -- 2.39.5