Bug 23696: take deleted biblios into account when building oai sets
authorJosef Moravec <josef.moravec@gmail.com>
Mon, 30 Sep 2019 09:28:40 +0000 (09:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 24 Jul 2020 12:09:30 +0000 (14:09 +0200)
Test plan:
0) do not apply the patch
1) set up OAI and create at least one set
2) run build_oai_sets.pl
3) remember/write down number of records added
4) delete a biblio, the is included in set
5) run buid_oai_sets.pl again
6) the set is 1 record smaller
7) apply the patch
8) run build_oai_sets.pl
9) the number of record should be the same as in 3)

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

misc/migration_tools/build_oai_sets.pl

index 64addad..c7b73a2 100755 (executable)
@@ -75,6 +75,11 @@ my $query = qq{
     FROM biblio_metadata
     WHERE format='marcxml'
     AND  `schema` = ?
+    UNION
+    SELECT biblionumber, metadata
+    FROM deletedbiblio_metadata
+    WHERE format='marcxml'
+    AND  `schema` = ?
 };
 if($length) {
     $query .= "LIMIT $length";
@@ -83,7 +88,7 @@ if($length) {
     }
 }
 my $sth = $dbh->prepare($query);
-$sth->execute( C4::Context->preference('marcflavour') );
+$sth->execute( C4::Context->preference('marcflavour'), C4::Context->preference('marcflavour'));
 my $results = $sth->fetchall_arrayref({});
 print "done.\n" if $verbose;