From e4153a1eb0286eaf1a39ef1800c4432bffa0208e Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Tue, 30 Jul 2019 13:12:18 +0000
Subject: [PATCH] Bug 23399: Reindent returns.tt

This patch reindents circulation/returns.tt to use four spaces,
following coding guidelines.

To test, apply the patch and use your preferred method for checking the
differences between files while ignoring whitespace. I use diff with the
"-w" flag, but each must take their own journey.

Test the checkin process to confirm that everything still works
correctly.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 .../prog/en/modules/circ/returns.tt           | 1666 +++++++++--------
 1 file changed, 869 insertions(+), 797 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
index 090052d0e0..c26c10999f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -37,836 +37,908 @@
 </head>
 
 <body id="circ_returns" class="circ">
-<span class="audio-alert-success"></span>
+    <span class="audio-alert-success"></span>
 
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'checkin-search.inc' %]
+    [% INCLUDE 'header.inc' %]
+    [% INCLUDE 'checkin-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Check in</div>
+    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Check in</div>
 
-<div class="main container-fluid">
-    <div class="row">
-        <div class="col-sm-12">
-            <main>
-                <div class="row">
+    <div class="main container-fluid">
+        <div class="row">
+            <div class="col-sm-12">
+                <main>
+                    <div class="row">
 
-                [% IF Koha.Preference('CircSidebar') %]
-                    <div class="col-sm-10 col-sm-push-2">
-                [% ELSE %]
-                    <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
-                [% END %]
-
-    [% IF hold_auto_filled %]
-        <div class="dialog alert hold-auto-filled">
-            [% IF ( reservenotes ) %]
-                <h4>Notes: [% reservenotes | html %]</h4>
-            [% END %]
-            <h3>Hold filled for:</h3>
-                <li>
-                    [% INCLUDE 'patron-title.inc' patron=patron %]
-                    <span class="patron-category"> - [% patron.category.description | html %]</span>
-                </li>
-
-                [% INCLUDE display_holdpatron_address %]
-
-                [% IF ( patron.phone ) %]
-                    <li>[% patron.phone | html %]</li>
-                [% END %]
-
-                [% IF ( patron.email ) %]
-                    <li>
-                        [% IF ( transfertodo ) %]
-                            [% patron.email | html %]
+                        [% IF Koha.Preference('CircSidebar') %]
+                            <div class="col-sm-10 col-sm-push-2">
                         [% ELSE %]
-                            <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
+                            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
                         [% END %]
-                    </li>
-                [% END %]
-
-                [% UNLESS ( transfertodo) %]
-                    [% INCLUDE display_bormessagepref %]
-                [% END %]
-
-                [% IF ( patron.debarred ) %]
-                    <li class="error">Patron is RESTRICTED</li>
-                [% END %]
-
-                [% IF ( patron.gonenoaddress ) %]
-                    <li class="error">Patron's address is in doubt</li>
-                [% END %]
-
-            [% IF ( transfertodo ) %]
-                <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-            [% ELSE %]
-                <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-            [% END %]
-
-            <a href="#" class="btn btn-default print print-slip">
-                <i class="fa fa-print"></i> Print
-            </a>
-        </div>
-    [% END %]
-
-[% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
-    <div class="dialog alert"><strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.</div>
-[% ELSIF NOT Koha.Preference('AnonymousPatron') AND Koha.Preference('OPACPrivacy') %]
-    <div class="dialog alert"><strong>Error:</strong> The system preference OPACPrivacy is set but AnonymousPatron is not! Please correct this before continuing circulation.</div>
-[% END %]
-
-[% IF additional_materials %]
-    <div class="dialog message" id="materials">Note about the accompanying materials: <br />
-    [% additional_materials | html %]
-    </div>
-[% END %]
-
-[% IF ( collectionItemNeedsTransferred ) %]
- <div id="rotating-collection" class="dialog message">
-        <h3>Please transfer item to: [% Branches.GetName( collectionBranch ) | html %]</h3>
-            <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
-            <p>This item is part of a rotating collection.</p>
-            <p><button type="button" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% collectionBranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button></p>
-</div>
-[% END %]
 
-<!-- Patron has added an issue note -->
-[% IF ( issue.note) %]
-    <div class="dialog message">
-        <h1>Patron note</h1>
-        <p>[% issue.notedate | $KohaDates %]</p>
-        <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber | uri %]"> [% title | html %]</a> [% author | html %]</p>
-        <p>[% issue.note | html %]</p>
-    </div>
-[% END %]
-
-<!-- Patron has fines -->
-[% IF ( fines ) %]
-    <div class="dialog alert">
-        <h3>Patron has outstanding fines of [% fines | html %].</h3>
-        <p><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% fineborrowernumber | uri %]">Make payment</a>.</p>
-    </div>
-[% END %]
-
-<!-- Patron has waiting holds -->
-[% IF ( waiting_holds ) %]
-    <div id="awaiting-pickup" class="dialog message">
-        <h3>[% holdsfirstname | html %] [% holdssurname | html %] has [% waiting_holds | html %] hold(s) waiting for pickup.</h3>
-        <p><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% holdsborrowernumber | uri %]">Check out to this patron</a>.</p>
-    </div>
-[% END %]
-
-<!-- Patron is restricted and checkin was backdated -->
-[% IF return_date_was_overriden && Borrowers.IsDebarred( borrower ) %]
-    <div id="restricted_backdated" class="dialog message">
-        <h3>
-            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">
-                [% patron.firstname | html %] [% patron.surname | html %]
-            </a>
-            is restricted. Please verify this patron should still be restricted.
-        </h3>
-    </div>
-[% END %]
+                        [% IF hold_auto_filled %]
+                            <div class="dialog alert hold-auto-filled">
+                                [% IF ( reservenotes ) %]
+                                    <h4>Notes: [% reservenotes | html %]</h4>
+                                [% END %]
+                                <h3>Hold filled for:</h3>
+                                <ul>
+                                    <li>
+                                        [% INCLUDE 'patron-title.inc' patron=patron %]
+                                        <span class="patron-category"> - [% patron.category.description | html %]</span>
+                                    </li>
+
+                                    [% INCLUDE display_holdpatron_address %]
+
+                                    [% IF ( patron.phone ) %]
+                                        <li>[% patron.phone | html %]</li>
+                                    [% END %]
+
+                                    [% IF ( patron.email ) %]
+                                        <li>
+                                            [% IF ( transfertodo ) %]
+                                                [% patron.email | html %]
+                                            [% ELSE %]
+                                                <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
+                                            [% END %]
+                                        </li>
+                                    [% END %]
+
+                                    [% UNLESS ( transfertodo) %]
+                                        [% INCLUDE display_bormessagepref %]
+                                    [% END %]
+
+                                    [% IF ( patron.debarred ) %]
+                                        <li class="error">Patron is RESTRICTED</li>
+                                    [% END %]
+
+                                    [% IF ( patron.gonenoaddress ) %]
+                                        <li class="error">Patron's address is in doubt</li>
+                                    [% END %]
+                                </li>
 
-[% IF wrongbranch %]
-    <div id="wrong-branch-modal" class="modal fade audio-alert-action">
-        <div class="modal-dialog">
-            <div class="modal-content">
-                <form method="post" action="returns.pl" name="mainform" id="mainform">
-                    <div class="modal-header">
-                        <h3>
-                            Cannot check in
-                        </h3>
-                    </div>
-                    <div class="modal-body">
-                        <p>
-                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
-                            [% itembarcode | html %]: [% title | html %]
-                        </a>
-                        </p>
-                        <p>
-                            <strong>
-                                NOT CHECKED IN
-                            </strong>
-                        </p>
-                        <p>
-                            This item must be checked in at following library:
-                            <strong>
-                                [% Branches.GetName( rightbranch ) | html %]
-                            </strong>
-                        </p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
-                    </div>
-                </form>
-            </div>
-        </div>
-    </div>
-[% END %]
+                                [% IF ( transfertodo ) %]
+                                    <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                [% ELSE %]
+                                    <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                [% END %]
 
