Bug 19730

Summary: misc/export_records.pl should use biblio_metadata.timestamp
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Command-line UtilitiesAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, m.de.rooy, nick, robin
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19724    
Bug Blocks:    
Attachments: Bug 19730: Use biblio_metadata.timestamp in export_records.pl
Bug 19730: Use biblio_metadata.timestamp in export_records.pl
Bug 19730: Use biblio_metadata.timestamp in export_records.pl
Bug 19730: Use biblio_metadata.timestamp in export_records.pl

Description Julian Maurice 2017-12-01 15:50:55 UTC
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.
Comment 1 Julian Maurice 2017-12-01 16:16:41 UTC
Created attachment 69440 [details] [review]
Bug 19730: 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.

Test plan:
0. Do not apply patch
1. Run export DATE="$(date '+%F %T')"
2. Edit a biblio record, modify a field that is not mapped to a DB
   column, so biblio_metadata.timestamp will be modified but not
   biblioitems.timestamp
3. Run misc/export_records.pl --date="$DATE"
4. Verify that koha.mrc is empty
5. Apply patch
6. Run misc/export_records.pl --date="$DATE"
7. Verify koha.mrc contains the record you modified
Comment 2 Mark Tompsett 2018-01-23 17:14:18 UTC
Created attachment 70851 [details] [review]
Bug 19730: 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) 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
   $ 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 <mtompset@hotmail.com>
Comment 3 Mark Tompsett 2018-01-23 18:23:16 UTC
Created attachment 70852 [details] [review]
Bug 19730: 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 <mtompset@hotmail.com>
Comment 4 Marcel de Rooy 2018-01-26 07:24:21 UTC
Created attachment 70932 [details] [review]
Bug 19730: 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 <mtompset@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Jonathan Druart 2018-02-02 15:11:16 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 6 Nick Clemens 2018-02-16 02:29:01 UTC
Awesome work all, pushed to stable for 17.11.03
Comment 7 Fridolin Somers 2018-02-19 13:02:21 UTC
Pushed to 17.05.x for v17.05.09