Bugzilla – Attachment 126238 Details for
Bug 29157
Cannot set date/date-time attributes to NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29157: Date and Datetime attributes cannot be set NULL
Bug-29157-Date-and-Datetime-attributes-cannot-be-s.patch (text/plain), 1.64 KB, created by
Joonas Kylmälä
on 2021-10-13 21:00:03 UTC
(
hide
)
Description:
Bug 29157: Date and Datetime attributes cannot be set NULL
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-10-13 21:00:03 UTC
Size:
1.64 KB
patch
obsolete
>From e0032f847b23f65feb0d70bcdf7a731e54f6fd0a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 7 Oct 2021 15:28:40 -0300 >Subject: [PATCH] Bug 29157: Date and Datetime attributes cannot be set NULL >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch makes Koha::Object->attribute_from_api allow setting >attributes the undef value. The original implementation passed the value >directly to dt_from_string, which made the attribute be set the current >date. > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t \ > t/db_dependent/api/v1/patrons.t >=> FAIL: Tests fail! Our code is buggy! >3. Apply this patch >4. Repeat 2 >=> SUCCESS! Fix fixed this thing! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Eric Phetteplace <phette23@gmail.com> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >--- > Koha/Object.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 6f55c3b486..c7ba4704f3 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -709,7 +709,8 @@ sub attributes_from_api { > } > elsif ( _date_or_datetime_column_type( $columns_info->{$koha_field_name}->{data_type} ) ) { > try { >- $value = dt_from_string($value, 'rfc3339'); >+ $value = dt_from_string($value, 'rfc3339') >+ if defined $value; > } > catch { > Koha::Exceptions::BadParameter->throw( parameter => $key ); >-- >2.20.1
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 29157
:
125644
|
125909
|
125910
|
125994
|
125995
|
126128
|
126129
|
126220
|
126221
|
126237
| 126238