Bug 7583 follow-up: Prevent users to cancel receipt if they can't
Disable the link for cancelling instead of displaying an error message after the click. This is only valid if parent order line is received, not if it's deleted. When the user gets his mouse over the disabled link, he gets a message telling him which order (ordernumber) blocks him so he knows immediately which receipt to cancel. Also improve error messages for non technical people Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
d4cda293b4
commit
5c127f3391
2 changed files with 33 additions and 6 deletions
|
@ -142,7 +142,6 @@ for (my $i = 0 ; $i < $countlines ; $i++) {
|
|||
$line{gst} = $gst;
|
||||
$line{total} = sprintf($cfstr, $total);
|
||||
$line{booksellerid} = $booksellerid;
|
||||
push @loop_received, \%line;
|
||||
$totalprice += $parcelitems[$i]->{'unitprice'};
|
||||
$line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
|
||||
|
||||
|
@ -151,6 +150,15 @@ for (my $i = 0 ; $i < $countlines ; $i++) {
|
|||
$line{surnamesuggestedby} = $suggestion->{surnamesuggestedby};
|
||||
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
|
||||
|
||||
if ( $line{parent_ordernumber} != $line{ordernumber} ) {
|
||||
if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
|
||||
@parcelitems )
|
||||
{
|
||||
$line{cannot_cancel} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
push @loop_received, \%line;
|
||||
#double FIXME - totalfreight is redefined later.
|
||||
|
||||
# FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
|
||||
|
|
|
@ -170,11 +170,15 @@
|
|||
Cannot cancel receipt. Possible reasons :
|
||||
<ul>
|
||||
<li>
|
||||
You are trying to cancel the receipt of an order line whose parent
|
||||
order line is already received. Cancel this parent order line and
|
||||
retry.
|
||||
The order line you trying to cancel was created from a partial receipt
|
||||
of another order line which is already received. Try to cancel this
|
||||
one first and retry.
|
||||
</li>
|
||||
<li>
|
||||
The order line you trying to cancel was created from a partial receipt
|
||||
of another order line which has been deleted. Cancellation is not
|
||||
possible.
|
||||
</li>
|
||||
<li>Parent order line has been deleted.</li>
|
||||
</ul>
|
||||
</div>
|
||||
[% END %]
|
||||
|
@ -361,7 +365,22 @@
|
|||
<td>[% loop_receive.ecost %]</td>
|
||||
<td>[% loop_receive.unitprice %]</td>
|
||||
<td>[% loop_receive.total %]</td>
|
||||
<td><a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% loop_receive.invoice %]&booksellerid=[% booksellerid %]&datereceived=[% datereceived %]&op=cancelreceipt&ordernumber=[% loop_receive.ordernumber %]">Cancel receipt</a></td>
|
||||
<td>
|
||||
[% IF (loop_receive.cannot_cancel) %]
|
||||
[% span_title = BLOCK %]
|
||||
Cannot cancel receipt of this order line because it
|
||||
was created from a partial receipt of order line no.
|
||||
[% loop_receive.parent_ordernumber %], which is
|
||||
already received. Try cancelling this one first and
|
||||
retry.
|
||||
[% END %]
|
||||
<span title="[% span_title | collapse %]">
|
||||
Can't cancel receipt
|
||||
</span>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% loop_receive.invoice %]&booksellerid=[% booksellerid %]&datereceived=[% datereceived %]&op=cancelreceipt&ordernumber=[% loop_receive.ordernumber %]">Cancel receipt</a>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue