Bug 20144: [sql_modes] Set value for pending_offline_operations.timestamp
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 6 Feb 2018 15:51:19 +0000 (12:51 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 13 Feb 2018 16:58:59 +0000 (13:58 -0300)
Not null

Fix for:
Incorrect datetime value: 'null' for column 'timestamp'

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Circulation/OfflineOperation.t

index 387ae64..c50524d 100644 (file)
@@ -2,6 +2,8 @@
 
 use Modern::Perl;
 use C4::Circulation;
+
+use Koha::DateUtils qw( dt_from_string output_pref );
 use Koha::Library;
 
 use Test::More tests => 7;
@@ -51,12 +53,14 @@ my $samplebranch1 = {
 };
 Koha::Library->new($samplebranch1)->store;
 
+my $now = dt_from_string->truncate( to => 'minute' );
+
 #Begin Tests
 #Test AddOfflineOperation
 is(
     AddOfflineOperation(
         'User1', $samplebranch1->{branchcode},
-        'null', 'Action1', 'CODE', 'Cardnumber1', 10
+        $now, 'Action1', 'CODE', 'Cardnumber1', 10
     ),
     'Added.',
     "OfflineOperation has been added"
@@ -71,7 +75,8 @@ is_deeply(
         operationid => $offline_id,
         userid      => 'User1',
         branchcode  => $samplebranch1->{branchcode},
-        timestamp   => "0000-00-00 00:00:00",
+        # FIXME sounds like we need a 'timestamp' dateformat
+        timestamp   => output_pref({ dt => $now, dateformat => 'iso', dateonly => 0 }) . ':00',
         action      => 'Action1',
         barcode     => 'CODE',
         cardnumber  => 'Cardnumber1',