From 97cd6fefa37d4bd142ff30bf2977c68028926e7d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 12 Nov 2021 11:34:58 -0300 Subject: [PATCH] Bug 21105: (QA follow-up) Avoid MySQL-ism Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/OAI/Server/Identify.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Koha/OAI/Server/Identify.pm b/Koha/OAI/Server/Identify.pm index a44df73b40..b98a4c09e7 100644 --- a/Koha/OAI/Server/Identify.pm +++ b/Koha/OAI/Server/Identify.pm @@ -20,8 +20,10 @@ package Koha::OAI::Server::Identify; use Modern::Perl; + use HTTP::OAI; use C4::Context; +use Koha::DateUtils qw(dt_from_string); use base ("HTTP::OAI::Identify"); @@ -59,12 +61,12 @@ sub _get_earliest_datestamp { my $dbh = C4::Context->dbh; # We do not need to perform timezone conversion here, because the time zone # is set to UTC for the entire SQL session in Koha/OAI/Server/Repository.pm - my $query = q{ - SELECT DATE_FORMAT(MIN(timestamp), '%Y-%m-%dT%H:%i:%SZ') AS earliest + my ( $earliest ) = $dbh->selectrow_array(q{ + SELECT MIN(timestamp) AS earliest FROM biblio - }; - my ( $earliest ) = $dbh->selectrow_array($query); - return $earliest + }); + + return dt_from_string( $earliest, 'sql' )->strftime('%FT%TZ'); } 1; -- 2.39.5