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 Signed-off-by: Bin Wen <bin.wen@inlibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
001d433b42
commit
62ae7ac727
|
|
@ -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};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue