Bug 36770 - Add a reportID parameter to export_records.pl
Summary: Add a reportID parameter to export_records.pl
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Alex Buckley
QA Contact: Kyle M Hall
URL:
Keywords: release-notes-needed
Depends on:
Blocks:
 
Reported: 2024-05-02 22:16 UTC by Alex Buckley
Modified: 2024-08-11 20:42 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:
24.11.00
Circulation function:


Attachments
Bug 36770: WIP Enable export_records.pl to use report output (3.77 KB, patch)
2024-05-05 19:45 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 36770: Export records using a report (7.05 KB, patch)
2024-05-07 19:27 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 36770: Export records using a report (7.10 KB, patch)
2024-05-08 20:04 UTC, Alexandre Noel
Details | Diff | Splinter Review
Bug 36770: Export records using a report (7.16 KB, patch)
2024-07-19 16:12 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 36770: (QA follow-up) Tidy export_records.pl (9.94 KB, patch)
2024-07-19 16:12 UTC, Kyle M Hall
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-05-02 22:16:57 UTC
It would be nice to be able to export reports from the export_records.pl command-line utility using a report.

Adding a reportID parameter to the export_records.pl script would enable libraries to have greater control over what records are exported.
Comment 1 Alex Buckley 2024-05-05 19:45:04 UTC
Created attachment 166170 [details] [review]
Bug 36770: WIP Enable export_records.pl to use report output
Comment 2 Alex Buckley 2024-05-07 19:27:38 UTC
Created attachment 166347 [details] [review]
Bug 36770: Export records using a report

Enable the export_records.pl script use a report output to export biblios or authorities

Test plan:
1. Apply patches and restart services
2. Create a SQL report (id=1)
    SELECT biblionumber
    FROM biblio
3. Create a SQL report (id=2) and set an item as notforloan = -1
    SELECT title, author, biblio.biblionumber
    FROM biblio
    LEFT JOIN items USING (biblionumber)
    WHERE items.notforloan = <<Not for loan|NOT_LOAN>>
4. Create a SQL report (id=3)
    SELECT title, author
    FROM biblio
5. Create a SQL report (id=4)
    SELECT authid
    FROM auth_header
6. Run export_records.pl using report id=1 and confirm a koha.mrc file is created in the misc directory:
cd misc
./export_records.pl --report_id=1

7. Delete the koha.mrc file

8. Run export_records.pl using report id=2
./export_records.pl --report_id=2

9. Notice you are prompted to supply a parameter

10. Re-run report id=2 supplying a parameter. Confirm the koha.mrc file is created and contains bib data
./export_records.pl --report_id=2 --report_param=-1

11. Run export_records.pl using report id=3
./export_records.pl --report_id=3

12. Notice you get the message: The --report_id you specified does not fetch a biblionumber

13. Delete the koha.mrc file

14. Run export_records.pl using report id=4
./export_records.pl --report_id=4

15. Notice you get a message 'The --report_id you specified does not fetch a biblionumber'

16. Re-run export_records.pl setting the record-type=auths
./export_records.pl --record-type=auths --report_id=4

17. Notice the koha.mrc file is generated and contains auth data

Sponsored-by: Horowhenua Libraries, Toi Ohomai Institute of Technology, Plant and Food Research Limited, Waitaki District Council, South Taranaki District Council New Zealand
Comment 3 Alexandre Noel 2024-05-08 20:04:36 UTC
Created attachment 166442 [details] [review]
Bug 36770: Export records using a report

Enable the export_records.pl script use a report output to export biblios or authorities

Test plan:
1. Apply patches and restart services
2. Create a SQL report (id=1)
    SELECT biblionumber
    FROM biblio
3. Create a SQL report (id=2) and set an item as notforloan = -1
    SELECT title, author, biblio.biblionumber
    FROM biblio
    LEFT JOIN items USING (biblionumber)
    WHERE items.notforloan = <<Not for loan|NOT_LOAN>>
4. Create a SQL report (id=3)
    SELECT title, author
    FROM biblio
5. Create a SQL report (id=4)
    SELECT authid
    FROM auth_header
6. Run export_records.pl using report id=1 and confirm a koha.mrc file is created in the misc directory:
cd misc
./export_records.pl --report_id=1

