From 6f756ba4e9ca93e598a2fcd7098b6498368b78b9 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 1 Dec 2017 15:51:16 +0000 Subject: [PATCH] Bug 19730: (follow-up bug 17196) Use biblio_metadata.timestamp in export_records.pl Since bug 17196, biblioitems.timestamp is not always updated after a change in the MARC record. Filtering should be based on biblio_metadata.timestamp instead. REVISED TEST PLAN ----------------- 0. Do not apply patch 1. Find a biblio record, remember the biblionumber for step 3 2. Edit the record, modify a field (e.g. 003, 015$q) that is not mapped to a DB column, so biblio_metadata.timestamp will be modified but not biblioitems.timestamp 3. In MySQL with the koha database selected: > select timestamp from biblio where biblionumber=###; > select timestamp from biblio_metadata where biblionumber=###; -- you'll need to change the ###'s based on the biblionumber you remembered in step 1. -- the two timestamps will differ. -- Remember the timestamp of biblio_metadata for step 4. 4. Run this command: $ sudo koha-shell -c bash kohadev $ export DATE="YYYY-MM-DD HH:mm:SS" -- use the timestamp remembered in step 3. 5. Run this command: $ ./misc/export_records.pl --date="$DATE" $ ls -la koha.mrc -- the file should be 0 bytes. 6. Run this command: $ exit $ git bz apply 19730 $ restart_all $ sudo koha-shell -c bash kohadev $ export DATE="YYYY-MM-DD HH:mm:SS" -- use the timestamp remembered in step 3. 7. Run this command: $ ./misc/export_records.pl --date="$DATE" $ ls -la koha.mrc -- the file should be a lot more than 0 bytes. 8. Run this command: $ /home/vagrant/qa-test-tools/koha-qa.pl -v 2 -c 1 -- this should pass. Signed-off-by: Mark Tompsett Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens (cherry picked from commit f9fa8227367d65600eca4d2dbf5e2d8c09370b81) Signed-off-by: Fridolin Somers --- misc/export_records.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/misc/export_records.pl b/misc/export_records.pl index 23cc9f1109..6e363686a3 100755 --- a/misc/export_records.pl +++ b/misc/export_records.pl @@ -104,16 +104,16 @@ if ( $record_type eq 'bibs' ) { if ( $timestamp ) { push @record_ids, $_->{biblionumber} for @{ $dbh->selectall_arrayref(q| ( - SELECT biblionumber - FROM biblioitems + SELECT biblio_metadata.biblionumber + FROM biblio_metadata LEFT JOIN items USING(biblionumber) - WHERE biblioitems.timestamp >= ? + WHERE biblio_metadata.timestamp >= ? OR items.timestamp >= ? ) UNION ( - SELECT biblionumber - FROM biblioitems + SELECT biblio_metadata.biblionumber + FROM biblio_metadata LEFT JOIN deleteditems USING(biblionumber) - WHERE biblioitems.timestamp >= ? + WHERE biblio_metadata.timestamp >= ? OR deleteditems.timestamp >= ? ) |, { Slice => {} }, ( $timestamp ) x 4 ); }; -- 2.39.5