foreach my $lid ( @{ $all_lids } ) {
if (! $lid->cancel_reason ) {
$all_lids_are_canceled = 0;
- }
- if ($lid->cancel_reason) {
- if ($U->is_true($lid->cancel_reason->keep_debits)) {
+ } elsif (
+ !$U->is_true($candidate_cancel_reason->keep_debits) &&
+ $U->is_true($lid->cancel_reason->keep_debits)) {
$candidate_cancel_reason = $lid->cancel_reason;
- }
}
}
my $cancel_result;
if ($all_lids_are_canceled) {
- eval { $cancel_result = cancel_lineitem($mgr, $li_id, $candidate_cancel_reason); };
+ $cancel_result = cancel_lineitem($mgr, $li_id, $candidate_cancel_reason);
}
return $cancel_result;
}
Auto-Cancel Lineitems When All Copies Are Canceled
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When a copy (lineitem detail) is canceled through the Acquisitions interface, the parent lineitem is also canceled if all copies for that lineitem are also canceled. The cancel reason given will be taken from the last copy with a cancel reason where Keep Debits is true, or failing that, the cancel reason used for the copy just canceled.
+When a copy (lineitem detail) is canceled through the Acquisitions interface,
+the parent lineitem is also canceled if all copies for that lineitem are also
+canceled. The cancel reason given will come from:
+
+1. The cancel reason for the just-canceled copy if it's a Keep Debits true
+ cancel reason.
+2. The cancel reason from any other copy on the lineitem that has a Keep
+ Debits true cancel reason.
+3. The cancel reason for the just-canceled copy if no copies have a Keep
+ Debits true cancel reason.
+