From 89628336fa54a6418d12f7732960a243abd3151f Mon Sep 17 00:00:00 2001
From: Bill Erickson <berick@esilibrary.com>
Date: Wed, 9 Nov 2011 15:54:21 -0500
Subject: [PATCH] TPac; batch hold update detects suspension of captured hold

If the user attempts to suspend a captured hold via batch hold update,
warn that user af the update the some holds may not have been suspended
and why.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
---
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 5 ++++-
 Open-ILS/src/templates/opac/myopac/holds.tt2                 | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index f14a200b7f..92ab41e551 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -467,7 +467,10 @@ sub handle_hold_update {
             push(@$vlist, $vals);
         }
 
-        $circ->request('open-ils.circ.hold.update.batch.atomic', $e->authtoken, undef, $vlist)->gather(1);
+        my $resp = $circ->request('open-ils.circ.hold.update.batch.atomic', $e->authtoken, undef, $vlist)->gather(1);
+        $self->ctx->{hold_suspend_post_capture} = 1 if 
+            grep {$U->event_equals($_, 'HOLD_SUSPEND_AFTER_CAPTURE')} @$resp;
+
     } elsif ($action eq 'edit') {
 
         my @vals = map {
diff --git a/Open-ILS/src/templates/opac/myopac/holds.tt2 b/Open-ILS/src/templates/opac/myopac/holds.tt2
index 279f53cbb1..56327eed63 100644
--- a/Open-ILS/src/templates/opac/myopac/holds.tt2
+++ b/Open-ILS/src/templates/opac/myopac/holds.tt2
@@ -61,6 +61,12 @@
                         alt="Holds Help"
                         src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
                 </td>
+                <td style="padding-left:5px;" class='error'>
+                    [%  IF ctx.hold_suspend_post_capture;
+                            l('One or more holds could not be suspended because<br/>the item is at (or en route to) the pickup library.');
+                        END;
+                    %]
+                </td>
                 <td align="right">
                     [% l("Show") %] &nbsp; &nbsp;
                     [% IF CGI.param("available") %]
-- 
2.11.0