Bugzilla – Attachment 66751 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: (Alternate proposal) Report error to user instead of throwing exception
Bug-17380-Alternate-proposal-Report-error-to-user-.patch (text/plain), 2.81 KB, created by
Nick Clemens (kidclamp)
on 2017-09-01 14:41:14 UTC
(
hide
)
Description:
Bug 17380: (Alternate proposal) Report error to user instead of throwing exception
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-09-01 14:41:14 UTC
Size:
2.81 KB
patch
obsolete
>From c19d9522f795b58fb64522f8775bafbbf3ac3f3d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 1 Sep 2017 14:39:25 +0000 >Subject: [PATCH] Bug 17380: (Alternate proposal) Report error to user instead > of throwing exception > >Internal server errors are good, user feedback is better >--- > authorities/merge.pl | 19 ++++++++++++++++--- > .../prog/en/modules/authorities/merge.tt | 2 ++ > 2 files changed, 18 insertions(+), 3 deletions(-) > >diff --git a/authorities/merge.pl b/authorities/merge.pl >index b6a7b27..959d8b1 100755 >--- a/authorities/merge.pl >+++ b/authorities/merge.pl >@@ -108,7 +108,10 @@ else { > push @errors, { code => 'DESTRUCTIVE_MERGE' }; > } else { > 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; >+ if (!$recordObj1) { >+ push @errors, { code => "MISSING_RECORD", value => $authid[0] }; >+ } >+ > > my $recordObj2; > if (defined $mergereference && $mergereference eq 'breeding') { >@@ -116,9 +119,19 @@ else { > } else { > $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 (!$recordObj2) { >+ push @errors, { code => "MISSING_RECORD", value => $authid[1] }; >+ } >+ >+ unless ( $recordObj1 && $recordObj2 ) { >+ if (@errors) { >+ $template->param( errors => \@errors ); >+ } >+ output_html_with_http_headers $input, $cookie, $template->output; >+ exit; >+ } > >- if ($mergereference) { >+ if ($mergereference ) { > > my $framework; > if ( $recordObj1->authtypecode ne $recordObj2->authtypecode && $mergereference ne 'breeding' ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >index 493bcbd..003e673 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >@@ -67,6 +67,8 @@ function changeFramework(fw) { > The Default framework cannot be used, or the framework does not exist. Please select another framework for merging. > [% ELSIF error.code == 'EMPTY_MARC' %] > Sorry, but we did not find any MARC tags in the reference record. >+ [% ELSIF error.code == 'MISSING_RECORD' %] >+ Sorry, but we did not find a record for number: [% error.value %]. > [% ELSE %] > [% error %] > [% END %] >-- >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