Bugzilla – Attachment 90580 Details for
Bug 23117
additem.pl crashes on nonexistent biblionumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23117: Shortcut additem.pl on nonexistent biblionumber
Bug-23117-Shortcut-additempl-on-nonexistent-biblio.patch (text/plain), 2.85 KB, created by
Jonathan Druart
on 2019-06-13 16:09:51 UTC
(
hide
)
Description:
Bug 23117: Shortcut additem.pl on nonexistent biblionumber
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-06-13 16:09:51 UTC
Size:
2.85 KB
patch
obsolete
>From 188a5ecde5e85ec4d6b32377da9a3db016e38a0e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 13 Jun 2019 11:06:29 -0500 >Subject: [PATCH] Bug 23117: Shortcut additem.pl on nonexistent biblionumber > >To prevent additem.pl to crash when called with a nonexistent >biblionumber we are here implementing the blocking_error.inc trick to >display a friendly message instead. > >Can't call method "fields" on an undefined value at >/home/vagrant/kohaclone/cataloguing/additem.pl line 736. > >Test plan: >hit >/cataloguing/additem.pl?biblionumber= >/cataloguing/additem.pl?biblionumber=424242 >You will get a friendly "Bibliographic record not found." message, >instead of a 500 >--- > C4/Output.pm | 4 ++++ > cataloguing/additem.pl | 4 ++++ > koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 2 +- > 3 files changed, 9 insertions(+), 1 deletion(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index e8a86cc5ed..b107e27606 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -338,6 +338,10 @@ sub output_and_exit_if_error { > elsif( not $logged_in_user->can_see_patron_infos( $current_patron ) ) { > $error = 'cannot_see_patron_infos'; > } >+ } elsif ( $params->{module} eq 'cataloguing' ) { >+ # We are testing the record to avoid additem to fetch the Koha::Biblio >+ # But in the long term we will want to get a biblio in parameter >+ $error = 'unknown_biblio' unless $params->{record}; > } > } > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 062d335107..a7db81557b 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -421,6 +421,10 @@ $restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && > > my $tagslib = &GetMarcStructure(1,$frameworkcode); > my $record = GetMarcBiblio({ biblionumber => $biblionumber }); >+ >+output_and_exit_if_error( $input, $cookie, $template, >+ { module => 'cataloguing', record => $record } ); >+ > my $oldrecord = TransformMarcToKoha($record); > my $itemrecord; > my $nextop="additem"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 2dd65df7aa..25fcf73dd2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -32,7 +32,7 @@ > <div class="row"> > <div class="col-sm-12"> > <main> >- >+ [% INCLUDE 'blocking_errors.inc' %] > <h1>Items for [% title | html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber | html %])</h1> > > [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %] >-- >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 23117
:
90580
|
90618
|
90623