Bug 32800

Summary: build_oai_sets.pl fails on deleted records
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Command-line UtilitiesAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: lucas, magnus, robin
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05
Circulation function:
Attachments: Bug 32800: Don't embed items for deleted records
Bug 32800: Don't embed items for deleted records
Bug 32800: Don't embed items for deleted records
Bug 32800: Don't embed items for deleted records

Description Nick Clemens (kidclamp) 2023-02-02 15:57:57 UTC
The code fetches metadata for biblios and deleted biblios, but we cannot embed items on deleted biblios:
Can't call method "items" on an undefined value at /kohadevbox/koha/Koha/Biblio/Metadata.pm line 163.

To recreate:
1 - Delete a biblio
2 - perl /kohadevbox/koha/misc/migration_tools/build_oai_sets.pl -v -i -r
3 - Error:
    Can't call method "items" on an undefined value at /kohadevbox/koha/Koha/Biblio/Metadata.pm line 163.
Comment 1 Nick Clemens (kidclamp) 2023-02-02 15:59:13 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2023-03-29 10:15:01 UTC Comment hidden (obsolete)
Comment 3 Nick Clemens (kidclamp) 2023-03-29 13:03:15 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2023-03-29 13:19:42 UTC
Created attachment 148914 [details] [review]
Bug 32800: Don't embed items for deleted records

To test:
1 - Delete a biblio
2 - perl /kohadevbox/koha/misc/migration_tools/build_oai_sets.pl -v -i -r
3 - Error:
    Can't call method "items" on an undefined value at /kohadevbox/koha/Koha/Biblio/Metadata.pm line 163.
4 - Apply patch
5 - Repeat
6 - Success!

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Comment 5 Katrin Fischer 2023-04-10 17:50:40 UTC
Created attachment 149408 [details] [review]
Bug 32800: Don't embed items for deleted records

To test:
1 - Delete a biblio
2 - perl /kohadevbox/koha/misc/migration_tools/build_oai_sets.pl -v -i -r
3 - Error:
    Can't call method "items" on an undefined value at /kohadevbox/koha/Koha/Biblio/Metadata.pm line 163.
4 - Apply patch
5 - Repeat
6 - Success!

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2023-04-10 17:51:29 UTC
Also verified that the deleted records are added to the set now correctly and show as "Deleted".
Comment 7 Tomás Cohen Arazi (tcohen) 2023-04-12 12:27:44 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 8 Matt Blenkinsop 2023-04-17 09:03:31 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 9 Lucas Gass (lukeg) 2023-05-05 21:51:44 UTC
Doesn't apply cleanly in 22.05.x, no backport.