Bugzilla – Attachment 60559 Details for
Bug 18070
Support clean removal of authority records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18070: [Follow-up] What should DelAuthority return?
Bug-18070-Follow-up-What-should-DelAuthority-retur.patch (text/plain), 2.80 KB, created by
Julian Maurice
on 2017-02-22 14:46:20 UTC
(
hide
)
Description:
Bug 18070: [Follow-up] What should DelAuthority return?
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2017-02-22 14:46:20 UTC
Size:
2.80 KB
patch
obsolete
>From 86b69e7819ea2047132064c49eeb22b4a5a3d693 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 14 Feb 2017 16:41:26 +0100 >Subject: [PATCH] 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> >--- > C4/AuthoritiesMarc.pm | 2 +- > C4/ImportBatch.pm | 2 +- > tools/batch_delete_records.pl | 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index afef9c8189..7e367c889f 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -682,7 +682,7 @@ sub AddAuthority { > > =head2 DelAuthority > >- $authid = DelAuthority( $authid ) >+ DelAuthority( $authid ) > > Deletes $authid and calls merge to cleanup in linked biblio records > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index 88d670d598..14364f4a14 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -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++; >diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl >index 2c2d32e407..2b82796541 100755 >--- a/tools/batch_delete_records.pl >+++ b/tools/batch_delete_records.pl >@@ -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', >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18070
:
59972
|
59973
|
59977
|
59978
|
60251
|
60252
|
60253
|
60254
|
60392
|
60393
|
60394
|
60395
|
60557
|
60558
| 60559 |
60560