Bug 3206: (QA followup) OAI repository deleted records support.
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Mon, 8 Jun 2015 13:33:24 +0000 (15:33 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 8 Jul 2015 17:55:17 +0000 (14:55 -0300)
 - Fix QA.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
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 <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref
opac/oai.pl

index f7ea475..31bd639 100644 (file)
@@ -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')
 ;
index 518dfbd..ee65980 100644 (file)
@@ -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:
         -
index 82af58c..ab56d79 100755 (executable)
@@ -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;