Bugzilla – Attachment 70311 Details for
Bug 18071
Add new script update_authorities.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18071: (QA follow-up) Add commit parameter, add warning
Bug-18071-QA-follow-up-Add-commit-parameter-add-wa.patch (text/plain), 3.24 KB, created by
Nick Clemens (kidclamp)
on 2018-01-05 17:43:10 UTC
(
hide
)
Description:
Bug 18071: (QA follow-up) Add commit parameter, add warning
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-01-05 17:43:10 UTC
Size:
3.24 KB
patch
obsolete
>From 34fcf9e59f731dd585b20772fa350c8d8cbee095 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 1 Dec 2017 12:29:48 +0100 >Subject: [PATCH] Bug 18071: (QA follow-up) Add commit parameter, add warning > >Addressing points mentioned in comment12: >[1] Commit parameter. >[2] Warning if authid does not exist for -merge. > >Test plan: >[1] Run update_authorities.pl -authid X -merge -ref Y -c > where X does not exist in your db and Y does. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > misc/maintenance/update_authorities.pl | 30 ++++++++++++++++++++---------- > 1 file changed, 20 insertions(+), 10 deletions(-) > >diff --git a/misc/maintenance/update_authorities.pl b/misc/maintenance/update_authorities.pl >index 2f2ebe9..9d3c50f 100755 >--- a/misc/maintenance/update_authorities.pl >+++ b/misc/maintenance/update_authorities.pl >@@ -25,9 +25,10 @@ use Pod::Usage; > > use C4::AuthoritiesMarc qw/AddAuthority DelAuthority GetAuthority merge/; > >-my ( @authid, $delete, $help, $merge, $reference, $renumber, $verbose ); >+my ( @authid, $commit, $delete, $help, $merge, $reference, $renumber, $verbose ); > GetOptions( > 'authid:s' => \@authid, >+ 'commit' => \$commit, > 'delete' => \$delete, > 'help' => \$help, > 'merge' => \$merge, >@@ -37,14 +38,17 @@ GetOptions( > ); > > @authid = map { split /[,]/, $_; } @authid; >-if( $delete ) { >+if( $help ) { >+ pod2usage(1); >+} elsif( !$commit ) { >+ print "Please add -commit parameter\n"; >+ exit; >+} elsif( $delete ) { > delete_auth( \@authid ); > } elsif( $merge ) { > merge_auth( \@authid, $reference ); > } elsif( $renumber ) { > renumber( \@authid ); >-} elsif( $help ) { >- pod2usage(1); > } else { > pod2usage(1); > } >@@ -71,7 +75,11 @@ sub merge_auth { > my $marc; > foreach my $authid ( uniq(@$auths) ) { > next if $authid == $reference; >- $marc = GetAuthority($authid) || next; >+ $marc = GetAuthority($authid); >+ if( !$marc ) { >+ print "Authority id $authid ignored, does not exist.\n"; >+ next; >+ } > merge({ mergefrom => $authid, MARCfrom => $marc, mergeto => $reference, MARCto => $marc_ref, override_limit => 1 }); > DelAuthority({ authid => $authid, skip_merge => 1 }); > print "Record $authid merged into reference.\n" if $verbose; >@@ -107,21 +115,23 @@ It also allows you to force a renumber, i.e. save the authid into field 001. > > =head1 SYNOPSIS > >-update_authorities.pl -authid 1,2,3 -delete >+update_authorities.pl -c -authid 1,2,3 -delete > >-update_authorities.pl -authid 1 -authid 2 -authid 3 -delete >+update_authorities.pl -c -authid 1 -authid 2 -authid 3 -delete > >-update_authorities.pl -authid 1,2 -merge -reference 3 >+update_authorities.pl -c -authid 1,2 -merge -reference 3 > >-update_authorities.pl -merge -reference 4 >+update_authorities.pl -c -merge -reference 4 > >-update_authorities.pl -authid 1,2,3 -renumber >+update_authorities.pl -c -authid 1,2,3 -renumber > > =head1 OPTIONS > > authid: List authority numbers separated by commas or repeat the > parameter. > >+commit: Needed to commit changes. >+ > delete: Delete the listed authority numbers and remove its references from > linked biblio records. > >-- >2.1.4
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 18071
:
60250
|
64743
|
64744
|
66854
|
69428
|
70310
| 70311 |
70312
|
70320
|
70388
|
70400