Bug 23010: Handle error in updateitem.pl and template

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 73505a73ec)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lucas Gass 2025-01-31 19:02:04 +00:00 committed by Paul Derscheid
parent 152af99174
commit 09fc5e8468
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
3 changed files with 22 additions and 7 deletions

View File

@ -81,9 +81,10 @@ my $title = $query->param('title');
my $bi = $query->param('bi');
$bi = $biblionumber unless $bi;
$itemnumber = $query->param('itemnumber');
my $data = &GetBiblioData($biblionumber);
my $dewey = $data->{'dewey'};
my $showallitems = $query->param('showallitems');
my $data = &GetBiblioData($biblionumber);
my $dewey = $data->{'dewey'};
my $showallitems = $query->param('showallitems');
my $withdraw_error = $query->param('nowithdraw');
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
@ -325,6 +326,7 @@ $template->param(
);
$template->param(
withdraw_error => $withdraw_error,
ITEM_DATA => \@item_data,
moredetailview => 1,
loggedinuser => $loggedinuser,
@ -341,4 +343,3 @@ my $holds = $biblio->holds;
$template->param( holdcount => $holds->count );
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -90,9 +90,13 @@ if ( $op eq "cud-set_non_public_note" ) {
print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
exit;
}
$item->store;
eval { $item->store; };
if ($@) {
my $error_message = $@->message;
print $cgi->redirect(
"moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber&nowithdraw=$error_message#item$itemnumber");
exit;
}
LostItem( $itemnumber, 'moredetail' ) if $op eq "cud-set_lost";
print $cgi->redirect(

View File

@ -152,6 +152,16 @@
[% SET not_for_loan = 1 %]
[% SET not_for_loan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
[% END %]
[% IF withdraw_error %]
<div class="alert alert-info">
[% IF withdraw_error == 'intransit_cannot_withdraw' %]
Cannot withdraw item in transit.
[% END %]
[% IF withdraw_error == 'onloan_cannot_withdraw' %]
Cannot withdraw checked out item.
[% END %]
</div>
[% END %]
<div class="listgroup">
<h4>
Item information