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

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 59d07337de)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Katrin Fischer 2025-10-14 10:10:08 +02:00 committed by Paul Derscheid
parent dd68cc79e6
commit eb6241644a
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 1 additions and 1 deletions

View File

@ -236,7 +236,7 @@ if ($delete) {
$dbh->do("ALTER TABLE items AUTO_INCREMENT = 1");
} else {
print "Deleting authorities\n";
$dbh->do("truncate auth_header");
$dbh->do("DELETE FROM auth_header");
}
$dbh->do("truncate zebraqueue");
}