Bug 21105: (QA follow-up) Avoid MySQL-ism

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2021-11-12 11:34:58 -03:00 committed by Kyle Hall
parent e9be169152
commit 97cd6fefa3
1 changed files with 7 additions and 5 deletions

View File

@ -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;