-<!-- case of a mistake in transfer loop -->
-[% IF WrongTransfer && !transfertodo %]
-    <div id="wrong-transfer-modal" class="modal fade audio-alert-action">
-        <div class="modal-dialog">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h3>
-                        Please return item to: [% Branches.GetName( TransferWaitingAt ) | html %]
-                    </h3>
-                </div>
-                <div class="modal-body">
-                    <p>
-                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
-                            [% itembarcode | html %]: [% title | html %]
-                        </a>
-                    </p>
-                </div>
-                <div class="modal-footer">
-                    <!-- CONFIRM -->
-                    <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
-                    <!-- PRINT SLIP -->
-                    <button type="button" data-dismiss="modal" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% TransferWaitingAt | html %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
-                    <!-- CANCEL TRANSFER -->
-                    <form method="post" action="returns.pl" name="mainform">
-                        <button class="btn btn-default deny" type="submit"><i class="fa fa-times"></i> Cancel transfer</button>
-                        <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-                        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-                        <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
-                        <input type="hidden" name="canceltransfer" value="1" />
-                        [% FOREACH inputloo IN inputloop %]
-                            <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                            <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                            <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                <a href="#" class="btn btn-default print print-slip">
+                                    <i class="fa fa-print"></i> Print
+                                </a>
+                            </div>
                         [% END %]
-                    </form>
-                </div>
-            </div>
-        </div>
-    </div>
-[% END %]
-
-[% IF ( found ) %]
-    [% IF ( waiting ) %]
-        <div id="hold-found1" class="modal fade audio-alert-action">
-            <div class="modal-dialog">
-            <div class="modal-content">
-            <form method="post" action="returns.pl" class="confirm">
-                <div class="modal-header">
-                    <h3>
-                        Hold found (item is already waiting):
-                        <br/>
-                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
-                        <div class="hold-found-barcode">
-                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | uri %]">[% itembarcode | html %]</a>
-                        </div>
-                    </h3>
-                </div>
-
-                <div class="modal-body">
-                    [% IF ( reservenotes ) %]
-                        <h4>Notes: [% reservenotes | html %]</h4>
-                    [% END %]
 
