Bug 36201 - Add -days_old and -months_old arguments for misc/export_records.pl
Summary: Add -days_old and -months_old arguments for misc/export_records.pl
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Alex Buckley
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-29 03:32 UTC by Alex Buckley
Modified: 2024-05-09 13:57 UTC (History)
2 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 36201: Add -days_old and -months_old arguments to misc/export_records.pl (7.96 KB, patch)
2024-02-29 03:57 UTC, Alex Buckley
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2024-02-29 03:32:14 UTC
It would be nice if libraries could use misc/export_records.pl as a cronjob to run on the first day of every month to export all new biblio records added in the last month: by using new -days_old=31 or -months_old=1 arguments for the export_records.pl script to limit on the biblio.datecreated. 

A use case for this would be those libraries which need to keep a union catalogue up to date with their local Koha catalogue. By providing the union catalogue provider with a MARC file of all biblio additions in the last month.
Comment 1 Alex Buckley 2024-02-29 03:57:46 UTC
Created attachment 162575 [details] [review]
Bug 36201: Add -days_old and -months_old arguments to misc/export_records.pl

Limit exported records based on the biblio.datecreated using the
-days_old and -months_old arguments.

Test plan:
1. Remove all biblios in your Koha catalogue, then create 10 bibliographic records - in the Koha database set 6 of the biblios to have a biblio.datecreated 50 days ago

2. Apply patches and restart services

3. In koha-shell run the following command:
perl misc/export_records.pl  --months_old=1 --format=marc --record-type=bibs --filename=/tmp/test.mrc

4. Check the /tmp/test.mrc and confirm it has 4 biblios in it

5. In the koha-shell run the following command:
perl misc/export_records.pl  --days_old=31 --format=marc --record-type=bibs --filename=/tmp/test2.mrc

6. Check the /tmp/test2.mrc and confirm it also has 4 biblios in it

7. In the koha-shell run the following command:
perl misc/export_records.pl  --days_old=52 --format=marc --record-type=bibs --filename=/tmp/test3.mrc

8. Check the /tmp/test3.mrc and confirm it has 10 biblios in it

9. In the koha-shell run the following command:
perl misc/export_records.pl  --format=marc --record-type=bibs --filename=/tmp/all.mrc

10. Check the /tmp/all.mrc and confirm it also has 10 biblios in it

11. Try running the export_records.pl script with a variety of other
arguments and confirm it works as expected

Sponsored-By: Department of Corrections, New Zealand
Comment 2 Alex Buckley 2024-02-29 04:15:19 UTC
Ready to test