From e1b3e1b69773e1c4bc8e8bb304c008ce91f74552 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 --- 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 1929d0c..54950a5 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 9f0f146..5d8c0d0 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.9.3