Bugzilla – Attachment 66313 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]
[SIGNED-OFF] Bug 17380: Add some checks around Authorities::Types->find
SIGNED-OFF-Bug-17380-Add-some-checks-around-Author.patch (text/plain), 3.27 KB, created by
Josef Moravec
on 2017-08-22 10:40:21 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17380: Add some checks around Authorities::Types->find
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-08-22 10:40:21 UTC
Size:
3.27 KB
patch
obsolete
>From d3a8da4263c314a69c614049cbb74c757b24bd1b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 23 Feb 2017 10:02:57 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 17380: Add some checks around > Authorities::Types->find > >Resolves: >Use of uninitialized value $biblio_fields in scalar chop at authorities/detail.pl line 212. >Can't call method "authtypetext" on an undefined value at authorities/detail.pl line 216. >Can't call method "authtypecode" on an undefined value at authorities/detail.pl line 180. > >NOTE: Some of these problems have actually been resolved now by bugs 18801 >and 18811, but it is still better imo to have these checks. > >Test plan: >[1] Verify unchanged behavior. Search for some authorities on authorities.pl > and click on the details of a record. >[2] Open an authorities detail page and change the authid in the URL to a > not existing number. Instead of an internal server error, you should see > a message like "The authority record you requested does not exist". > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > authorities/authorities.pl | 3 ++- > authorities/detail.pl | 8 +++++--- > 2 files changed, 7 insertions(+), 4 deletions(-) > >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index 5935b07..caeafcd 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -660,12 +660,13 @@ if ($op eq "duplicate") > > my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } ); > >+my $type = $authority_types->find($authtypecode); > $template->param( > authority_types => $authority_types, > authtypecode => $authtypecode, > authid => $authid, > linkid => $linkid, >- authtypetext => $authority_types->find($authtypecode)->authtypetext, >+ authtypetext => $type ? $type->authtypetext : "", > hide_marc => C4::Context->preference('hide_marc'), > ); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/authorities/detail.pl b/authorities/detail.pl >index 38af541..31187ec 100755 >--- a/authorities/detail.pl >+++ b/authorities/detail.pl >@@ -178,7 +178,8 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user( > > my $authid = $query->param('authid'); > >-my $authtypecode = Koha::Authorities->find($authid)->authtypecode; >+my $authobj = Koha::Authorities->find($authid); >+my $authtypecode = $authobj ? $authobj->authtypecode : q{}; > $tagslib = &GetTagsLabels(1,$authtypecode); > > # Build list of authtypes for showing them >@@ -209,15 +210,16 @@ my $biblio_fields; > while (my ($tagfield) = $sth->fetchrow) { > $biblio_fields.= $tagfield."9,"; > } >-chop $biblio_fields; >+chop $biblio_fields if $biblio_fields; > > build_tabs ($template, $record, $dbh,"",$query); > >+my $type = $authority_types->find($authtypecode); > $template->param( > authid => $authid, > count => $count, > biblio_fields => $biblio_fields, >- authtypetext => $authority_types->find($authtypecode)->authtypetext, >+ authtypetext => $type ? $type->authtypetext: "", > authtypecode => $authtypecode, > authority_types => $authority_types, > csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $query->cookie('CGISESSID') }), >-- >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