From 4e47063f3544071682816bd2df740be7f455c998 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Fri, 23 Mar 2018 17:32:30 +0100 Subject: [PATCH] Bug 20485: Don't account for items timestamps when items not included If combining "--dont_export_items" and "--date" options in export_records.pl, don't include items modification/deletion i in biblio query conditions. How to test: 1) Delete or modify a biblio item. 2) Run export_records.pl with "--dont_export_items" and "--date" options with a date value before item was deleted or modified, but after the biblio was modified. 3) The biblio for which an item was changed should not be included in the export. --- misc/export_records.pl | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/misc/export_records.pl b/misc/export_records.pl index 23cc9f1109..53b8d5e884 100755 --- a/misc/export_records.pl +++ b/misc/export_records.pl @@ -102,21 +102,31 @@ $timestamp = ($timestamp) ? output_pref({ dt => dt_from_string($timestamp), date if ( $record_type eq 'bibs' ) { if ( $timestamp ) { - push @record_ids, $_->{biblionumber} for @{ - $dbh->selectall_arrayref(q| ( - SELECT biblionumber - FROM biblioitems - LEFT JOIN items USING(biblionumber) - WHERE biblioitems.timestamp >= ? - OR items.timestamp >= ? - ) UNION ( - SELECT biblionumber - FROM biblioitems - LEFT JOIN deleteditems USING(biblionumber) - WHERE biblioitems.timestamp >= ? - OR deleteditems.timestamp >= ? - ) |, { Slice => {} }, ( $timestamp ) x 4 ); - }; + if ($dont_export_items) { + push @record_ids, $_->{biblionumber} for @{ + $dbh->selectall_arrayref(q| ( + SELECT biblionumber + FROM biblioitems + LEFT JOIN items USING(biblionumber) + WHERE biblioitems.timestamp >= ? + OR items.timestamp >= ? + ) UNION ( + SELECT biblionumber + FROM biblioitems + LEFT JOIN deleteditems USING(biblionumber) + WHERE biblioitems.timestamp >= ? + OR deleteditems.timestamp >= ? + ) |, { Slice => {} }, ( $timestamp ) x 4 ); + }; + } else { + push @record_ids, $_->{biblionumber} for @{ + $dbh->selectall_arrayref(q| ( + SELECT biblionumber + FROM biblioitems + WHERE biblioitems.timestamp >= ? + ) |, { Slice => {} }, $timestamp ); + }; + } } else { my $conditions = { ( $starting_biblionumber or $ending_biblionumber ) -- 2.11.0