-                    <h4>Hold for:</h4>
-                    <ul>
-                    <li>
-                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.surname | html %], [% patron.firstname | html %]</a> ([% patron.cardnumber | html %])
-                        <span class="patron-category"> - [% patron.category.description | html %]</span>
-                    </li>
-                    [% INCLUDE display_holdpatron_address %]
-                    [% IF ( patron.phone ) %]
-                        <li> [% patron.phone | html %]</li>
-                    [% END %]
-
-                    [% IF ( patron.email ) %]
-                        <li><a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a></li>
-                    [% END %]
-
-                    [% IF ( patron.debarred ) %]
-                        <li class="error">Patron is RESTRICTED</li>
-                    [% END %]
-
-                    [% IF ( patron.gonenoaddress ) %]
-                        <li class="error">Patron's address is in doubt</li>
-                    [% END %]
-                    </ul>
-
-                    [% IF ( transfertodo ) %]
-                        <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-                    [% ELSE %]
-                        <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-                    [% END %]
-
-                    [% FOREACH inputloo IN inputloop %]
-                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
-                    [% END %]
-
-                    <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
-                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
-                    <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
-                    <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
-                    <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
-                    <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
-                    <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
-                    <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
-
-                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-                </div>
-
-                <div class="modal-footer">
-                    <input type="hidden" name="cancel_reserve" value="0" />
-
-                    <button type="submit" class="btn btn-default approve" data-dismiss="modal">
-                        <i class="fa fa-check"></i> Confirm hold
-                    </button>
-
-                    <input type="hidden" name="print_slip" value="0" />
-                    <button type="submit" class="btn btn-default print">
-                        <i class="fa fa-print"></i> Print slip and confirm
-                    </button>
-
-                    <button type="submit" class="btn btn-default deny cancel-hold">
-                        <i class="fa fa-times"></i> Cancel hold
-                    </button>
-                </div>
-            </form>
-           </div>
-           </div>
-        </div>
-    [% END %]
-
-    [% IF ( diffbranch ) %]
-		<!-- diffbranch -->
-        <div id="transfer-needed" class="dialog message audio-alert-action">
-            <h3>Hold needing transfer found</h3>
-                <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
-                <h4>Hold for: </h4>
-                    <ul>
-                        <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.surname | html %], [% patron.firstname | html %]</a> ([% patron.cardnumber | html %]) <span class="patron-category"> - [% patron.category.description | html %]</span> </li>
-                        [% INCLUDE display_holdpatron_address %]
-                        [% IF ( patron.phone ) %]<li>[% patron.phone | html %]</li>[% END %]
-                        [% IF ( patron.email ) %]<li>[% IF ( transfertodo ) %][% patron.email | html %][% ELSE %]<a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>[% END %]</li>[% END %]
-[% IF ( patron.debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
-[% IF ( patron.gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]
-                    </ul>
-        [% IF ( transfertodo ) %]
-            <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-        [% ELSE %]
-            <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-        [% END %]
-
-        <form method="post" action="returns.pl" class="confirm">
-            <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button>
-            <input type="hidden" name="print_slip" value="0" />
-            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
-            <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
-            <button type="submit" class="print"><i class="fa fa-print"></i> Print slip and continue</button>
-            [% FOREACH inputloo IN inputloop %]
-                <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
-            [% END %]
-            <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
-            <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
-            <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
-            <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
-            <input type="hidden" name="barcode" value="0" />
-
-            <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-            <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-        </form>
-		</div>
-    [% END %]
-
-    [% IF transfer || needstransfer %]
-    <div id="item-transfer-modal" class="modal fade audio-alert-action">
-        <div class="modal-dialog">
-            <div class="modal-content">
-                <form method="post" action="returns.pl" name="mainform" id="mainform">
-                    <div class="modal-header">
-                        <h3>
-                            Please return this item to [% Branches.GetName( returnbranch ) | html %]
-                        </h3>
-                    </div>
-                    <div class="modal-body">
-                        <p>
-                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
-                            [% itembarcode | html %]: [% title | html %]
-                        </a>
-                        </p>
-                        [% IF !transfer %]
-                        <p>
-                        Transfer now?
-                        </p>
-                        [% END %]
-                        <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
-                        <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
-                        <input type="hidden" name="barcode" value="0" />
-                    </div>
-                    <div class="modal-footer">
-                        [% IF !transfer %]
-                        <button type="submit" name="dotransfer" value="Yes" class="btn btn-default approve"><i class="fa fa-check"></i> Yes</button>
-                        <button type="submit" name="dotransfer" value="Yes" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Yes, print slip</button>
-                        <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
-                        [% ELSE %]
-                        <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
-                        <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button>
-                        [% END %]
-                        <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-                        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-                        <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
-                        <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
-                        <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
-                        [% FOREACH inputloo IN inputloop %]
-                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                        [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
+                            <div class="dialog alert">
+                                <strong>Error:</strong>
+                                This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.
+                            </div>
+                        [% ELSIF NOT Koha.Preference('AnonymousPatron') AND Koha.Preference('OPACPrivacy') %]
+                            <div class="dialog alert">
+                                <strong>Error:</strong>
+                                The system preference OPACPrivacy is set but AnonymousPatron is not! Please correct this before continuing circulation.
+                            </div>
                         [% END %]
-                    </div>
-                </form>
-            </div>
-        </div>
-    </div>
-    [% END %]
-
-    [% IF ( diffbranch ) %]
-	<!-- diffbranch -->
-        <h3 class="audio-alert-action">Item consigned:</h3>
-        <table>
-        <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a></caption>
-        <tr>
-            <th>Hold for:</th>
-            <td>[% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
-        </tr>
-        </table>
-        <form method="post" action="returns.pl"><input type="submit" value="OK" />
-            [% FOREACH inputloo IN inputloop %]
-                [% UNLESS ( inputloo.first ) %]
-                    <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                    <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                    <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
-                [% END %]
-            [% END %]
-
-            <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-            <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-
-            <input type="hidden" name="barcode" value="0" />
-        </form>
-    [% END %]
-
-
-    <!-- case of simple return no issue or transfer but with a reservation  -->
-    [% IF ( reserved ) %]
-	<!--  reserved  -->
-        <div id="hold-found2" class="modal fade audio-alert-action">
-            <div class="modal-dialog">
-            <div class="modal-content">
-            <form method="post" action="returns.pl" class="confirm">
-                <div class="modal-header">
-                    <h3>
-                        Hold found:
-                        <br/>
-                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
-                        <div class="hold-found-barcode">
-                            (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | html %]">[% itembarcode | html %]</a>)
-                        </div>
-                    </h3>
-                </div>
-
-                <div class="modal-body">
-                    [% IF ( reservenotes ) %]
-                        <h4>Notes:</h4>
-                        <p>[% reservenotes | html %]</p>
-                        <hr />
-                    [% END %]
-                    <h5>Hold for:</h5>
-                        <ul>
-                        <li>
-                            [% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]
-                            <span class="patron-category"> - [% patron.category.description | html %]</span>
-                        </li>
 
-                        [% INCLUDE display_holdpatron_address %]
-
-                        [% IF ( patron.phone ) %]
-                            <li>[% patron.phone | html %]</li>
+                        [% IF additional_materials %]
+                            <div class="dialog message" id="materials">
+                                Note about the accompanying materials: <br />
+                                [% additional_materials | html %]
+                            </div>
                         [% END %]
 
-                        [% IF ( patron.email ) %]
-                            <li>
-                                [% IF ( transfertodo ) %]
-                                    [% patron.email | html %]
-                                [% ELSE %]
-                                    <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
-                                [% END %]
-                            </li>
+                        [% IF ( collectionItemNeedsTransferred ) %]
+                             <div id="rotating-collection" class="dialog message">
+                                <h3>Please transfer item to: [% Branches.GetName( collectionBranch ) | html %]</h3>
+                                <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
+                                <p>This item is part of a rotating collection.</p>
+                                <p><button type="button" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% collectionBranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button></p>
+                            </div>
                         [% END %]
 
-                        [% UNLESS ( transfertodo) %]
-                            [% INCLUDE display_bormessagepref %]
+                        <!-- Patron has added an issue note -->
+                        [% IF ( issue.note) %]
+                            <div class="dialog message">
+                                <h1>Patron note</h1>
+                                <p>[% issue.notedate | $KohaDates %]</p>
+                                <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber | uri %]"> [% title | html %]</a> [% author | html %]</p>
+                                <p>[% issue.note | html %]</p>
+                            </div>
                         [% END %]
 
-                        [% IF ( patron.debarred ) %]
-                            <li class="error">Patron is RESTRICTED</li>
+                        <!-- Patron has fines -->
+                        [% IF ( fines ) %]
+                            <div class="dialog alert">
+                                <h3>Patron has outstanding fines of [% fines | html %].</h3>
+                                <p><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% fineborrowernumber | uri %]">Make payment</a>.</p>
+                            </div>
                         [% END %]
 
-                        [% IF ( patron.gonenoaddress ) %]
-                            <li class="error">Patron's address is in doubt</li>
+                        <!-- Patron has waiting holds -->
+                        [% IF ( waiting_holds ) %]
+                            <div id="awaiting-pickup" class="dialog message">
+                                <h3>[% holdsfirstname | html %] [% holdssurname | html %] has [% waiting_holds | html %] hold(s) waiting for pickup.</h3>
+                                <p><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% holdsborrowernumber | uri %]">Check out to this patron</a>.</p>
+                            </div>
                         [% END %]
-                        </ul>
-                    [% IF ( transfertodo ) %]
-                        <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-                    [% ELSE %]
-                        <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
-                    [% END %]
-
-                    <input type="hidden" name="print_slip" value="0" />
-
 
-                    [% FOREACH inputloo IN inputloop %]
-                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
-                    [% END %]
+                        <!-- Patron is restricted and checkin was backdated -->
+                        [% IF return_date_was_overriden && Borrowers.IsDebarred( borrower ) %]
+                            <div id="restricted_backdated" class="dialog message">
+                                <h3>
+                                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">
+                                        [% patron.firstname | html %] [% patron.surname | html %]
+                                    </a>
+                                    is restricted. Please verify this patron should still be restricted.
+                                </h3>
+                            </div>
+                        [% END %]
 
-                    <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
-                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
-                    <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
-                    <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
-                    <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
-                    <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
-                    <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
-                    <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
-                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
-                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
-                </div>
-
-                <div class="modal-footer">
-                    [% IF ( transfertodo ) %]
-                        <button type="submit" class="btn btn-default approve">
-                            <i class="fa fa-check"></i> Confirm hold and transfer
-                        </button>
-                        <button type="submit" class="btn btn-default print">
-                            <i class="fa fa-print"></i> Print slip, transfer, and confirm
-                        </button>
-                    [% ELSE %]
-                        <button type="submit" class="btn btn-default approve">
-                            <i class="fa fa-check"></i> Confirm hold
-                        </button>
-                        <button type="submit" class="btn btn-default print">
-                            <i class="fa fa-print"></i> Print slip and confirm
-                        </button>
-                    [% END %]
+                        [% IF wrongbranch %]
+                            <div id="wrong-branch-modal" class="modal fade audio-alert-action">
+                                <div class="modal-dialog">
+                                    <div class="modal-content">
+                                        <form method="post" action="returns.pl" name="mainform" id="mainform">
+                                            <div class="modal-header">
+                                                <h3>
+                                                    Cannot check in
+                                                </h3>
+                                            </div>
+                                            <div class="modal-body">
+                                                <p>
+                                                    <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
+                                                        [% itembarcode | html %]: [% title | html %]
+                                                    </a>
+                                                </p>
+                                                <p>
+                                                    <strong>
+                                                        NOT CHECKED IN
+                                                    </strong>
+                                                </p>
+                                                <p>
+                                                    This item must be checked in at following library:
+                                                    <strong>
+                                                        [% Branches.GetName( rightbranch ) | html %]
+                                                    </strong>
+                                                </p>
+                                            </div>
+                                            <div class="modal-footer">
+                                                <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            </div>
+                        [% END %]
 
-                    <button data-dismiss="modal" aria-hidden="true" type="submit" class="btn btn-default deny">
-                        <i class="fa fa-times"></i> Ignore
-                    </button>
-                </div>
-            </form>
-            </div>
-            </div>
-        </div>
-    [% END %]
-[% END %]
+                        <!-- case of a mistake in transfer loop -->
+                        [% IF WrongTransfer && !transfertodo %]
+                            <div id="wrong-transfer-modal" class="modal fade audio-alert-action">
+                                <div class="modal-dialog">
+                                    <div class="modal-content">
+                                        <div class="modal-header">
+                                            <h3>
+                                                Please return item to: [% Branches.GetName( TransferWaitingAt ) | html %]
+                                            </h3>
+                                        </div>
+                                        <div class="modal-body">
+                                            <p>
+                                                <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
+                                                    [% itembarcode | html %]: [% title | html %]
+                                                </a>
+                                            </p>
+                                        </div>
+                                        <div class="modal-footer">
+                                            <!-- CONFIRM -->
+                                            <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
+                                            <!-- PRINT SLIP -->
+                                            <button type="button" data-dismiss="modal" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% TransferWaitingAt | html %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
+                                            <!-- CANCEL TRANSFER -->
+                                            <form method="post" action="returns.pl" name="mainform">
+                                                <button class="btn btn-default deny" type="submit"><i class="fa fa-times"></i> Cancel transfer</button>
+                                                <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                                <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                                <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
+                                                <input type="hidden" name="canceltransfer" value="1" />
+                                                [% FOREACH inputloo IN inputloop %]
+                                                    <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                                    <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                                    <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                                [% END %]
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        [% END %]
 
-[% IF ( errmsgloop ) %]
-    <div class="dialog alert audio-alert-warning">
-        <h3>Check in message</h3>
-        [% IF itembiblionumber %]
-            <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
-        [% END %]
-        [% FOREACH errmsgloo IN errmsgloop %]
-            [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
-                <p class="problem">
-                    Not for loan status updated.
-                    <br />Old value:
-                    [% IF errmsgloo.NotForLoanStatusUpdated.from %]
-                        [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.from ) | html %].
-                    [% ELSE %]
-                        Available for loan.
-                    [% END %]
-                    <br />New value:
-                    [% IF errmsgloo.NotForLoanStatusUpdated.to %]
-                        [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) | html %].
-                    [% ELSE %]
-                        Available for loan.
-                    [% END %]
-                </p>
-            [% END %]
-            [% IF ( errmsgloo.ItemLocationUpdated ) %]
-                 <p class="problem">
-                     Item shelving location updated.
-                    <br />Old value:
-                    [% IF errmsgloo.ItemLocationUpdated.from %]
-                        [% IF errmsgloo.ItemLocationUpdated.from == '' %]
-                            empty
-                        [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) == '' %]
-                            [% errmsgloo.ItemLocationUpdated.from | html %] (No description available)
-                        [% ELSE %]
-                            [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) | html %]
+                        [% IF ( found ) %]
+                            [% IF ( waiting ) %]
+                                <div id="hold-found1" class="modal fade audio-alert-action">
+                                    <div class="modal-dialog">
+                                        <div class="modal-content">
+                                            <form method="post" action="returns.pl" class="confirm">
+                                                <div class="modal-header">
+                                                    <h3>
+                                                        Hold found (item is already waiting):
+                                                        <br/>
+                                                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
+                                                        <div class="hold-found-barcode">
+                                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | uri %]">[% itembarcode | html %]</a>
+                                                        </div>
+                                                    </h3>
+                                                </div>
+
+                                                <div class="modal-body">
+                                                    [% IF ( reservenotes ) %]
+                                                        <h4>Notes: [% reservenotes | html %]</h4>
+                                                    [% END %]
+
+                                                    <h4>Hold for:</h4>
+                                                    <ul>
+                                                        <li>
+                                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.surname | html %], [% patron.firstname | html %]</a> ([% patron.cardnumber | html %])
+                                                            <span class="patron-category"> - [% patron.category.description | html %]</span>
+                                                        </li>
+                                                        [% INCLUDE display_holdpatron_address %]
+                                                        [% IF ( patron.phone ) %]
+                                                            <li> [% patron.phone | html %]</li>
+                                                        [% END %]
+
+                                                        [% IF ( patron.email ) %]
+                                                            <li><a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a></li>
+                                                        [% END %]
+
+                                                        [% IF ( patron.debarred ) %]
+                                                            <li class="error">Patron is RESTRICTED</li>
+                                                        [% END %]
+
+                                                        [% IF ( patron.gonenoaddress ) %]
+                                                            <li class="error">Patron's address is in doubt</li>
+                                                        [% END %]
+                                                    </ul>
+
+                                                    [% IF ( transfertodo ) %]
+                                                        <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                                    [% ELSE %]
+                                                        <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                                    [% END %]
+
+                                                    [% FOREACH inputloo IN inputloop %]
+                                                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                                    [% END %]
+
+                                                    <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
+                                                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
+                                                    <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
+                                                    <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
+                                                    <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
+                                                    <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
+                                                    <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
+                                                    <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
+
+                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                                </div>
+
+                                                <div class="modal-footer">
+                                                    <input type="hidden" name="cancel_reserve" value="0" />
+
+                                                    <button type="submit" class="btn btn-default approve" data-dismiss="modal">
+                                                        <i class="fa fa-check"></i> Confirm hold
+                                                    </button>
+
+                                                    <input type="hidden" name="print_slip" value="0" />
+                                                    <button type="submit" class="btn btn-default print">
+                                                        <i class="fa fa-print"></i> Print slip and confirm
+                                                    </button>
+
+                                                    <button type="submit" class="btn btn-default deny cancel-hold">
+                                                        <i class="fa fa-times"></i> Cancel hold
+                                                    </button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+                            [% END %]
+
+                            [% IF ( diffbranch ) %]
+                                <!-- diffbranch -->
+                                <div id="transfer-needed" class="dialog message audio-alert-action">
+                                    <h3>Hold needing transfer found</h3>
+                                    <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
+                                    <h4>Hold for: </h4>
+                                    <ul>
+                                        <li>
+                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.surname | html %], [% patron.firstname | html %]</a> ([% patron.cardnumber | html %]) <span class="patron-category"> - [% patron.category.description | html %]</span>
+                                        </li>
+                                        [% INCLUDE display_holdpatron_address %]
+                                        [% IF ( patron.phone ) %]
+                                            <li>[% patron.phone | html %]</li>
+                                        [% END %]
+                                        [% IF ( patron.email ) %]
+                                            <li>
+                                                [% IF ( transfertodo ) %]
+                                                    [% patron.email | html %]
+                                                [% ELSE %]
+                                                    <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
+                                                [% END %]
+                                            </li>
+                                        [% END %]
+                                        [% IF ( patron.debarred ) %]
+                                            <li class="error">Patron is RESTRICTED</li>
+                                        [% END %]
+                                        [% IF ( patron.gonenoaddress ) %]
+                                            <li class="error">Patron's address is in doubt</li>
+                                        [% END %]
+                                    </ul>
+
+                                    [% IF ( transfertodo ) %]
+                                        <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                    [% ELSE %]
+                                        <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                    [% END %]
+
+                                    <form method="post" action="returns.pl" class="confirm">
+                                        <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button>
+                                        <input type="hidden" name="print_slip" value="0" />
+                                        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
+                                        <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
+                                        <button type="submit" class="print"><i class="fa fa-print"></i> Print slip and continue</button>
+                                        [% FOREACH inputloo IN inputloop %]
+                                            <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                            <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                            <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                        [% END %]
+                                        <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
+                                        <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
+                                        <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
+                                        <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
+                                        <input type="hidden" name="barcode" value="0" />
+
+                                        <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                    </form>
+                                </div>
+                            [% END %]
+
+                            [% IF transfer || needstransfer %]
+                                <div id="item-transfer-modal" class="modal fade audio-alert-action">
+                                    <div class="modal-dialog">
+                                        <div class="modal-content">
+                                            <form method="post" action="returns.pl" name="mainform" id="mainform">
+                                                <div class="modal-header">
+                                                    <h3>
+                                                        Please return this item to [% Branches.GetName( returnbranch ) | html %]
+                                                    </h3>
+                                                </div>
+                                                <div class="modal-body">
+                                                    <p>
+                                                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
+                                                            [% itembarcode | html %]: [% title | html %]
+                                                        </a>
+                                                    </p>
+                                                    [% IF !transfer %]
+                                                        <p>
+                                                        Transfer now?
+                                                        </p>
+                                                    [% END %]
+                                                    <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
+                                                    <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
+                                                    <input type="hidden" name="barcode" value="0" />
+                                                </div>
+                                                <div class="modal-footer">
+                                                    [% IF !transfer %]
+                                                        <button type="submit" name="dotransfer" value="Yes" class="btn btn-default approve"><i class="fa fa-check"></i> Yes</button>
+                                                        <button type="submit" name="dotransfer" value="Yes" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Yes, print slip</button>
+                                                        <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
+                                                    [% ELSE %]
+                                                        <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
+                                                        <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button>
+                                                    [% END %]
+                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                                    <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
+                                                    <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
+                                                    <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
+                                                    [% FOREACH inputloo IN inputloop %]
+                                                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                                    [% END %]
+                                                </div>
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+                            [% END %]
+
+                            [% IF ( diffbranch ) %]
+                                <!-- diffbranch -->
+                                <h3 class="audio-alert-action">Item consigned:</h3>
+                                <table>
+                                    <caption><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a></caption>
+                                    <tr>
+                                        <th>Hold for:</th>
+                                        <td>[% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
+                                    </tr>
+                                </table>
+                                <form method="post" action="returns.pl">
+                                    <input type="submit" value="OK" />
+                                    [% FOREACH inputloo IN inputloop %]
+                                        [% UNLESS ( inputloo.first ) %]
+                                            <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                            <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                            <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                        [% END %]
+                                    [% END %]
+
+                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                    <input type="hidden" name="barcode" value="0" />
+                                </form>
+                            [% END %]
+
+                            <!-- case of simple return no issue or transfer but with a reservation  -->
+                            [% IF ( reserved ) %]
+                                <!-- reserved -->
+                                <div id="hold-found2" class="modal fade audio-alert-action">
+                                    <div class="modal-dialog">
+                                        <div class="modal-content">
+                                            <form method="post" action="returns.pl" class="confirm">
+                                                <div class="modal-header">
+                                                    <h3>
+                                                        Hold found:
+                                                        <br/>
+                                                        <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
+                                                        <div class="hold-found-barcode">
+                                                            (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | html %]">[% itembarcode | html %]</a>)
+                                                        </div>
+                                                    </h3>
+                                                </div>
+
+                                                <div class="modal-body">
+                                                    [% IF ( reservenotes ) %]
+                                                        <h4>Notes:</h4>
+                                                        <p>[% reservenotes | html %]</p>
+                                                        <hr />
+                                                    [% END %]
+                                                    <h5>Hold for:</h5>
+                                                    <ul>
+                                                        <li>
+                                                            [% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]
+                                                            <span class="patron-category"> - [% patron.category.description | html %]</span>
+                                                        </li>
+
+                                                        [% INCLUDE display_holdpatron_address %]
+
+                                                        [% IF ( patron.phone ) %]
+                                                            <li>[% patron.phone | html %]</li>
+                                                        [% END %]
+
+                                                        [% IF ( patron.email ) %]
+                                                            <li>
+                                                                [% IF ( transfertodo ) %]
+                                                                    [% patron.email | html %]
+                                                                [% ELSE %]
+                                                                    <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
+                                                                [% END %]
+                                                            </li>
+                                                        [% END %]
+
+                                                        [% UNLESS ( transfertodo) %]
+                                                            [% INCLUDE display_bormessagepref %]
+                                                        [% END %]
+
+                                                        [% IF ( patron.debarred ) %]
+                                                            <li class="error">Patron is RESTRICTED</li>
+                                                        [% END %]
+
+                                                        [% IF ( patron.gonenoaddress ) %]
+                                                            <li class="error">Patron's address is in doubt</li>
+                                                        [% END %]
+                                                    </ul>
+                                                    [% IF ( transfertodo ) %]
+                                                        <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                                    [% ELSE %]
+                                                        <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                                    [% END %]
+
+                                                    <input type="hidden" name="print_slip" value="0" />
+
+
+                                                    [% FOREACH inputloo IN inputloop %]
+                                                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                                    [% END %]
+
+                                                    <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
+                                                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
+                                                    <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
+                                                    <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
+                                                    <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
+                                                    <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
+                                                    <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
+                                                    <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
+                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                                                </div>
+
+                                                <div class="modal-footer">
+                                                    [% IF ( transfertodo ) %]
+                                                        <button type="submit" class="btn btn-default approve">
+                                                            <i class="fa fa-check"></i> Confirm hold and transfer
+                                                        </button>
+                                                        <button type="submit" class="btn btn-default print">
+                                                            <i class="fa fa-print"></i> Print slip, transfer, and confirm
+                                                        </button>
+                                                    [% ELSE %]
+                                                        <button type="submit" class="btn btn-default approve">
+                                                            <i class="fa fa-check"></i> Confirm hold
+                                                        </button>
+                                                        <button type="submit" class="btn btn-default print">
+                                                            <i class="fa fa-print"></i> Print slip and confirm
+                                                        </button>
+                                                    [% END %]
+
+                                                    <button data-dismiss="modal" aria-hidden="true" type="submit" class="btn btn-default deny">
+                                                        <i class="fa fa-times"></i> Ignore
+                                                    </button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+                            [% END %]
                         [% END %]
-                    [% ELSE %]
-                        "Blank"
-                    [% END %]
-                    <br />New value:
-                    [% IF errmsgloo.ItemLocationUpdated.to %]
-                        [% IF errmsgloo.ItemLocationUpdated.to == '' %]
-                            empty
-                        [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) == '' %]
-                            [% errmsgloo.ItemLocationUpdated.to | html %] (Not an authorized value)
-                        [% ELSE %]
-                            [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) | html %]
+
+                        [% IF ( errmsgloop ) %]
+                            <div class="dialog alert audio-alert-warning">
+                                <h3>Check in message</h3>
+                                [% IF itembiblionumber %]
+                                    <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
+                                [% END %]
+                                [% FOREACH errmsgloo IN errmsgloop %]
+                                    [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
+                                        <p class="problem">
+                                            Not for loan status updated.
+                                            <br />Old value:
+                                            [% IF errmsgloo.NotForLoanStatusUpdated.from %]
+                                                [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.from ) | html %].
+                                            [% ELSE %]
+                                                Available for loan.
+                                            [% END %]
+                                            <br />New value:
+                                            [% IF errmsgloo.NotForLoanStatusUpdated.to %]
+                                                [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) | html %].
+                                            [% ELSE %]
+                                                Available for loan.
+                                            [% END %]
+                                        </p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.ItemLocationUpdated ) %]
+                                         <p class="problem">
+                                             Item shelving location updated.
+                                            <br />Old value:
+                                            [% IF errmsgloo.ItemLocationUpdated.from %]
+                                                [% IF errmsgloo.ItemLocationUpdated.from == '' %]
+                                                    empty
+                                                [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) == '' %]
+                                                    [% errmsgloo.ItemLocationUpdated.from | html %] (No description available)
+                                                [% ELSE %]
+                                                    [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) | html %]
+                                                [% END %]
+                                            [% ELSE %]
+                                                "Blank"
+                                            [% END %]
+                                            <br />New value:
+                                            [% IF errmsgloo.ItemLocationUpdated.to %]
+                                                [% IF errmsgloo.ItemLocationUpdated.to == '' %]
+                                                    empty
+                                                [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) == '' %]
+                                                    [% errmsgloo.ItemLocationUpdated.to | html %] (Not an authorized value)
+                                                [% ELSE %]
+                                                    [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) | html %]
+                                                [% END %]
+                                            [% ELSE %]
+                                                "Blank"
+                                            [% END %]
+                                         </p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.badbarcode ) %]
+                                        <p class="problem">No item with barcode: [% errmsgloo.msg | html %]</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.ispermanent ) %]
+                                        <p class="problem">Please return item to: [% Branches.GetName( errmsgloo.msg ) | html %]</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.notissued ) %]
+                                        <p class="problem">Not checked out.</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.localuse) %]
+                                        <p class="problem">Local use recorded</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.waslost ) %]
+                                        [% IF Koha.Preference('BlockReturnOfLostItems') %]
+                                            <p class="problem">Item is lost, cannot be checked in.</p>
+                                        [% ELSE %]
+                                            <p class="problem">Item was lost, now found.</p>
+                                        [% END %]
+                                        [% IF LostItemFeeRefunded and not Koha.Preference('BlockReturnOfLostItems') %]
+                                            <p class="problem">A refund has been applied to the borrowing patron's account.</p>
+                                        [% ELSIF Koha.Preference('BlockReturnOfLostItems') %]
+                                           <h5>Cannot check in</h5>
+                                           <p><strong>NOT CHECKED IN</strong></p>
+                                        [% ELSE %]
+                                            <p class="problem">Any lost item fees for this item will remain on the patron's account.</p>
+                                        [% END %]
+                                    [% END %]
+                                    [% IF ( errmsgloo.withdrawn ) %]
+                                        [% IF Koha.Preference('BlockReturnOfWithdrawnItems') %]
+                                           <h5>Cannot check in</h5>
+                                           <p><strong>NOT CHECKED IN</strong></p>
+                                        [% END %]
+                                       <p class="problem">Item is withdrawn.</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.debarred ) %]
+                                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.prevdebarred ) %]
+                                        <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %].</p>
+                                    [% END %]
+                                    [% IF ( errmsgloo.foreverdebarred ) %]
+                                        <p class="problem"><b>Reminder: </b>Patron has an indefinite restriction.</p>
+                                    [% END %]
+
+                                    [% IF errmsgloo.data_corrupted %]
+                                        <p class="problem">The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a> and search for the "data problems" section</p>
+                                    [% END %]
+                                [% END %]
+                            </div>
                         [% END %]
