Bug 41008 - bulkmarcimport.pl -d broken for authorities
Summary: bulkmarcimport.pl -d broken for authorities
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: 24.11
Hardware: All All
: P5 - low normal
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on: 35659
Blocks:
  Show dependency treegraph
 
Reported: 2025-10-14 08:07 UTC by Katrin Fischer
Modified: 2025-10-14 23:52 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41008: Fix bulkmarimport.pl -a -d (1.40 KB, patch)
2025-10-14 08:21 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2025-10-14 08:07:36 UTC
In 24.11 the system complains about a FK constraint to the new oai tables when the script is run with -a -d.

DBI Exception: DBD::mysql::db do failed: Cannot truncate a table referenced in a foreign key constraint (`koha_xxx`.`import_oai_authorities`, CONSTRAINT `FK_import_oai_authorities_1` FOREIGN KEY (`authid`) REFERENCES `koha_dlre1`.`auth_header` (`authid`))  at /usr/share/perl5/DBIx/Class/Schema.pm line
Comment 1 Katrin Fischer 2025-10-14 08:21:22 UTC
Created attachment 187852 [details] [review]
Bug 41008: Fix bulkmarimport.pl -a -d

After bug 35659 that added the OAI harvester to Koha the -d switch
for deleting authorities before importing with bulkmarcimport.pl
was broken and resulted in a FK error.

Switching from truncate to DELETE FROM like we already did for items,
biblio etc. fixes the issue.

To test:
- Make sure you have some authorities in your database
- Export some into a file for importing
- Run bulkmarcimport -a -d --file <filename>
- Verify you get the a DB FK constraint error.
- Apply patch
- Repeat steps, verify the script now works as expected again
  * Existing authorities are deleted
  * File is imported
Comment 2 David Cook 2025-10-14 23:52:07 UTC
I'll take a look at this soon