Bug 18070: [Follow-up] What should DelAuthority return?
Script tools/batch_delete_records.pl only checks the return value of
DelAuthority. The return value depends on DBI rows, which is not always
reliable. It may return -1 when it 'does not know'.
Testing $@ in tools/batch_delete_records.pl should actually be enough.
The return value was discarded in C4/ImportBatch.pm. Removing an unused
variable.
Test plan:
[1] Pick an authority record with a few linked biblios.
Delete this authority record via tools/batch_delete_records.pl.
Check if the linked biblio records are cleaned up.
[2] Bonus: Make a typo in the SQL statement of DelAuthority. Check
if batch_delete_records shows you the error message.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
cb58b11f67
commit
17e84750d9
|
|
@ -682,7 +682,7 @@ sub AddAuthority {
|
|||
|
||||
=head2 DelAuthority
|
||||
|
||||
$authid = DelAuthority( $authid )
|
||||
DelAuthority( $authid )
|
||||
|
||||
Deletes $authid and calls merge to cleanup in linked biblio records
|
||||
|
||||
|
|
|
|||
|
|
@ -852,7 +852,7 @@ sub BatchRevertRecords {
|
|||
$num_items_deleted += BatchRevertItems($rowref->{'import_record_id'}, $rowref->{'matched_biblionumber'});
|
||||
$error = DelBiblio($rowref->{'matched_biblionumber'});
|
||||
} else {
|
||||
my $deletedauthid = DelAuthority($rowref->{'matched_authid'});
|
||||
DelAuthority( $rowref->{'matched_authid'} );
|
||||
}
|
||||
if (defined $error) {
|
||||
$num_errors++;
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ if ( $op eq 'form' ) {
|
|||
} else {
|
||||
# Authorities
|
||||
my $authid = $record_id;
|
||||
my $r = eval { C4::AuthoritiesMarc::DelAuthority( $authid ) };
|
||||
if ( $r eq '0E0' or $@ ) {
|
||||
eval { C4::AuthoritiesMarc::DelAuthority( $authid ) };
|
||||
if ( $@ ) {
|
||||
push @messages, {
|
||||
type => 'error',
|
||||
code => 'authority_not_deleted',
|
||||
|
|
|
|||
Loading…
Reference in New Issue