-                    [% ELSE %]
-                        "Blank"
-                    [% END %]
-                 </p>
-            [% END %]
-            [% IF ( errmsgloo.badbarcode ) %]
-                <p class="problem">No item with barcode: [% errmsgloo.msg | html %]</p>
-            [% END %]
-            [% IF ( errmsgloo.ispermanent ) %]
-                <p class="problem">Please return item to: [% Branches.GetName( errmsgloo.msg ) | html %]</p>
-            [% END %]
-            [% IF ( errmsgloo.notissued ) %]
-                <p class="problem">Not checked out.</p>
-            [% END %]
-            [% IF ( errmsgloo.localuse) %]
-                <p class="problem">Local use recorded</p>
-            [% END %]
-            [% IF ( errmsgloo.waslost ) %]
-                [% IF Koha.Preference('BlockReturnOfLostItems') %]
-                    <p class="problem">Item is lost, cannot be checked in.</p>
-                [% ELSE %]
-                    <p class="problem">Item was lost, now found.</p>
-                [% END %]
-                [% IF LostItemFeeRefunded and not Koha.Preference('BlockReturnOfLostItems') %]
-                    <p class="problem">A refund has been applied to the borrowing patron's account.</p>
-                [% ELSIF Koha.Preference('BlockReturnOfLostItems') %]
-                   <h5>Cannot check in</h5>
-                   <p><strong>NOT CHECKED IN</strong></p>
-                [% ELSE %]
-                    <p class="problem">Any lost item fees for this item will remain on the patron's account.</p>
-                [% END %]
-            [% END %]
-            [% IF ( errmsgloo.withdrawn ) %]
-                [% IF Koha.Preference('BlockReturnOfWithdrawnItems') %]
-                   <h5>Cannot check in</h5>
-                   <p><strong>NOT CHECKED IN</strong></p>
-                [% END %]
-               <p class="problem">Item is withdrawn.</p>
-            [% END %]
-            [% IF ( errmsgloo.debarred ) %]
-                <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p>
-            [% END %]
-            [% IF ( errmsgloo.prevdebarred ) %]
-                <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %].</p>
-            [% END %]
-            [% IF ( errmsgloo.foreverdebarred ) %]
-                <p class="problem"><b>Reminder: </b>Patron has an indefinite restriction.</p>
-            [% END %]
 
