From 6d91e791cdf8520a4d16c1b9d35e956ade700741 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Mon, 8 Jun 2015 15:33:24 +0200 Subject: [PATCH] Bug 3206: (QA followup) OAI repository deleted records support. - Fix QA. Signed-off-by: Bernardo Gonzalez Kriegel New pref in right order, new option 'no' on syspref, other fixes following comment #12 All seems to work No errors Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/sysprefs.sql | 4 +-- .../admin/preferences/web_services.pref | 1 + opac/oai.pl | 28 ++++++++----------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f7ea475799..31bd6396ab 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -232,6 +232,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OAI-PMH:archiveID','KOHA-OAI-TEST',NULL,'OAI-PMH archive identification','Free'), ('OAI-PMH:AutoUpdateSets','0','','Automatically update OAI sets when a bibliographic record is created or updated','YesNo'), ('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'), +('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent), might be deleted (transient), or will never have any data in it (no)','transient|persistent|no','Choice') ('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'), ('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'), ('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'), @@ -480,6 +481,5 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'), ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), -('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent) or might be deleted (transient)','transient|persistent','Choice') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref index 518dfbd115..ee6598040f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref @@ -33,6 +33,7 @@ Web services: choices: persistent: will never be emptied or truncated (persistent) transient: might be emptied or truncated at some point (transient) + no: will never have any data in it (no) - "." ILS-DI: - diff --git a/opac/oai.pl b/opac/oai.pl index 82af58c394..ab56d791d6 100755 --- a/opac/oai.pl +++ b/opac/oai.pl @@ -254,8 +254,7 @@ sub new { package C4::OAI::DeletedRecord; -use strict; -use warnings; +use Modern::Perl; use HTTP::OAI; use HTTP::OAI::Metadata::OAI_DC; @@ -300,23 +299,20 @@ sub new { my $self = HTTP::OAI::GetRecord->new(%args); my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare(" - SELECT marcxml, timestamp - FROM biblioitems - WHERE biblionumber=? " ); my $prefix = $repository->{koha_identifier} . ':'; my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; - $sth->execute( $biblionumber ); my ($marcxml, $timestamp); my $deleted = 0; - unless ( ($marcxml, $timestamp) = $sth->fetchrow ) { - $sth = $dbh->prepare(" - SELECT biblionumber, timestamp - FROM deletedbiblio - WHERE biblionumber=? " ); - $sth->execute( $biblionumber ); + unless ( ($marcxml, $timestamp) = $dbh->selectrow_array(q/ + SELECT marcxml, timestamp + FROM biblioitems + WHERE biblionumber=? /, undef, $biblionumber)) { + + unless ( ($marcxml, $timestamp) = $dbh->selectrow_array(q/ + SELECT biblionumber, timestamp + FROM deletedbiblio + WHERE biblionumber=? /, undef, $biblionumber )) { - unless ( ($marcxml, $timestamp) = $sth->fetchrow ) { return HTTP::OAI::Response->new( requestURL => $repository->self_url(), @@ -370,7 +366,7 @@ sub new { } my $max = $repository->{koha_max_count}; my $sql = " - (SELECT biblioitems.biblionumber, timestamp + (SELECT biblioitems.biblionumber, biblioitems.timestamp FROM biblioitems "; $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; @@ -535,7 +531,7 @@ sub new { } my $max = $repository->{koha_max_count}; my $sql = " - (SELECT biblioitems.biblionumber, marcxml, timestamp + (SELECT biblioitems.biblionumber, biblioitems.marcxml, biblioitems.timestamp FROM biblioitems "; $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; -- 2.39.5