From ab135c07aab4229fbf02916683cfa10c06044e2d 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 (cherry picked from commit 95e94766af653de4bc721af64981140cacecf567) Signed-off-by: Katrin Fischer (cherry picked from commit fdf1f974770247dc4b8decfb3318e31b940be48d) Signed-off-by: Julian Maurice --- 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 7cddb2f6e1..2267bd5dea 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -296,9 +296,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 b9e44c404e..9fd8c9c643 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