From 9c2d393c9cbbff2846a3fec705e4bb2d868f5f00 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Tue, 6 Apr 2021 11:24:51 +0000
Subject: [PATCH] Bug 21106: Fix Identify and ListMetadata formats complaints

Validation complains of:
wrong URL in Identify
Wrong links in the second
---
 Koha/OAI/Server/Identify.pm            | 4 ++--
 Koha/OAI/Server/ListMetadataFormats.pm | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Koha/OAI/Server/Identify.pm b/Koha/OAI/Server/Identify.pm
index dc1a53086a..547e535872 100644
--- a/Koha/OAI/Server/Identify.pm
+++ b/Koha/OAI/Server/Identify.pm
@@ -28,7 +28,7 @@ use base ("HTTP::OAI::Identify");
 sub new {
     my ($class, $repository) = @_;
 
-    my ($baseURL) = $repository->self_url() =~ /(.*)\?.*/;
+    my ($baseURL) = C4::Context->preference('OPACBaseURL') . '/cgi-bin/koha/oai.pl';
     my $self = $class->SUPER::new(
         baseURL             => $baseURL,
         repositoryName      => C4::Context->preference("LibraryName"),
@@ -54,7 +54,7 @@ sub new {
 # will be returned and we will report the fallback 0001-01-01.
 sub _get_earliest_datestamp {
     my $dbh = C4::Context->dbh;
-    my ( $earliest ) = $dbh->selectrow_array("SELECT MIN(timestamp) AS earliest FROM biblio" );
+    my ( $earliest ) = $dbh->selectrow_array("SELECT DATE_FORMAT(MIN(timestamp),'%Y-%m-%dT%H:%i:%sZ') AS earliest FROM biblio" );
     return $earliest
 }
 
diff --git a/Koha/OAI/Server/ListMetadataFormats.pm b/Koha/OAI/Server/ListMetadataFormats.pm
index f6849cdde0..6cbf324b91 100644
--- a/Koha/OAI/Server/ListMetadataFormats.pm
+++ b/Koha/OAI/Server/ListMetadataFormats.pm
@@ -47,12 +47,12 @@ sub new {
         $self->metadataFormat( HTTP::OAI::MetadataFormat->new(
             metadataPrefix    => 'marc21',
             schema            => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
-            metadataNamespace => 'http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim'
+            metadataNamespace => 'http://www.loc.gov/MARC21/slim'
         ) );
         $self->metadataFormat( HTTP::OAI::MetadataFormat->new(
             metadataPrefix    => 'marcxml',
             schema            => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
-            metadataNamespace => 'http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim'
+            metadataNamespace => 'http://www.loc.gov/MARC21/slim'
         ) );
     }
 
-- 
2.11.0