From 5c127f3391a5cec575b650afe41b8fe32fc3e579 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 13 Aug 2012 16:34:35 +0200 Subject: [PATCH] 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 --- acqui/parcel.pl | 10 ++++++- .../prog/en/modules/acqui/parcel.tt | 29 +++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index b2eedabdb5..1c1736de4c 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -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.. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 39b1140a2b..d8ff600c4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -170,11 +170,15 @@ Cannot cancel receipt. Possible reasons : [% END %] @@ -361,7 +365,22 @@ [% loop_receive.ecost %] [% loop_receive.unitprice %] [% loop_receive.total %] - Cancel receipt + + [% 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 %] + + Can't cancel receipt + + [% ELSE %] + Cancel receipt + [% END %] + [% END %] -- 2.39.5