Bugzilla – Attachment 70312 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 Followup) - Add additional feedback and expand commit option
Bug-18071-QA-Followup---Add-additional-feedback-an.patch (text/plain), 3.93 KB, created by
Nick Clemens (kidclamp)
on 2018-01-05 17:43:14 UTC
(
hide
)
Description:
Bug 18071: (QA Followup) - Add additional feedback and expand commit option
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-01-05 17:43:14 UTC
Size:
3.93 KB
patch
obsolete
>From 2c383ba84874d9a34a8f0628f4bea4407a631f53 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 5 Jan 2018 17:40:50 +0000 >Subject: [PATCH] Bug 18071: (QA Followup) - Add additional feedback and expand > commit option > >To test: >Test as before, verify commit option makes no changes and provides >additional feedback when verbose > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > misc/maintenance/update_authorities.pl | 42 +++++++++++++++++++++++----------- > 1 file changed, 29 insertions(+), 13 deletions(-) > >diff --git a/misc/maintenance/update_authorities.pl b/misc/maintenance/update_authorities.pl >index 9d3c50f..61bacb8 100755 >--- a/misc/maintenance/update_authorities.pl >+++ b/misc/maintenance/update_authorities.pl >@@ -38,11 +38,9 @@ GetOptions( > ); > > @authid = map { split /[,]/, $_; } @authid; >+print "No changes will be made\n" unless $commit; > if( $help ) { > pod2usage(1); >-} elsif( !$commit ) { >- print "Please add -commit parameter\n"; >- exit; > } elsif( $delete ) { > delete_auth( \@authid ); > } elsif( $merge ) { >@@ -56,8 +54,12 @@ if( $help ) { > sub delete_auth { > my ( $auths ) = @_; > foreach my $authid ( uniq(@$auths) ) { >- DelAuthority({ authid => $authid }); # triggers a merge (read: cleanup) >- print "Removing $authid\n" if $verbose; >+ if( $commit ) { >+ DelAuthority({ authid => $authid }); # triggers a merge (read: cleanup) >+ print "Removing $authid\n" if $verbose; >+ } else { >+ print "Would have removed $authid\n" if $verbose; >+ } > } > } > >@@ -67,9 +69,9 @@ sub merge_auth { > print "Reference parameter is missing\n"; > return; > } >- my $marc_ref = GetAuthority( $reference ) || return; >+ my $marc_ref = GetAuthority( $reference ) || die "Reference record $reference not found\n"; > # First update all linked biblios of reference >- merge({ mergefrom => $reference, MARCfrom => $marc_ref, mergeto => $reference, MARCto => $marc_ref, override_limit => 1 }); >+ merge({ mergefrom => $reference, MARCfrom => $marc_ref, mergeto => $reference, MARCto => $marc_ref, override_limit => 1 }) if $commit; > > # Merge all authid's into reference > my $marc; >@@ -80,9 +82,19 @@ sub merge_auth { > 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; >+ if( $commit ) { >+ 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 $reference.\n" if $verbose; >+ } else { >+ print "Would have marged record $authid into reference $reference.\n" if $verbose; >+ } > } > } > >@@ -91,9 +103,13 @@ sub renumber { > foreach my $authid ( uniq(@$auths) ) { > if( my $obj = Koha::Authorities->find($authid) ) { > my $marc = GetAuthority( $authid ); >- AddAuthority( $marc, $authid, $obj->authtypecode ); >- # AddAuthority contains an update of 001, 005 etc. >- print "Renumbered $authid\n" if $verbose; >+ if( $commit ) { >+ AddAuthority( $marc, $authid, $obj->authtypecode ); >+ # AddAuthority contains an update of 001, 005 etc. >+ print "Renumbered $authid\n" if $verbose; >+ } else { >+ print "Would have renumbered $authid\n" if $verbose; >+ } > } else { > print "Record $authid not found!\n" if $verbose; > } >-- >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