Bug 29135: Fix handling of deleted items in OAI-PMH provider
authorEre Maijala <ere.maijala@helsinki.fi>
Thu, 30 Sep 2021 19:53:15 +0000 (22:53 +0300)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 22 Oct 2021 13:42:08 +0000 (09:42 -0400)
commitae75b3c4b0c66c8fc95a71af99b40b17e02f91d8
treea7e24d38e325c1176bfbbaf099ee67a71a249dfa
parent663d9e3c1dce692ba8102afcffc817546dea54cc
Bug 29135: Fix handling of deleted items in OAI-PMH provider

When the OAI-PMH provider was configured to include item information
in the returned records, deleting an item would cause the record to
be reported as deleted. The provider also did some useless checks when
determining the timestamp of a deleted record. These checks only had
a performance impact.

To test:
1) Create /var/lib/koha/kohadev/OAI.yaml with:

format:
  marcxml:
    metadataPrefix: marcxml
    metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
    schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
    include_items: 1

2) Set preference OAI-PMH to Enable
3) Set preference OAI-PMH:ConfFile to /var/lib/koha/kohadev/OAI.yaml
4) Delete an item from a record
5) View the page: http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marcxml
6) Note the record is now listed as deleted
7) Run prove -v t/db_dependent/OAI/

Sponsored-by: The National Library of Finland
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/OAI/Server/GetRecord.pm
Koha/OAI/Server/ListBase.pm
t/db_dependent/OAI/Server.t
t/db_dependent/OAI/oaiconf_items.yaml [new file with mode: 0644]