Bug 21600: /patrons should have timestamp/datetime values converted from rfc3339...
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 18 Oct 2018 18:50:27 +0000 (15:50 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 5 Nov 2018 14:46:13 +0000 (14:46 +0000)
commitdd2c6e4c69ef411a05170abfe92ed60668ac7532
tree9391e05b706e3d1dea6f399914b5c1a3064f94ef
parent2d9f2739e953b36d6b48096644d8967018a6f90f
Bug 21600: /patrons should have timestamp/datetime values converted from rfc3339 into valid MySQL values

Bug 21597 enabled the option so set strict SQL modes in koha-conf.xml to
be able to improve Koha's comformance to current standards on DB
engines.

This causes lots of parts of Koha to fail because they rely on MySQL
fallbacks that are no longer default behaviours.

While we can workaround this by setting SQL modes on runtime, the
decision has been that this needs fixing.

This patch deals with the /patrons API failing to correctly convert
datetimes into valid SQL timestamps.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass
- Add <strict_sql_modes>1</strict_sql_modes> on your koha-conf.xml
  $ sudo vim /etc/koha/sites/kohadev/koha-conf.xml
- Restart memcached and Plack:
  $ restart_all
- Run:
 k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail due to updated_on and/or lastseen fields wrong
format (MySQL error)
- Apply this patch
- Run:
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass! It all makes sense!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 13b8e95f218924cc1ec41e2570791980bd7bcf17)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1/Patrons.pm