-            [% IF errmsgloo.data_corrupted %]
-                <p class="problem">The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a> and search for the "data problems" section</p>
-            [% END %]
-        [% END %]
-    </div>
-[% END %]
+                        [% IF ( checkinmsg ) %]
+                            [% IF ( checkinmsgtype == 'alert' ) %]
+                                <div class="dialog alert">
+                            [% ELSE %]
+                                <div class="dialog message">
+                            [% END %]
+                                    <p class="problem">[% checkinmsg | html_line_break %]</p>
+                                </div>
+                        [% END%]
+
+                        <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
+                            <fieldset id="circ_returns_checkin">
+                                <h3>Check in</h3>
+                                <div class="row">
+                                    <div class="col-sm-6">
+                                        <div class="hint">Enter item barcode:</div>
+                                            <div class="form-control-group">
+                                                [% IF ( exemptfine ) %]
+                                                    <input name="barcode" id="barcode" size="14" class="focus input-warning" type="text" />
+                                                [% ELSIF ( dropboxmode ) %]
+                                                    <input name="barcode" id="barcode" size="14" class="barcode focus input-warning" />
+                                                [% ELSE %]
+                                                    <input name="barcode" id="barcode" size="14" class="barcode focus" />
+                                                [% END %]
+                                                <button type="submit" class="btn btn-default">Check in</button>
+                                                [% FOREACH inputloo IN inputloop %]
+                                                    <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
+                                                    <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
+                                                    <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                                                [% END %]
+                                            </div>
+                                        <div id="show-circ-settings">
+                                            <a href="#"><i class="fa circ-settings-icon fa-caret-down"></i> Checkin settings</a>
+                                        </div>
+                                    </div>
+                                    <div class="col-sm-6">
+                                        [% IF ( exemptfine ) %]
+                                            <div id="exemptfines" class="checkin-active-setting">
+                                        [% ELSE %]
+                                            <div id="exemptfines" class="checkin-active-setting" style="display:none;">
+                                        [% END %]
+                                            <p><i class="fa fa-check"></i> Fines for returned items are forgiven.</p>
+                                        </div>
+
+                                        [% IF ( forgivemanualholdsexpire ) %]
+                                            <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting">
+                                        [% ELSE %]
+                                            <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting" style="display:none;">
+                                        [% END %]
+                                                <p><i class="fa fa-check"></i> Fines are not charged for manually cancelled holds.</p>
+                                            </div>
+
+                                        [% IF ( dropboxmode ) %]
+                                            <div id="dropboxmode" class="checkin-active-setting">
+                                        [% ELSE %]
+                                            <div id="dropboxmode" class="checkin-active-setting" style="display:none;">
+                                        [% END %]
+                                            <p><i class="fa fa-check"></i> Book drop mode. <span class="single-line">( Effective checkin date is [% dropboxdate | $KohaDates with_hours => 1 %] )</span></p>
+                                        </div>
+                                        [% IF ( return_date_override_remember ) %]
+                                            <div id="return_date_remember" class="checkin-active-setting">
+                                        [% ELSE %]
+                                            <div id="return_date_remember" class="checkin-active-setting" style="display:none;">
+                                        [% END %]
+                                            <p><i class="fa fa-check"></i> Saved check-in date: <span id="saved_return_date" class="single-line">[% return_date_override | html %]</span></p>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <div class="circ-settings">
+                                    [% IF Koha.Preference('SpecifyReturnDate') %]
+                                        <div class="date-select" id="return_date_override_fields">
+                                            <div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
+
+                                            <input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
+
+
+
+                                            <button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
+                                            <div class="circ-setting">
+                                                [% IF ( return_date_override_remember ) %]
+                                                    <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
+                                                [% ELSE %]
+                                                    <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" />
+                                                [% END %]
+                                                <label for="return_date_override_remember"> Remember due date for next check in</label>
+                                            </div>
+                                        </div>
+                                    [% END %]
+
+                                    [% IF ( CAN_user_updatecharges_writeoff && overduecharges ) %]
+                                        <div id="forgive-overdue-fines" class="circ-setting">
+                                            [% IF ( exemptfine ) %]
+                                                <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" checked="checked" />
+                                            [% ELSE %]
+                                                <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" />
+                                            [% END %]
+                                            <label for="exemptcheck">Forgive overdue charges</label>
+                                        </div>
+                                    [% END %] <!-- overduecharges -->
+
+                                    <div id="book-drop-mode" class="circ-setting">
+                                        [% IF ( dropboxmode ) %]
+                                            <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" checked="checked" />
+                                        [% ELSE %]
+                                            <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" />
+                                        [% END %]
+                                        <label for="dropboxcheck">Book drop mode</label>
+                                    </div>
+
+                                    [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
+                                        <div class="forgive-manual-hold-fees circ-setting">
+                                            [% IF ( forgivemanualholdsexpire ) %]
+                                                <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" checked="checked" />
+                                            [% ELSE %]
+                                                <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" />
+                                            [% END %]
+                                            <label for="forgivemanualholdsexpire">Forgive fees for manually expired holds</label>
+                                        </div>
+                                    [% END %] <!-- overduecharges -->
+
+                                </div> <!-- /.circ-settings -->
+                            </fieldset> <!-- /#circ_returns_checkin -->
+                        </form> <!-- /#checkin-form -->
+
+                        [% IF ( riloop ) %]
+                            <h2>Checked-in items</h2>
+                            <table id="checkedintable">
+                                <thead>
+                                    <tr>
+                                        <th class="ci-duedate">Due date</th>
+                                        <th class="ci-title">Title</th>
+                                        <th class="ci-author">Author</th>
+                                        <th class="ci-barcode">Barcode</th>
+                                        <th class="ci-homelibrary">Home library</th>
+                                        <th class="ci-holdinglibrary">Holding library</th>
+                                        <th class="ci-shelvinglocation">Shelving location</th>
+                                        <th class="ci-callnumber">Call number</th>
+                                        <th class="ci-dateaccessioned">Date acquired</th>
+                                        <th class="ci-type">Type</th>
+                                        <th class="ci-patron">Patron</th>
+                                        <th class="ci-note">Note</th>
+                                    </tr>
+                                </thead>
+
+                                [% FOREACH riloo IN riloop %]
+                                    <tr>
+                                        <td class="ci-duedate">
+                                            [% IF ( riloo.duedate ) %]
+                                                [% IF ( riloo.return_overdue ) %]
+                                                    <span class="overdue">[% riloo.duedate | html %] (overdue)</span>
+                                                [% ELSE %]
+                                                    [% riloo.duedate | html %]
+                                                [% END %]
+                                            [% ELSE %]
+                                                Not checked out
+                                            [% END %]
+                                        </td>
+                                        <td class="ci-title">
+                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% riloo.itembiblionumber | uri %]">
+                                                [% riloo.itemtitle | html %]
+                                            </a>
+                                            [% IF ( riloo.enumchron ) %]
+                                                <br/>
+                                                <span class="item_enumeration" style="white-space: nowrap;">[% riloo.enumchron | html %]</span>
+                                            [% END %]
+                                        </td>
+                                        <td class="ci-author">[% riloo.itemauthor | html %]</td>
+                                        <td class="ci-barcode">
+                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber | uri %]&amp;itemnumber=[% riloo.itemnumber | uri %]#item[% riloo.itemnumber | uri %]">[% riloo.barcode | html %]</a>
+                                        </td>
+                                        <td class="ci-homelibrary">
+                                            [% Branches.GetName( riloo.homebranch ) | html %]
+                                        </td>
+                                        <td class="ci-holdinglibrary">
+                                            [% Branches.GetName( riloo.holdingbranch ) | html %]
+                                        </td>
+                                        <td class="ci-shelvinglocation">
+                                            <span class="shelvingloc">[% riloo.location | html %]</span>
+                                        </td>
+                                        <td class="ci-callnumber">
+                                            [% riloo.itemcallnumber | html %]
+                                        </td>
+                                        <td class="ci-dateaccessioned">
+                                            [% riloo.dateaccessioned | $KohaDates %]
+                                        </td>
+                                        <td class="ci-type">
+                                            [% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %]
+                                        </td>
+                                        <td class="ci-patron">
+                                            [% IF ( riloo.duedate ) %]
+                                                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">
+                                                    [% riloo.patron.surname | html %], [% riloo.patron.firstname | html %] ([% riloo.patron.category.description | html %])
+                                                </a>
+                                                [% IF riloo.borissuescount %]
+                                                    <span class="results_summary nowrap">
+                                                        <span class="label">Checkouts:</span>
+                                                        <span class="number_box">
+                                                            <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">[% riloo.borissuescount | html %]</a>
+                                                        </span>
+                                                    </span>
+                                                [% END %]
+                                            [% ELSE %]
+                                                Not checked out
+                                            [% END %]
+                                        </td>
+                                        <td class="ci-note">
+                                            [% IF ( riloo.patron.borrowernotes ) %]
+                                                <p><span class="circ-hlt patron-note">[% riloo.patron.borrowernotes | html %]</p></span>
+                                            [% END %]
+                                            [% IF ( riloo.itemnote ) %]
+                                                <p><span class="circ-hlt item-note-public">[% riloo.itemnote | html %]</p></span>
+                                            [% END %]
+                                            [% IF ( riloo.itemnotes_nonpublic ) %]
+                                                <p><span class="circ-hlt item-note-nonpublic">[% riloo.itemnotes_nonpublic | html %]</p></span>
+                                            [% END %]
+                                        </td>
+                                    </tr>
+                                [% END %]
+                            </table>
+                        [% END %]
 
