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)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 12 Oct 2021 08:14:29 +0000 (10:14 +0200)
commit155c3f18244a415812346127304493ec20165ecc
treeacfd87d5102cd6dc4efab48f201d731682347bc9
parentf6d013efad595a5c434a4d0f85a7854be83fcbe9
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>
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]