Bugzilla – Attachment 70388 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: Improve parameters handling
Bug-18071-Improve-parameters-handling.patch (text/plain), 2.25 KB, created by
Jonathan Druart
on 2018-01-09 19:56:58 UTC
(
hide
)
Description:
Bug 18071: Improve parameters handling
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-01-09 19:56:58 UTC
Size:
2.25 KB
patch
obsolete
>From 5056d4b2a4a3ac2c657b285ac905e2ecbe2da4eb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Jan 2018 16:56:38 -0300 >Subject: [PATCH] Bug 18071: Improve parameters handling > >--- > misc/maintenance/update_authorities.pl | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > >diff --git a/misc/maintenance/update_authorities.pl b/misc/maintenance/update_authorities.pl >index df4077a922..b98cafce0e 100755 >--- a/misc/maintenance/update_authorities.pl >+++ b/misc/maintenance/update_authorities.pl >@@ -39,11 +39,16 @@ GetOptions( > > @authid = map { split /[,]/, $_; } @authid; > print "No changes will be made\n" unless $commit; >-if( $help ) { >- pod2usage(1); >-} elsif( $delete ) { >+pod2usage(1) if $help; >+ >+if ( $delete and $merge and $renumber ) { >+ pod2usage(q|Only one action parameter can be passed (delete, merge or renumber)|); >+} >+ >+if( $delete ) { > delete_auth( \@authid ); > } elsif( $merge ) { >+ pod2usage(q|Reference parameter is missing|) unless $reference; > merge_auth( \@authid, $reference ); > } elsif( $renumber ) { > renumber( \@authid ); >@@ -65,10 +70,9 @@ sub delete_auth { > > sub merge_auth { > my ( $auths, $reference ) = @_; >- if( !$reference ) { >- print "Reference parameter is missing\n"; >- return; >- } >+ >+ return unless $reference; >+ > 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 }) if $commit; >@@ -101,10 +105,10 @@ sub merge_auth { > sub renumber { > my ( $auths ) = @_; > foreach my $authid ( uniq(@$auths) ) { >- if( my $obj = Koha::Authorities->find($authid) ) { >+ if( my $authority = Koha::Authorities->find($authid) ) { > my $marc = GetAuthority( $authid ); > if( $commit ) { >- AddAuthority( $marc, $authid, $obj->authtypecode ); >+ AddAuthority( $marc, $authid, $authority->authtypecode ); > # AddAuthority contains an update of 001, 005 etc. > print "Renumbered $authid\n" if $verbose; > } else { >-- >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 18071
:
60250
|
64743
|
64744
|
66854
|
69428
|
70310
|
70311
|
70312
|
70320
| 70388 |
70400