-[% IF ( checkinmsg ) %]
-    [% IF ( checkinmsgtype == 'alert' ) %]
-        <div class="dialog alert">
-    [% ELSE %]
-        <div class="dialog message">
-    [% END %]
-            <p class="problem">[% checkinmsg | html_line_break %]</p>
-        </div>
-[% END%]
-
-    <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
-        <fieldset id="circ_returns_checkin">
-            <h3>Check in</h3>
-            <div class="row">
-        <div class="col-sm-6">
-            <div class="hint">Enter item barcode:</div>
-                <div class="form-control-group">
-                    [% IF ( exemptfine ) %]
-                        <input name="barcode" id="barcode" size="14" class="focus input-warning" type="text" />
-                    [% ELSIF ( dropboxmode ) %]
-                        <input name="barcode" id="barcode" size="14" class="barcode focus input-warning" />
+                    [% IF Koha.Preference('CircSidebar') %]
+                            </div> <!-- /.col-sm-10.col-sm-push-2 -->
+                            <div class="col-sm-2 col-sm-pull-10">
+                                <aside>
+                                    [% INCLUDE 'circ-nav.inc' %]
+                                </aside>
+                            </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+                        </div> <!-- /.row -->
                     [% ELSE %]
-                        <input name="barcode" id="barcode" size="14" class="barcode focus" />
-                    [% END %]
-                    <button type="submit" class="btn btn-default">Check in</button>
-                    [% FOREACH inputloo IN inputloop %]
-                        <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
-                        <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
-                        <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
+                            </div> <!-- /.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 -->
+                        </div> <!-- /.row -->
                     [% END %]
