Bugzilla – Attachment 89413 Details for
Bug 21280
Unify MARC editor in biblios and authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21280: (QA follow-up) Use constant instead of Readonly in MarcEditor
Bug-21280-QA-follow-up-Use-constant-instead-of-Rea.patch (text/plain), 7.32 KB, created by
Josef Moravec
on 2019-05-07 06:29:06 UTC
(
hide
)
Description:
Bug 21280: (QA follow-up) Use constant instead of Readonly in MarcEditor
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-05-07 06:29:06 UTC
Size:
7.32 KB
patch
obsolete
>From e6e3df084e0c8d20c9ba4d8e189c2de8906235fb Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 6 May 2019 20:31:03 +0000 >Subject: [PATCH] Bug 21280: (QA follow-up) Use constant instead of Readonly in > MarcEditor > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/MarcEditor.pm | 31 ++++++++++++++++--------------- > authorities/authorities.pl | 2 +- > cataloguing/addbiblio.pl | 2 +- > 3 files changed, 18 insertions(+), 17 deletions(-) > >diff --git a/Koha/MarcEditor.pm b/Koha/MarcEditor.pm >index 594d0c5..b7c94c0 100644 >--- a/Koha/MarcEditor.pm >+++ b/Koha/MarcEditor.pm >@@ -21,8 +21,7 @@ package Koha::MarcEditor; > > use Modern::Perl; > >-use Readonly; >- >+use C4::Biblio; > use C4::ClassSource; > use C4::Context; > >@@ -31,8 +30,10 @@ use Koha::DateUtils; > use base qw(Class::Accessor); > > # Constants to refer to the standard editor types >-Readonly our $EDITOR_BIBLIO => 'biblio'; >-Readonly our $EDITOR_AUTHORITY => 'authority'; >+use constant { >+ EDITOR_BIBLIO => 'biblio', >+ EDITOR_AUTHORITY => 'authority', >+}; > > =head1 NAME > >@@ -47,7 +48,7 @@ Koha::MarcEditor - Koha MARC Editor class > =head2 new > > my $editor = Koha::MarcEditor->new({ >- type => $Koha::MarcEditor::EDITOR_BIBLIO, >+ type => Koha::MarcEditor::EDITOR_BIBLIO, > tags => $self->{tags}, > used_tags => $tagsUsedLib, > mandatory_z3950 => $mandatory_z3950, >@@ -152,7 +153,7 @@ sub build_tabs { > } > next if ( $self->{tags}->{$tag}->{$subfield}->{tab} ne $tabloop ); > next if $self->{tags}->{$tag}->{$subfield}->{hidden} && $subfield ne '9' >- && $self->{type} eq $Koha::MarcEditor::EDITOR_AUTHORITY; >+ && $self->{type} eq Koha::MarcEditor::EDITOR_AUTHORITY; > next > if ( $self->{tags}->{$tag}->{$subfield}->{kohafield} eq > 'biblio.biblionumber' ); >@@ -171,7 +172,7 @@ sub build_tabs { > next if ( length $subfield != 1 ); > next if ( $self->{tags}->{$tag}->{$subfield}->{tab} ne $tabloop ); > next if $self->{tags}->{$tag}->{$subfield}->{hidden} && $subfield ne '9' >- && $self->{type} eq $Koha::MarcEditor::EDITOR_AUTHORITY; >+ && $self->{type} eq Koha::MarcEditor::EDITOR_AUTHORITY; > push( > @subfields_data, > $self->_create_input( >@@ -188,11 +189,11 @@ sub build_tabs { > next if ( $self->{tags}->{$tag}->{$subfield}->{tab} ne $tabloop ); > next if ( $tag < 10 ); > next if $self->{tags}->{$tag}->{$subfield}->{hidden} && $subfield ne '9' >- && $self->{type} eq $Koha::MarcEditor::EDITOR_AUTHORITY; >+ && $self->{type} eq Koha::MarcEditor::EDITOR_AUTHORITY; > next > if ( ( $self->{tags}->{$tag}->{$subfield}->{hidden} <= -4 ) > or ( $self->{tags}->{$tag}->{$subfield}->{hidden} >= 5 ) ) >- and $self->{type} ne $Koha::MarcEditor::EDITOR_AUTHORITY >+ and $self->{type} ne Koha::MarcEditor::EDITOR_AUTHORITY > and not ( $subfield eq "9" and > exists($self->{tags}->{$tag}->{'a'}->{authtypecode}) and > defined($self->{tags}->{$tag}->{'a'}->{authtypecode}) and >@@ -239,11 +240,11 @@ sub build_tabs { > foreach my $subfield ( sort( keys %{ $self->{tags}->{$tag} } ) ) { > next if ( length $subfield != 1 ); > next if $self->{tags}->{$tag}->{$subfield}->{hidden} && $subfield ne '9' >- && $self->{type} eq $Koha::MarcEditor::EDITOR_AUTHORITY; >+ && $self->{type} eq Koha::MarcEditor::EDITOR_AUTHORITY; > next > if ( ( $self->{tags}->{$tag}->{$subfield}->{hidden} <= -4 ) > or ( $self->{tags}->{$tag}->{$subfield}->{hidden} >= 5 ) ) >- and $self->{type} ne $Koha::MarcEditor::EDITOR_AUTHORITY >+ and $self->{type} ne Koha::MarcEditor::EDITOR_AUTHORITY > and not ( $subfield eq "9" and > exists($self->{tags}->{$tag}->{'a'}->{authtypecode}) and > defined($self->{tags}->{$tag}->{'a'}->{authtypecode}) and >@@ -365,7 +366,7 @@ sub _build_authorized_values_list { > $value = $default_source unless $value; > } > else { >- my $branch_limit = $self->{type} ne $Koha::MarcEditor::EDITOR_AUTHORITY && C4::Context->userenv >+ my $branch_limit = $self->{type} ne Koha::MarcEditor::EDITOR_AUTHORITY && C4::Context->userenv > ? C4::Context->userenv->{'branch'} : ''; > > my $query; >@@ -459,7 +460,7 @@ sub _create_input { > $subfield_data{z3950_mandatory} = $self->{mandatory_z3950}->{$tag.$subfield}; > } > >- if ($self->{type} eq $Koha::MarcEditor::EDITOR_AUTHORITY) { >+ if ($self->{type} eq Koha::MarcEditor::EDITOR_AUTHORITY) { > # Authority subfield is hidden unless mandatory or contains something. > $subfield_data{visibility} = "display:none;" > if( $tagdef->{$subfield}->{hidden} and $value ne '' >@@ -485,7 +486,7 @@ sub _create_input { > > # it's a subfield $9 linking to an authority record - see bug 2206 > } >- elsif ($self->{type} eq $Koha::MarcEditor::EDITOR_BIBLIO and >+ elsif ($self->{type} eq Koha::MarcEditor::EDITOR_BIBLIO and > $subfield eq "9" and > exists($tagdef->{'a'}->{authtypecode}) and > defined($tagdef->{'a'}->{authtypecode}) and >@@ -505,7 +506,7 @@ sub _create_input { > } > elsif ( $tagdef->{$subfield}->{authtypecode} ) { > # when authorities auto-creation is allowed, do not set readonly >- my $is_readonly = $self->{type} eq $Koha::MarcEditor::EDITOR_BIBLIO && !C4::Context->preference("BiblioAddsAuthorities"); >+ my $is_readonly = $self->{type} eq Koha::MarcEditor::EDITOR_BIBLIO && !C4::Context->preference("BiblioAddsAuthorities"); > > $subfield_data{marc_value} = { > type => 'text', >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index 9db6fe6..cec9d94 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -132,7 +132,7 @@ if ($breedingid) { > > > my $editor = Koha::MarcEditor->new({ >- type => $Koha::MarcEditor::EDITOR_AUTHORITY, >+ type => Koha::MarcEditor::EDITOR_AUTHORITY, > tags => GetTagsLabels(1,$authtypecode), > mandatory_z3950 => GetMandatoryFieldZ3950($authtypecode) > }); >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index afcbd6c..9181952 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -261,7 +261,7 @@ $template->param( > ); > > my $editor = Koha::MarcEditor->new({ >- type => $Koha::MarcEditor::EDITOR_BIBLIO, >+ type => Koha::MarcEditor::EDITOR_BIBLIO, > tags => GetMarcStructure( 1, $frameworkcode ), > used_tags => GetUsedMarcStructure( $frameworkcode ), > mandatory_z3950 => GetMandatoryFieldZ3950($frameworkcode), >-- >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 21280
:
78214
|
85502
|
85503
|
85504
|
85517
|
85518
|
85519
|
85520
|
87311
|
87312
|
87313
|
87314
|
87318
|
87319
|
87320
|
87321
|
89407
|
89408
|
89409
|
89410
|
89411
|
89412
| 89413 |
89414