Bug 11744: A receipt should not be cancelled if holds exist
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 19 Mar 2014 11:54:15 +0000 (12:54 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 14 Jul 2014 14:17:42 +0000 (11:17 -0300)
Test plan:
1/ Set acqCreateItem pref to on receiving
2/ Receive 1 of 2 items ordered
3/ Place a hold on the record
4/ Verify you are not able to cancel the receipt.

This is not the best way to do that but it is the easy one.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt

index 69c047d..f4f6e3e 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% USE currency = format('%.2f') -%]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
                 <td>[% order.unitprice %]</td>
                 <td>[% order.total %]</td>
                 <td>
-                    [% IF (order.cannot_cancel) %]
+                    [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
+                      [% 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.
                             already received. Try cancelling this one first and
                             retry.
                         [% END %]
-                        <span title="[% span_title | collapse %]">
-                            Can't cancel receipt
-                        </span>
+                      [% ELSE %]
+                        [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
+                        [%# Some additional checks should be added in the pl file %]
+                        [% span_title = BLOCK %]
+                          Cannot cancel receipt of this order line because at least one reservation exists on the records.
+                        [% END %]
+                      [% END %]
+                      <span title="[% span_title | collapse %]">
+                          Can't cancel receipt
+                      </span>
                     [% ELSE %]
                         <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]&op=cancelreceipt&ordernumber=[% order.ordernumber %]">Cancel receipt</a>
                     [% END %]