Bugzilla – Attachment 59577 Details for
Bug 17922
Default value substitution for month and day should be fixed length
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17922: Use correct number of digits when replacing date placeholders
Bug-17922-Use-correct-number-of-digits-when-replac.patch (text/plain), 2.20 KB, created by
Jonathan Druart
on 2017-01-26 11:54:12 UTC
(
hide
)
Description:
Bug 17922: Use correct number of digits when replacing date placeholders
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-26 11:54:12 UTC
Size:
2.20 KB
patch
obsolete
>From e1b3e1b69773e1c4bc8e8bb304c008ce91f74552 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >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 ("<<MM><" should be "<<MM>>") > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > 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 <<YYYY>>, <<MM>>, <<DD>> 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/<<YYYY>>/$year/g; > $value =~ s/<<MM>>/$month/g; > $value =~ s/<<DD>>/$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 <<YYYY>>, <<MM>>, <<DD>> 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/<<YYYY>>/$year/g; >- $value =~ s/<<MM></$month/g; >+ $value =~ s/<<MM>>/$month/g; > $value =~ s/<<DD>>/$day/g; > # And <<USER>> with surname (?) > my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17922
:
59151
|
59373
| 59577