Bug 29157: Date and Datetime attributes cannot be set NULL
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> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
9a8563d074
commit
868e02bfab
1 changed files with 2 additions and 1 deletions
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue