Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt
Marcel de Rooy 2a3ba5f825
Bug 29658: Fix crash on cancelling cancelled order
Found this crash in our 20.11 logs:
Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60.
 at /usr/share/perl/5.28/Carp.pm line 289
        Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79
        Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189
        Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60

Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc.

Test plan:
Create a new basket and order.
Open this same basket in two browser tabs.
Cancel the order line (delete catalog record) in tab 1.
Go to second tab, try again.
Without this patch, it will crash. With this patch, an error message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-12 16:14:47 -03:00

84 lines
3.5 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Cancel order &rsaquo; Acquisition &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_cancelorder" class="acq">
[% INCLUDE 'header.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
</li>
<li>
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basket.bookseller.id | uri %]">[% basket.bookseller.name | html %]</a>
</li>
<li>
<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketname | html %] ([% basket.basketno | html %]) for [% basket.bookseller.name | html %]</a>
<li>
<a href="#" aria-current="page">Cancel order</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% UNLESS ( confirmcancel ) %]
<form method="post" action="">
<div class="dialog alert">
<h1>Are you sure you want to cancel this order ([% ordernumber | html %])</h1>
<p>
[% IF (del_biblio) %]
<span>Bibliographic record will be deleted too.</span>
[% ELSE %]
<span>Bibliographic record will not be deleted.</span>
[% END %]
</p>
<p>
[% PROCESS 'av-build-dropbox.inc' name="reason", category="ORDER_CANCELLATION_REASON" default="0" %]
</p>
<input type="hidden" name="action" value="confirmcancel" />
<input type="hidden" value="[% ordernumber | html %]" name="ordernumber" />
<input type="hidden" value="[% biblionumber | html %]" name="biblionumber" />
<input type="hidden" value="[% basket.basketno | html %]" name="basketno" />
<input type="hidden" value="[% referrer | html %]" name="referrer" />
[% IF (del_biblio) %]
<input type="hidden" value="1" name="del_biblio" />
[% END %]
<button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, cancel (Y)</button>
<button class="deny" accesskey="n" onclick="window.location='[% referrer | html %]';return false;"><i class="fa fa-fw fa-remove"></i> No, don't cancel (N)</button>
</div>
</form>
[% ELSE %]
[% IF ( success_cancelorder ) %]
<div class="dialog message">
The order has been successfully cancelled
[% ELSE %]
<div class="dialog alert">
An error has occurred.
[% IF error_order_already_cancelled %]
<p>The order has been cancelled already.</p>
[% ELSIF error_order_not_found %]
<p>The order could not be found.</p>
[% END %]
[% IF ( error_delitem ) %]
<p>The order has been cancelled, although one or more items could not have been deleted.</p>
[% END %]
[% IF ( error_delbiblio ) %]
<p>The order has been cancelled, although the record has not been deleted.</p>
[% END %]
[% END %]
<p><a href="[% referrer | url %]">OK</a></p>
</div>
[% END %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]