-                </div>
-            <div id="show-circ-settings">
-                <a href="#"><i class="fa circ-settings-icon fa-caret-down"></i> Checkin settings</a>
-            </div>
-        </div>
-        <div class="col-sm-6">
-            [% IF ( exemptfine ) %]
-                <div id="exemptfines" class="checkin-active-setting">
-            [% ELSE %]
-                <div id="exemptfines" class="checkin-active-setting" style="display:none;">
-            [% END %]
-                <p><i class="fa fa-check"></i> Fines for returned items are forgiven.</p>
-            </div>
-
-            [% IF ( forgivemanualholdsexpire ) %]
-                <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting">
-            [% ELSE %]
-                <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting" style="display:none;">
-            [% END %]
-                    <p><i class="fa fa-check"></i> Fines are not charged for manually cancelled holds.</p>
-                </div>
-
-                [% IF ( dropboxmode ) %]
-                    <div id="dropboxmode" class="checkin-active-setting">
-                [% ELSE %]
-                    <div id="dropboxmode" class="checkin-active-setting" style="display:none;">
-                [% END %]
-                    <p><i class="fa fa-check"></i> Book drop mode. <span class="single-line">( Effective checkin date is [% dropboxdate | $KohaDates with_hours => 1 %] )</span></p>
-                </div>
-                [% IF ( return_date_override_remember ) %]
-                    <div id="return_date_remember" class="checkin-active-setting">
-                [% ELSE %]
-                    <div id="return_date_remember" class="checkin-active-setting" style="display:none;">
-                [% END %]
-                    <p><i class="fa fa-check"></i> Saved check-in date: <span id="saved_return_date" class="single-line">[% return_date_override | html %]</span></p>
-                </div>
-            </div>
-        </div>
-
-            <div class="circ-settings">
-            [% IF Koha.Preference('SpecifyReturnDate') %]
-                <div class="date-select" id="return_date_override_fields">
-                    <div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
-
-                    <input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
-
-
-
-                    <button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
-                    <div class="circ-setting">
-                        [% IF ( return_date_override_remember ) %]
-                            <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
-                        [% ELSE %]
-                            <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" />
-                        [% END %]
-                        <label for="return_date_override_remember"> Remember due date for next check in</label>
-                    </div>
-            </div>
-        [% END %]
-                    [% IF ( CAN_user_updatecharges_writeoff && overduecharges ) %]
-                        <div id="forgive-overdue-fines" class="circ-setting">
-                        [% IF ( exemptfine ) %]
-                        <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" checked="checked" />
-                        [% ELSE %]
-                        <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" />
-                        [% END %]
-                        <label for="exemptcheck">Forgive overdue charges</label>
-                        </div>
-                    [% END %] <!-- overduecharges -->
-                        <div id="book-drop-mode" class="circ-setting">
-                        [% IF ( dropboxmode ) %]
-                        <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" checked="checked" />
-                        [% ELSE %]
-                        <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" />
-                        [% END %]
-                        <label for="dropboxcheck">Book drop mode</label>
-                        </div>
-                    [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
-                        <div class="forgive-manual-hold-fees circ-setting">
-                        [% IF ( forgivemanualholdsexpire ) %]
-                        <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" checked="checked" />
-                        [% ELSE %]
-                        <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" />
-                        [% END %]
-                        <label for="forgivemanualholdsexpire">Forgive fees for manually expired holds</label>
-                        </div>
-                    [% END %] <!-- overduecharges -->
-                </div> <!-- /.circ-settings -->
-            </fieldset> <!-- /#circ_returns_checkin -->
-        </form> <!-- /#checkin-form -->
-
-[% IF ( riloop ) %]
-    <h2>Checked-in items</h2>
-    <table id="checkedintable">
-    <thead><tr><th class="ci-duedate">Due date</th><th class="ci-title">Title</th><th class="ci-author">Author</th><th class="ci-barcode">Barcode</th><th class="ci-homelibrary">Home library</th><th class="ci-holdinglibrary">Holding library</th><th class="ci-shelvinglocation">Shelving location</th><th class="ci-callnumber">Call number</th><th class="ci-dateaccessioned">Date acquired</th><th class="ci-type">Type</th><th class="ci-patron">Patron</th><th class="ci-note">Note</th></tr></thead>
-
-        [% FOREACH riloo IN riloop %]
-            <tr>
-            <td class="ci-duedate">[% IF ( riloo.duedate ) %]
-                    [% IF ( riloo.return_overdue ) %]
-                        <span class="overdue">[% riloo.duedate | html %] (overdue)</span>
-                    [% ELSE %][% riloo.duedate | html %]
-                    [% END %]
-                [% ELSE %]Not checked out
-                [% END %]
-            </td>
-            <td class="ci-title"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% riloo.itembiblionumber | uri %]">
-                    [% riloo.itemtitle | html %]
-                </a>
-                [% IF ( riloo.enumchron ) %]
-                    <br/>
-                    <span class="item_enumeration" style="white-space: nowrap;">[% riloo.enumchron | html %]</span>
-                [% END %]
-            </td>
-            <td class="ci-author">[% riloo.itemauthor | html %]</td>
-            <td class="ci-barcode"><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber | uri %]&amp;itemnumber=[% riloo.itemnumber | uri %]#item[% riloo.itemnumber | uri %]">[% riloo.barcode | html %]</a></td>
-            <td class="ci-homelibrary">[% Branches.GetName( riloo.homebranch ) | html %]</td>
-            <td class="ci-holdinglibrary">[% Branches.GetName( riloo.holdingbranch ) | html %]</td>
-            <td class="ci-shelvinglocation"><span class="shelvingloc">[% riloo.location | html %]</span></td>
-            <td class="ci-callnumber">[% riloo.itemcallnumber | html %]</td>
-            <td class="ci-dateaccessioned">[% riloo.dateaccessioned | $KohaDates %]</td>
-            <td class="ci-type">[% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %]</td>
-            <td class="ci-patron">[% IF ( riloo.duedate ) %]
-                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">
-                    [% riloo.patron.surname | html %], [% riloo.patron.firstname | html %] ([% riloo.patron.category.description | html %])
-                </a>
-                [% IF riloo.borissuescount %]
-                    <span class="results_summary nowrap">
-                        <span class="label">Checkouts:</span>
-                        <span class="number_box">
-                            <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">[% riloo.borissuescount | html %]</a>
-                        </span>
-                    </span>
-                [% END %]
-            [% ELSE %]Not checked out[% END %]</td>
-            <td class="ci-note">
-                [% IF ( riloo.patron.borrowernotes ) %]<p><span class="circ-hlt patron-note">[% riloo.patron.borrowernotes | html %]</p></span>[% END %]
-                [% IF ( riloo.itemnote ) %]<p><span class="circ-hlt item-note-public">[% riloo.itemnote | html %]</p></span>[% END %]
-                [% IF ( riloo.itemnotes_nonpublic ) %]<p><span class="circ-hlt item-note-nonpublic">[% riloo.itemnotes_nonpublic | html %]</p></span>[% END %]
-            </td>
-           </tr>
-        [% END %]
-    </table>
-[% END %]
 
-                [% IF Koha.Preference('CircSidebar') %]
-                        </div> <!-- /.col-sm-10.col-sm-push-2 -->
-                        <div class="col-sm-2 col-sm-pull-10">
-                            <aside>
-                                [% INCLUDE 'circ-nav.inc' %]
-                            </aside>
-                        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
-                    </div> <!-- /.row -->
-                [% ELSE %]
-                        </div> <!-- /.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 -->
-                    </div> <!-- /.row -->
-                [% END %]
-
-            </main>
-        </div> <!-- /.col-sm-12 -->
-    </div> <!-- /.row -->
+                </main>
+            </div> <!-- /.col-sm-12 -->
+        </div> <!-- /.row -->
 
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'datatables.inc' %]
-- 
2.20.1