7. Delete the koha.mrc file

8. Run export_records.pl using report id=2
./export_records.pl --report_id=2

9. Notice you are prompted to supply a parameter

10. Re-run report id=2 supplying a parameter. Confirm the koha.mrc file is created and contains bib data
./export_records.pl --report_id=2 --report_param=-1

11. Run export_records.pl using report id=3
./export_records.pl --report_id=3

12. Notice you get the message: The --report_id you specified does not fetch a biblionumber

13. Delete the koha.mrc file

14. Run export_records.pl using report id=4
./export_records.pl --report_id=4

15. Notice you get a message 'The --report_id you specified does not fetch a biblionumber'

16. Re-run export_records.pl setting the record-type=auths
./export_records.pl --record-type=auths --report_id=4

17. Notice the koha.mrc file is generated and contains auth data

Sponsored-by: Horowhenua Libraries, Toi Ohomai Institute of Technology, Plant and Food Research Limited, Waitaki District Council, South Taranaki District Council New Zealand

Signed-off-by: alexandre <alexandre.noel@inlibro.com>
Comment 4 Kyle M Hall 2024-07-19 16:12:51 UTC
Created attachment 169247 [details] [review]
Bug 36770: Export records using a report

Enable the export_records.pl script use a report output to export biblios or authorities

Test plan:
1. Apply patches and restart services
2. Create a SQL report (id=1)
    SELECT biblionumber
    FROM biblio
3. Create a SQL report (id=2) and set an item as notforloan = -1
    SELECT title, author, biblio.biblionumber
    FROM biblio
    LEFT JOIN items USING (biblionumber)
    WHERE items.notforloan = <<Not for loan|NOT_LOAN>>
4. Create a SQL report (id=3)
    SELECT title, author
    FROM biblio
5. Create a SQL report (id=4)
    SELECT authid
    FROM auth_header
6. Run export_records.pl using report id=1 and confirm a koha.mrc file is created in the misc directory:
cd misc
./export_records.pl --report_id=1

7. Delete the koha.mrc file

8. Run export_records.pl using report id=2
./export_records.pl --report_id=2

9. Notice you are prompted to supply a parameter

10. Re-run report id=2 supplying a parameter. Confirm the koha.mrc file is created and contains bib data
./export_records.pl --report_id=2 --report_param=-1

11. Run export_records.pl using report id=3
./export_records.pl --report_id=3

12. Notice you get the message: The --report_id you specified does not fetch a biblionumber

13. Delete the koha.mrc file

14. Run export_records.pl using report id=4
./export_records.pl --report_id=4

15. Notice you get a message 'The --report_id you specified does not fetch a biblionumber'

16. Re-run export_records.pl setting the record-type=auths
./export_records.pl --record-type=auths --report_id=4

17. Notice the koha.mrc file is generated and contains auth data

Sponsored-by: Horowhenua Libraries, Toi Ohomai Institute of Technology, Plant and Food Research Limited, Waitaki District Council, South Taranaki District Council New Zealand

Signed-off-by: alexandre <alexandre.noel@inlibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2024-07-19 16:12:58 UTC
Created attachment 169248 [details] [review]
Bug 36770: (QA follow-up) Tidy export_records.pl

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Katrin Fischer 2024-08-09 16:49:00 UTC
I love that so many libraries sponsored this :)

For the future I think separate sponsored-by lines would be better, as this will allow parsing and counting for the release notes script. 

New sponsor found with name Horowhenua Libraries, Toi Ohomai Institute of Technology, Plant and Food Research Limited, Waitaki District Council, South Taranaki District Council New Zealand
Comment 7 Katrin Fischer 2024-08-09 16:49:15 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 8 Alex Buckley 2024-08-11 20:42:38 UTC
(In reply to Katrin Fischer from comment #6)
> I love that so many libraries sponsored this :)
> 
> For the future I think separate sponsored-by lines would be better, as this
> will allow parsing and counting for the release notes script. 
> 
> New sponsor found with name Horowhenua Libraries, Toi Ohomai Institute of
> Technology, Plant and Food Research Limited, Waitaki District Council, South
> Taranaki District Council New Zealand

Thanks so much Katrin!

Yes, very good point about using separate sponsored-by lines in the future. We will keep that in mind :)