From ef71b7ebb3521f3d7d1da1fe15e404612b16e6ff Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Tue, 10 Apr 2012 13:04:42 -0400
Subject: [PATCH] Bug 7758 - Followup - Make alert non-blocking

---
 C4/Circulation.pm                                  |    6 ++++--
 circ/circulation.pl                                |    4 +++-
 .../prog/en/modules/circ/circulation.tt            |    8 ++++----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 6ca860d..79468a1 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -667,6 +667,8 @@ sub CanBookBeIssued {
     my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_;
     my %needsconfirmation;    # filled with problems that needs confirmations
     my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
+    my %alerts;               # filled with messages that shouldn't stop issuing, but the librarian should be aware of.
+    
     my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
     my $issue = GetItemIssue($item->{itemnumber});
 	my $biblioitem = GetBiblioItemData($item->{biblioitemnumber});
@@ -849,7 +851,7 @@ sub CanBookBeIssued {
         $issuingimpossible{RESTRICTED} = 1;
     }
     if ( $item->{'itemlost'} ) {
-        $needsconfirmation{ITEM_LOST} = GetAuthorisedValueByCode( 'LOST', $item->{'itemlost'} );
+        $alerts{ITEM_LOST} = GetAuthorisedValueByCode( 'LOST', $item->{'itemlost'} );
     }
     if ( C4::Context->preference("IndependantBranches") ) {
         my $userenv = C4::Context->userenv;
@@ -926,7 +928,7 @@ sub CanBookBeIssued {
             }
         }
     }
-    return ( \%issuingimpossible, \%needsconfirmation );
+    return ( \%issuingimpossible, \%needsconfirmation, \%alerts );
 }
 
 =head2 AddIssue
diff --git a/circ/circulation.pl b/circ/circulation.pl
index bcbcb6f..810b945 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -275,10 +275,12 @@ if ($borrowernumber) {
 #
 if ($barcode) {
     # always check for blockers on issuing
-    my ( $error, $question ) =
+    my ( $error, $question, $alerts ) =
     CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
     my $blocker = $invalidduedate ? 1 : 0;
 
+    $template->param( %$alerts );
+
     delete $question->{'DEBT'} if ($debt_confirmed);
     foreach my $impossible ( keys %$error ) {
         $template->param(
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index e79cef1..8c11893 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -233,6 +233,10 @@ function refocus(calendar) {
     </div>
 [% END %]
 
+[% IF ( ITEM_LOST ) %]
+    <div class="dialog message">This item has been lost with a status of "[% ITEM_LOST %]".</div>
+[% END %]
+
 [% IF ( NEEDSCONFIRMATION ) %]
 <div class="yui-g">
 
@@ -279,10 +283,6 @@ function refocus(calendar) {
 [% IF ( USERBLOCKEDOVERDUE ) %]
     <li>Patron has [% USERBLOCKEDOVERDUE %] overdue item(s).  Check out anyway?</li>
 [% END %]
-
-[% IF ( ITEM_LOST ) %]
-    <li>This item has been lost with a status of "[% ITEM_LOST %]". Check out anyway?</li>
-[% END %]
 </ul>
 
 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
-- 
1.7.2.5