Bugzilla – Attachment 64953 Details for
Bug 17380
Resolve several problems related to Default authority framework
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17380: Do not use GuessAuthTypeCode in MetadataRecord::Authority
Bug-17380-Do-not-use-GuessAuthTypeCode-in-Metadata.patch (text/plain), 3.55 KB, created by
Marcel de Rooy
on 2017-07-10 08:40:36 UTC
(
hide
)
Description:
Bug 17380: Do not use GuessAuthTypeCode in MetadataRecord::Authority
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-07-10 08:40:36 UTC
Size:
3.55 KB
patch
obsolete
>From 088d4f95448ece54b72e446b97710e8bd152c442 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 26 Jun 2017 13:41:56 +0200 >Subject: [PATCH] Bug 17380: Do not use GuessAuthTypeCode in > MetadataRecord::Authority >Content-Type: text/plain; charset=utf-8 > >If we got an authtypecode from the database and this value is not NULL >since the table column does not allow it, there is no need to call >GuessAuthTypeCode for empty string (read: Default framework) in the >sub get_from_authid. > >Furthermore, we remove three Koha::MetadataRecord::Authority->new calls. >They are useless, since we do not pass a record. It just generates: > No record passed at authorities/merge.pl line 96. > Can't bless non-reference value at Koha/MetadataRecord/Authority.pm line 66. >Instead we throw an ObjectNotFound exception. > >Test plan: >[1] Run t/db_dependent/Koha_Authority.t >[2] Interface will be tested in the following patches. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/MetadataRecord/Authority.pm | 7 ------- > authorities/merge.pl | 12 ++++++++---- > 2 files changed, 8 insertions(+), 11 deletions(-) > >diff --git a/Koha/MetadataRecord/Authority.pm b/Koha/MetadataRecord/Authority.pm >index c3b3314..f9eedf8 100644 >--- a/Koha/MetadataRecord/Authority.pm >+++ b/Koha/MetadataRecord/Authority.pm >@@ -93,13 +93,6 @@ sub get_from_authid { > return if ($@); > $record->encoding('UTF-8'); > >- # NOTE: GuessAuthTypeCode has no business in Koha::MetadataRecord::Authority, which is an >- # object-oriented class. Eventually perhaps there will be utility >- # classes in the Koha:: namespace, but there are not at the moment, >- # so this shim seems like the best option all-around. >- require C4::AuthoritiesMarc; >- $authtypecode ||= C4::AuthoritiesMarc::GuessAuthTypeCode($record); >- > my $self = $class->SUPER::new( { authid => $authid, > authtypecode => $authtypecode, > schema => $marcflavour, >diff --git a/authorities/merge.pl b/authorities/merge.pl >index 0230dbf7..060db09 100755 >--- a/authorities/merge.pl >+++ b/authorities/merge.pl >@@ -27,6 +27,8 @@ use Koha::MetadataRecord::Authority; > use C4::Koha; > use C4::Biblio; > >+use Koha::Exceptions; >+ > my $input = new CGI; > my @authid = $input->multi_param('authid'); > my $merge = $input->param('merge'); >@@ -87,14 +89,16 @@ else { > push @errors, { code => "WRONG_COUNT", value => scalar(@authid) }; > } > else { >- my $recordObj1 = Koha::MetadataRecord::Authority->get_from_authid($authid[0]) || Koha::MetadataRecord::Authority->new(); >- my $recordObj2; >+ my $recordObj1 = Koha::MetadataRecord::Authority->get_from_authid($authid[0]); >+ Koha::Exceptions::ObjectNotFound->throw( "No authority record found for authid $authid[0]\n" ) if !$recordObj1; > >+ my $recordObj2; > if (defined $mergereference && $mergereference eq 'breeding') { >- $recordObj2 = Koha::MetadataRecord::Authority->get_from_breeding($authid[1]) || Koha::MetadataRecord::Authority->new(); >+ $recordObj2 = Koha::MetadataRecord::Authority->get_from_breeding($authid[1]); > } else { >- $recordObj2 = Koha::MetadataRecord::Authority->get_from_authid($authid[1]) || Koha::MetadataRecord::Authority->new(); >+ $recordObj2 = Koha::MetadataRecord::Authority->get_from_authid($authid[1]); > } >+ Koha::Exceptions::ObjectNotFound->throw( "No authority record found for authid $authid[1]\n" ) if !$recordObj2; > > if ($mergereference) { > >-- >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 17380
:
55947
|
60592
|
64952
|
64953
|
64954
|
64955
|
66277
|
66278
|
66279
|
66280
|
66313
|
66314
|
66315
|
66316
|
66750
|
66751
|
66796
|
66797
|
66798
|
66799
|
66800
|
66801
|
66912
|
66913
|
66914
|
66915
|
66916
|
66917