Bug 23893: No special care for booleans
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Dec 2019 14:21:27 +0000 (15:21 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 8 Jan 2020 14:38:43 +0000 (14:38 +0000)
Tests pass without that changes. If we need them they should be at
Koha::Object anyway.

About the date, I also think that that should be moved to Koha::Object
(we can guess it, like we do in Koha::Object->store, retrieve the
datatype and adjust). Also we can send a DT object to DBIC, no need for
an sql formatted date

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Patron.pm

index b0bfebc..444fd2b 100644 (file)
@@ -1574,20 +1574,12 @@ sub attributes_from_api {
 
     $attrs = $self->SUPER::attributes_from_api( $attrs );
 
-    if ( exists $attrs->{lost} ) {
-        $attrs->{lost} = ($attrs->{lost}) ? 1 : 0;
-    }
-
-    if ( exists $attrs->{ gonenoaddress} ) {
-        $attrs->{gonenoaddress} = ($attrs->{gonenoaddress}) ? 1 : 0;
-    }
-
     if ( exists $attrs->{lastseen} ) {
-        $attrs->{lastseen} = output_pref({ str => $attrs->{lastseen}, dateformat => 'sql' });
+        $attrs->{lastseen} = dt_from_string($attrs->{lastseen});
     }
 
     if ( exists $attrs->{updated_on} ) {
-        $attrs->{updated_on} = output_pref({ str => $attrs->{updated_on}, dateformat => 'sql' });
+        $attrs->{updated_on} = dt_from_string($attrs->{updated_on});
     }
 
     return $attrs;