Bug 20144: [sql_modes] Fix date format in tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 5 Feb 2018 18:39:49 +0000 (15:39 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 13 Feb 2018 16:58:50 +0000 (13:58 -0300)
Fix for:
Incorrect date value: '01-01-2013' for column 'startdate'
Incorrect date value: '01-01-2016' for column 'budget_period_enddate'
Incorrect date value: '30-11-2013' for column 'enddate'
Incorrect date value: '31-12-2015' for column 'budget_period_enddate'
Incorrect date value: '12-31-2015' for column 'budget_period_enddate'
Incorrect date value: '01-01-2014' for column 'entrydate'

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/Acquisition/OrderFromSubscription.t
t/db_dependent/Acquisition/OrderUsers.t
t/db_dependent/AdditionalField.t
t/db_dependent/Bookseller.t
t/db_dependent/Koha/Acquisition/Booksellers.t
t/db_dependent/Serials.t

index 874459a..cc691d0 100644 (file)
@@ -33,8 +33,8 @@ my $bookseller = Koha::Acquisition::Bookseller->new(
 my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
 my $budgetid;
 my $bpid = AddBudgetPeriod({
-    budget_period_startdate   => '01-01-2015',
-    budget_period_enddate     => '12-31-2015',
+    budget_period_startdate   => '2015-01-01',
+    budget_period_enddate     => '2015-12-31',
     budget_period_description => "budget desc"
 });
 
@@ -48,11 +48,11 @@ my $budget_id = AddBudget({
 
 my $subscriptionid = NewSubscription(
     undef,      "",     undef, undef, $budget_id, $biblionumber,
-    '01-01-2013',undef, undef, undef,  undef,
+    '2013-01-01',undef, undef, undef,  undef,
     undef,      undef,  undef, undef, undef, undef,
-    1,          "notes",undef, '01-01-2013', undef, undef,
+    1,          "notes",undef, '2013-01-01', undef, undef,
     undef,       undef,  0,    "intnotes",  0,
-    undef, undef, 0,          undef,         '31-12-2013', 0
+    undef, undef, 0,          undef,         '2013-12-31', 0
 );
 die unless $subscriptionid;
 
@@ -64,7 +64,7 @@ my $subscription = GetSubscription( $subscriptionid );
 
 my $order = Koha::Acquisition::Order->new({
     biblionumber => $subscription->{biblionumber},
-    entrydate => '01-01-2013',
+    entrydate => '2013-01-01',
     quantity => 1,
     currency => $curcode,
     listprice => $cost,
@@ -88,7 +88,7 @@ $dbh->do(q{DELETE FROM aqinvoices});
 my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $bookseller->id, unknown => "unknown");
 
 my $invoice = GetInvoice( $invoiceid );
-$invoice->{datereceived} = '02-01-2013';
+$invoice->{datereceived} = '2013-01-02';
 
 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
     {
index 610f879..2581edc 100644 (file)
@@ -49,7 +49,7 @@ my $order = Koha::Acquisition::Order->new(
         quantity         => 2,
         biblionumber     => $biblionumber,
         budget_id        => $budgetid,
-        entrydate        => '01-01-2014',
+        entrydate        => '2014-01-01',
         currency         => $currency->{currency},
         orderstatus      => 1,
         quantityreceived => 0,
index 0a56ce0..59620b8 100644 (file)
@@ -110,8 +110,8 @@ use C4::Serials::Numberpattern;
 my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
 my $budgetid;
 my $bpid = AddBudgetPeriod({
-    budget_period_startdate => '01-01-2015',
-    budget_period_enddate   => '01-01-2016',
+    budget_period_startdate => '2015-01-01',
+    budget_period_enddate   => '2016-01-01',
 });
 
 my $budget_id = AddBudget({
index c602ff4..b9de02c 100644 (file)
@@ -189,9 +189,9 @@ is( $bookseller1fromid->subscriptions->count,
 
 my $id_subscription1 = NewSubscription(
     undef,      'BRANCH2',     $id_supplier1, undef, $id_budget, $biblionumber,
-    '01-01-2013',undef, undef, undef,  undef,
+    '2013-01-01',undef, undef, undef,  undef,
     undef,      undef,  undef, undef, undef, undef,
-    1,          "subscription notes",undef, '01-01-2013', undef, undef,
+    1,          "subscription notes",undef, '2013-01-01', undef, undef,
     undef, 'CALL ABC',  0,    "intnotes",  0,
     undef, undef, 0,          undef,         '2013-11-30', 0
 );
@@ -201,9 +201,9 @@ is($subscriptions[0]->{publicnotes}, 'subscription notes', 'subscription search
 
 my $id_subscription2 = NewSubscription(
     undef,      'BRANCH2',     $id_supplier1, undef, $id_budget, $biblionumber,
-    '01-01-2013',undef, undef, undef,  undef,
+    '2013-01-01',undef, undef, undef,  undef,
     undef,      undef,  undef, undef, undef, undef,
-    1,          "subscription notes",undef, '01-01-2013', undef, undef,
+    1,          "subscription notes",undef, '2013-01-01', undef, undef,
     undef, 'CALL DEF',  0,    "intnotes",  0,
     undef, undef, 0,          undef,         '2013-07-31', 0
 );
@@ -330,9 +330,9 @@ ModBasket($basket4info);
 #Add 1 subscription
 my $id_subscription3 = NewSubscription(
     undef,      "BRANCH1",     $id_supplier1, undef, $id_budget, $biblionumber,
-    '01-01-2013',undef, undef, undef,  undef,
+    '2013-01-01',undef, undef, undef,  undef,
     undef,      undef,  undef, undef, undef, undef,
-    1,          "subscription notes",undef, '01-01-2013', undef, undef,
+    1,          "subscription notes",undef, '2013-01-01', undef, undef,
     undef,       undef,  0,    "intnotes",  0,
     undef, undef, 0,          'LOCA',         '2013-12-31', 0
 );
@@ -355,7 +355,7 @@ my $order1 = Koha::Acquisition::Order->new(
         quantity         => 24,
         biblionumber     => $biblionumber,
         budget_id        => $id_budget,
-        entrydate        => '01-01-2013',
+        entrydate        => '2013-01-01',
         currency         => $curcode,
         notes            => "This is a note1",
         tax_rate          => 0.0500,
@@ -364,7 +364,7 @@ my $order1 = Koha::Acquisition::Order->new(
         quantityreceived => 2,
         rrp              => 10,
         ecost            => 10,
-        datereceived     => '01-06-2013'
+        datereceived     => '2013-06-01'
     }
 )->store;
 my $ordernumber1 = $order1->ordernumber;
@@ -375,7 +375,7 @@ my $order2 = Koha::Acquisition::Order->new(
         quantity       => 20,
         biblionumber   => $biblionumber,
         budget_id      => $id_budget,
-        entrydate      => '01-01-2013',
+        entrydate      => '2013-01-01',
         currency       => $curcode,
         notes          => "This is a note2",
         tax_rate        => 0.0500,
@@ -393,7 +393,7 @@ my $order3 = Koha::Acquisition::Order->new(
         quantity       => 20,
         biblionumber   => $biblionumber,
         budget_id      => $id_budget,
-        entrydate      => '02-02-2013',
+        entrydate      => '2013-02-02',
         currency       => $curcode,
         notes          => "This is a note3",
         tax_rate        => 0.0500,
@@ -411,7 +411,7 @@ my $order4 = Koha::Acquisition::Order->new(
         quantity         => 20,
         biblionumber     => $biblionumber,
         budget_id        => $id_budget,
-        entrydate        => '02-02-2013',
+        entrydate        => '2013-02-02',
         currency         => $curcode,
         notes            => "This is a note3",
         tax_rate          => 0.0500,
index 31342e0..010993e 100644 (file)
@@ -110,11 +110,11 @@ subtest '->subscriptions() tests' => sub {
     # Add two subscriptions
     my $subscription_1_id = NewSubscription(
         undef,        'BRANCH2',     $vendor->id,          undef,
-        $id_budget,   $biblionumber, '01-01-2013',         undef,
+        $id_budget,   $biblionumber, '2013-01-01',         undef,
         undef,        undef,         undef,                undef,
         undef,        undef,         undef,                undef,
         undef,        1,             "subscription notes", undef,
-        '01-01-2013', undef,         undef,                undef,
+        '2013-01-01', undef,         undef,                undef,
         'CALL ABC',   0,             "intnotes",           0,
         undef,        undef,         0,                    undef,
         '2013-11-30', 0
@@ -128,11 +128,11 @@ subtest '->subscriptions() tests' => sub {
 
     my $id_subscription2 = NewSubscription(
         undef,        'BRANCH2',     $vendor->id,          undef,
-        $id_budget,   $biblionumber, '01-01-2013',         undef,
+        $id_budget,   $biblionumber, '2013-01-01',         undef,
         undef,        undef,         undef,                undef,
         undef,        undef,         undef,                undef,
         undef,        1,             "subscription notes", undef,
-        '01-01-2013', undef,         undef,                undef,
+        '2013-01-01', undef,         undef,                undef,
         'CALL DEF',   0,             "intnotes",           0,
         undef,        undef,         0,                    undef,
         '2013-07-31', 0
index de623fe..83d8b98 100755 (executable)
@@ -51,8 +51,8 @@ my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
 
 my $budgetid;
 my $bpid = AddBudgetPeriod({
-    budget_period_startdate   => '01-01-2015',
-    budget_period_enddate     => '31-12-2015',
+    budget_period_startdate   => '2015-01-01',
+    budget_period_enddate     => '2015-12-31',
     budget_period_description => "budget desc"
 });