Bug 23140: Fix typo in branchcode parameters for print slip
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / returns.tt
index f092ea8..46aede9 100644 (file)
@@ -1,3 +1,5 @@
+[% USE raw %]
+[% USE Asset %]
 [% USE KohaDates %]
 [% USE Branches %]
 [% USE Koha %]
@@ -5,14 +7,15 @@
 [% USE ItemTypes %]
 [% USE AuthorisedValues %]
 [% USE ColumnsSettings %]
-
+[% SET footerjs = 1 %]
 [% BLOCK display_bormessagepref %]
     [% IF ( bormessagepref ) %]
         <li>Patron notification:
             [% FOREACH mtt IN bormessagepref.keys %]
-                [% IF ( mtt == 'email' ) %] Email. [% END %]
-                [% IF ( mtt == 'phone' ) %] Phone. [% END %]
-                [% IF ( mtt == 'sms' ) %] SMS. [% END %]
+                [%~ IF ( mtt == 'email' ) %] Email[% END ~%]
+                [%~ IF ( mtt == 'phone' ) %] Phone[% END ~%]
+                [%~ IF ( mtt == 'sms' ) %] SMS[% END ~%]
+                [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
             [% END %]
         </li>
            [% ELSE %]
     [% END %]
 [% END %]
 
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title |html %]</title>
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-[% INCLUDE 'columns_settings.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script>
-[% INCLUDE 'timepicker.inc' %]
-
-<script type="text/javascript">
-//<![CDATA[
-function Dopop(link) {
-    var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
-    $("#barcode").focus();
-}
-$(document).ready(function () {
-
-    [% IF print_slip %]
-        Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% biblionumber %]');
+[% BLOCK display_holdpatron_address %]
+    [% IF Koha.Preference( 'AddressFormat' ) %]
+        [% INCLUDE "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
+    [% ELSE %]
+        [% INCLUDE 'member-display-address-style-us.inc' %]
     [% END %]
+[% END %]
 
-    var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'returns', 'checkedintable', 'json' ) %]
-    var returns_table = KohaTable("#checkedintable", {
-            "bFilter":false,
-            "bPaginate":false,
-            "bInfo":false,
-            "bSort":false,
-            "dom": 'B<"clearfix">t',
-            }, columns_settings);
-
-    $("#return_date_override").datetimepicker({
-        onClose: function(dateText, inst) { $("#barcode").focus(); },
-        defaultDate: -1,
-        hour: 23,
-        minute: 59,
-        maxDate: 0
-    });
-    $("#return_date_override").on("blur", function() {
-            check_valid_return_date();
-    });
-    $("#checkin-form").submit(function( event ) {
-        if ( !check_valid_return_date() ) {
-            event.preventDefault();
-        }
-    });
-
-    function check_valid_return_date() {
-        if ( $("#return_date_override").val() ) {
-            var datetime = DateTime_from_syspref( $("#return_date_override").val() );
-            var now = new Date();
-            if ( !datetime || datetime > now ) {
-                alert("Invalid return date/time!");
-                $("#return_date_override").val("")
-                return false;
-            }
-        }
-        return true;
-    }
-
-    $("#exemptcheck").change(function () {
-        if (this.checked == true) {
-            $("#barcode").addClass("alert");
-            $("#exemptfines").show();
-        } else {
-            $("#barcode").removeClass("alert");
-            $("#exemptfines").hide();
-        }
-        $("#barcode").focus();
-    });
-    $("#dropboxcheck").change(function () {
-        if (this.checked == true) {
-            $("#barcode").addClass("alert");
-            $("#dropboxmode").show();
-
-            $("#return_date_override_fields :input").prop('disabled', true);
-            $("#return_date_override").datetimepicker("disable");
-        } else {
-            $("#barcode").removeClass("alert");
-            $("#dropboxmode").hide();
-
-            $("#return_date_override_fields :input").prop('disabled', false);
-            $("#return_date_override").datetimepicker("enable");
-        }
-        $("#barcode").focus();
-    });
-    $("#forgivemanualholdsexpire").change(function () {
-        if (this.checked == true) {
-            $("#barcode").addClass("alert");
-            $("#forgivemanualholdsexpire-alert").show();
-        } else {
-            $("#barcode").removeClass("alert");
-            $("#forgivemanualholdsexpire-alert").hide();
-        }
-        $("#barcode").focus();
-    });
-    [% IF(overduecharges) %] $("#barcode").focus(function () {
-        if (($("#exemptcheck").prop("checked") == true) || ($("#dropboxcheck").prop("checked") == true)) {
-            $("#barcode").addClass("alert");
-        } else {
-            $("#barcode").removeClass("alert");
-        }
-    });
-    $("#barcode").blur(function () {
-        $("#barcode").removeClass("alert");
-    });
-    [% END %]
-});
-//]]>
-</script>
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title | html %]</title>
+[% INCLUDE 'doc-head-close.inc' %]
 </head>
+
 <body id="circ_returns" class="circ">
 <span class="audio-alert-success"></span>
 
@@ -139,12 +44,68 @@ $(document).ready(function () {
 
 <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="doc" class="yui-t7">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-12">
+            <main>
+                <div class="row">
 
-   <div id="bd">
-       <div id="yui-main">
+                [% 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 %]
 
-<div class="yui-g">
+    [% 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 %]
+                        [% 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 %]
+
+            [% 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>
@@ -154,32 +115,42 @@ $(document).ready(function () {
 
 [% IF additional_materials %]
     <div class="dialog message" id="materials">Note about the accompanying materials: <br />
-    [% additional_materials %]
+    [% additional_materials | html %]
     </div>
 [% END %]
 
 [% IF ( collectionItemNeedsTransferred ) %]
  <div id="rotating-collection" class="dialog message">
-        <h3>Please transfer item to: [% collectionBranchName %]</h3>
-            <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
+        <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><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% collectionBranch %]&amp;op=slip'); return true;">Print slip</a></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 %].</h3>
-        <p><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% fineborrowernumber %]">Make payment</a>.</p>
+        <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 %] [% holdssurname %] has [% waiting_holds %] hold(s) waiting for pickup.</h3>
-        <p><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% holdsborrowernumber %]">Check out to this patron</a>.</p>
+        <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 %]
 
@@ -187,208 +158,288 @@ $(document).ready(function () {
 [% 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=[% borrower.borrowernumber %]">
-                [% borrower.firstname %] [% borrower.surname %]
+            <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 ( wrongbranch ) %]
-    <div class="dialog alert"><h3>Cannot check in</h3>
-        <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% 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 ) %]</strong></p>
+[% 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="submit" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
+                    </div>
+                </form>
+            </div>
+        </div>
     </div>
 [% END %]
+
 <!-- case of a mistake in transfer loop -->
-[% IF ( WrongTransfer ) %]
-    <div id="return2" class="dialog message">
-        <!-- WrongTransfer -->
-        <h3>Please return item to: [% Branches.GetName( TransferWaitingAt ) %]</h3>
-            <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
-        <button type="submit" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;"><i class="fa fa-print"></i> Print transfer slip</button><button type="submit" onclick="window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1'"><i class="fa fa-times"></i> Cancel transfer</button>
-[% IF ( wborcnum ) %]<h5>Hold for:</h5>
-        <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
-            [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
-        <li>[% wborstnum %] [% wboraddress %][% IF ( wboraddress2 ) %]<br />
-               [% wboraddress2 %]<br />[% END %]
-        [% wborcity %]  [% wborzip %]</li>
-        [% IF ( wborphone ) %]<li>[% wborphone %]</li>[% END %]
-               [% IF ( wboremail ) %]<li><a id="boremail" href="mailto:[% wboremail %]">[% wboremail %]</a></li>[% END %]
-        </ul>
-
-    <form method="post" action="returns.pl" class="confirm">
-            <input type="hidden" name="WT-itemNumber" value="[% WrongTransferItem %]" />
-            <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt %]" />
-            <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" />
-            <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="[% borrowernumber %]" />
-            <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
-            <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print slip and confirm</button>
-        <input type="hidden" name="return_date_override" value="[% return_date_override %]" />
-        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
-    </form>
-    [% END %]</div>
+[% IF WrongTransfer && !transfertodo %]
+    <div id="wrong-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 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">
+                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
+                        <button type="submit" 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>
+                        <button class="btn btn-default deny cancel-transfer" 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 %]" />
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
 [% END %]
 
 [% IF ( found ) %]
-<!-- found -->
-<!-- case of a reservation found, and display info -->
     [% IF ( waiting ) %]
-       <!-- waiting -->
-
-    <div id="hold-found1" class="dialog message audio-alert-action">
-        <h3>Hold found (item is already waiting)</h3>
-        <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
-        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
-        <h4>Hold for:</h4>
-                       <ul>
-            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
-            <li>[% borstnum %] [% boraddress %]<br />
-                       [% IF ( boraddress2 ) %][% boraddress2 %]<br />[% END %]
-            [% borcity %] [% borzip %]</li>
-           [% IF ( borphone ) %]<li> [% borphone %]</li>[% END %]
-                  [% IF ( boremail ) %]<li><a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a></li>[% END %]
-            [% INCLUDE display_bormessagepref %]
-[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
-[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]</ul>
-               [% IF ( transfertodo ) %]
-            <h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
-               [% ELSE %]
-               <h4><strong>Hold at</strong> [% destbranchname %]</h4>
-        [% END %]
-        <form method="post" action="returns.pl" class="confirm">
-            <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button>
+        <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 %]">
+                            [% itembarcode | html %]: [% title | html %]
+                        </a>
+                    </h3>
+                </div>
+
+                <div class="modal-body">
+                    [% IF ( reservenotes ) %]
+                        <h4>Notes: [% reservenotes | html %]</h4>
+                    [% END %]
 
-            <input type="hidden" name="cancel_reserve" value="0" />
-            <button type="submit" class="deny" onclick="this.form.cancel_reserve.value = 1; this.form.submit();"><i class="fa fa-times"></i> Cancel</button>
+                    <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 %]
 
-            <input type="hidden" name="print_slip" value="0" />
-            <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print and confirm</button>
-            [% FOREACH inputloo IN inputloop %]
-                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
-                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-                <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
-            [% END %]
-                <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
-                <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
-                <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
-                <input type="hidden" name="resbarcode" value="[% barcode %]" />
-                <input type="hidden" name="diffBranch" value="[% destbranch %]" />
-                <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
-                <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
-                <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
-
-                <input type="hidden" name="return_date_override" value="[% return_date_override %]" />
-                <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
-                </form>
-       </div>
+                    [% 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 %]">[% itembarcode |html %]: [% title |html %]</a></p>
+                <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=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
-                        <li>[% borstnum %] [% boraddress %]<br />
-                                               [% IF ( boraddress2 ) %][% boraddress2 %]<br />[% END %]
-                                               [% borcity %]  [% borzip %]</li>
-                        [% IF ( borphone ) %]<li>[% borphone %]</li>[% END %]
-                        [% IF ( boremail ) %]<li>[% IF ( transfertodo ) %][% boremail %][% ELSE %]<a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a>[% END %]</li>[% END %]
-[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
-[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]
+                        <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> [% destbranchname %]</h4>
-               [% ELSE %]
-               <h4><strong>Hold at</strong> [% destbranchname %]</h4>
+        [% 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="[% borrowernumber %]" />
-            <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
-            <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print slip and continue</button>
+            <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 %]" value="[% inputloo.barcode %]" />
-                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-                <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
+                <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 %]" />
-            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
-            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
-            <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
+            <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 %]" />
-            <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
+            <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 ) %]
-    <!-- transfer: item with no reservation, must be returned according to home library circulation rules -->
-        <div id="return1" class="dialog message audio-alert-action">
-            <h3>Please return item to: [% Branches.GetName( returnbranch ) %]</h3>
-            <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
-            <ul><li><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% returnbranch %]&amp;op=slip'); return true;">Print slip</a></li></ul>
+    [% 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="submit" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
+                        [% ELSE %]
+                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check"></i> OK</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> 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>
-    [% END %]
-
-    [% IF ( needstransfer ) %]
-       <!-- needstransfer -->
-    <div id="item-transfer" class="dialog message audio-alert-action"><h3> This item needs to be transferred to [% Branches.GetName( returnbranch ) %]</h3>
-    Transfer now?<br />
-    <form method="post" action="returns.pl" name="mainform" id="mainform">
-    [% IF itemnumber %]
-        <button type="submit" name="dotransfer" class="print" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% returnbranch %]&amp;op=slip'); return true;"><i class="fa fa-print"></i> Yes, print slip</button>
-    [% END %]
-       <button type="submit" name="dotransfer" class="submit"><i class="fa fa-check"></i> Yes</button>
-       <button type="submit" name="notransfer" class="submit"><i class="fa fa-times"></i> No</button>
-    <input type="hidden" name="tobranch" value="[% returnbranch %]" />
-       <input type="hidden" name="transferitem" value="[% itemnumber %]" />
-        <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
-        <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
-        <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
-       [% FOREACH inputloo IN inputloop %]
-       <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
-       <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-       <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
-       [% END %]
-       <input type="hidden" name="barcode" value="0" />
-        <input type="hidden" name="return_date_override" value="[% return_date_override %]" />
-        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
-       </form>   </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 %]">[% title |html %]</a></caption>
+        <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>[% name %]</td>
+            <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 %]" value="[% inputloo.barcode %]" />
-                    <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-                    <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
+                    <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 %]" />
-            <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
+            <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>
@@ -398,58 +449,109 @@ $(document).ready(function () {
     <!-- 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 %]">
+                            [% itembarcode | html %]: [% title | html %]
+                        </a>
+                </div>
+
+                <div class="modal-body">
+                    [% IF ( reservenotes ) %]
+                        <h4>Notes: [% reservenotes | html %]</h4>
+                    [% END %]
+                    <h5>Hold for:</h5>
+                        <li>
+                            <td>[% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
+                            <span class="patron-category"> - [% patron.category.description | html %]</span>
+                        </li>
 
-    <div id="hold-found2" class="dialog message audio-alert-action">
-      <h3>Hold found</h3>
-          <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
-        [% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
-        <h5>Hold for:</h5>
-               <ul>
-            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
-                [% borsurname %], [% borfirstname %]
-            </a> ([% borcnum %])</li>
-            <li>[% borstnum %] [% boraddress %]<br />
-                       [% IF ( boraddress2 ) %][% boraddress2 %]<br />[% END %]
-                       [% borcity %] [% borzip %]</li>
-            [% IF ( borphone ) %]<li>[% borphone %]</li>[% END %]
-            [% IF ( boremail ) %]<li>[% IF ( transfertodo ) %][% boremail %][% ELSE %]<a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a>[% END %]</li>[% END %]
-            [% UNLESS ( transfertodo) %]
-                [% INCLUDE display_bormessagepref %]
-            [% END %]
-[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
-[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]
-        </ul>
-        [% IF ( transfertodo ) %]
-            <h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
-               [% ELSE %]
-               <h4><strong>Hold at</strong> [% destbranchname %]</h4>
-        [% END %]
-        <form method="post" action="returns.pl" class="confirm">
-            <input type="hidden" name="print_slip" value="0" />
-            [% IF ( transfertodo ) %]
-                <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm hold and transfer</button>
-                <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit()"><i class="fa fa-print"></i> Print slip, transfer, and confirm</button>
-            [% ELSE %]
-                <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm hold</button>
-                <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print slip and confirm</button>
-            [% END %]
-                <button type="submit" class="deny" onclick="$('.dialog:visible').hide('slow'); $('#barcode').focus(); return false;"><i class="fa fa-times"></i> Ignore</button>
-            [% FOREACH inputloo IN inputloop %]
-       <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
-       <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-       <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />[% END %]
-            <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
-            <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
-            <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
-            <input type="hidden" name="resbarcode" value="[% barcode %]" />
-            <input type="hidden" name="diffBranch" value="[% destbranch %]" />
-            <input type="hidden" name="exemptfine" value="[% exemptfine %]" />
-            <input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
-            <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
-            <input type="hidden" name="return_date_override" value="[% return_date_override %]" />
-            <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
-        </form>
-       </div>
+                        [% 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 %]
+
+                    [% 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 %]
 
@@ -457,69 +559,105 @@ $(document).ready(function () {
     <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 %]">[% itembarcode |html %]: [% title |html %]</a></p>
+            <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 ) %].
-                            [% ELSE %]
-                                Available for loan.
-                            [% END %]
-                            <br />New value:
-                            [% IF errmsgloo.NotForLoanStatusUpdated.to %]
-                                [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) %].
-                            [% ELSE %]
-                                Available for loan.
-                            [% END %]
-                        </p>
-                    [% END %]
-                    [% IF ( errmsgloo.badbarcode ) %]
-                        <p class="problem">No item with barcode: [% errmsgloo.msg %]</p>
-                    [% END %]
-                    [% IF ( errmsgloo.ispermanent ) %]
-                        <p class="problem">Please return item to: [% errmsgloo.msg %]</p>
-                    [% END %]
-                    [% IF ( errmsgloo.notissued ) %]
-                        <p class="problem">Not checked out.</p>
+            [% 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 %]
-                    [% IF ( errmsgloo.localuse) %]
-                        <p class="problem">Local use recorded</p>
+                    <br />New value:
+                    [% IF errmsgloo.NotForLoanStatusUpdated.to %]
+                        [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) | html %].
+                    [% ELSE %]
+                        Available for loan.
                     [% END %]
-                    [% IF ( errmsgloo.waslost ) %]
-                        <p class="problem">Item was lost, now found.</p>
-                        [% IF ( LostItemFeeRefunded ) %]
-                            <p class="problem">A refund has been applied to the borrowing patron's account.</p>
+                </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 %]
-                            <p class="problem">Any lost item fees for this item will remain on the patron's account.</p>
+                            [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) | html %]
                         [% END %]
+                    [% ELSE %]
+                        "Blank"
                     [% END %]
-                    [% IF ( errmsgloo.withdrawn ) %]
-                        [% IF BlockReturnOfWithdrawnItems %]
-                           <h5>Cannot check in</h5>
-                           <p><strong>NOT CHECKED IN</strong></p>
-                           <p class="problem">Item is withdrawn.</p>
+                    <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 %]
-                           <p class="problem">Item is withdrawn.</p>
+                            [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) | html %]
                         [% END %]
+                    [% ELSE %]
+                        "Blank"
                     [% END %]
-                    [% IF ( errmsgloo.debarred ) %]
-                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</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 %]
+                 </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 %]
-        [% ELSE %]
         [% END %]
     </div>
+[% END %]
 
 [% IF ( checkinmsg ) %]
     [% IF ( checkinmsgtype == 'alert' ) %]
@@ -538,50 +676,50 @@ $(document).ready(function () {
         <p>Fines are not charged for manually cancelled holds.</p>
     </div>
     <div id="dropboxmode" class="dialog message" style="display:none;">
-        <p>Book drop mode.  (Effective checkin date is [% dropboxdate %] ).</p>
+        <p>Book drop mode.  (Effective checkin date is [% dropboxdate | $KohaDates %] ).</p>
     </div>
-</div>
-       <div class="yui-g">
+
+<div class="row">
     <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
-    <div class="yui-u first">
+    <div class="col-sm-6">
             <fieldset>
-       <legend>Check in</legend>
+            <legend>Check in</legend>
             <label for="barcode">Enter item barcode: </label>
-                       [% IF ( exemptfine ) %]
-                       <input name="barcode" id="barcode" size="14" class="focus alert"/>
-                       [% ELSIF ( dropboxmode ) %]
-                       <input name="barcode" id="barcode" size="14" class="focus alert"/>
-                       [% ELSE %]
-                       <input name="barcode" id="barcode" size="14" class="focus"/>
-                       [% END %]
+            [% IF ( exemptfine ) %]
+            <input name="barcode" id="barcode" size="14" class="focus alert" type="text" />
+            [% ELSIF ( dropboxmode ) %]
+            <input name="barcode" id="barcode" size="14" class="focus alert" type="text" />
+            [% ELSE %]
+            <input name="barcode" id="barcode" size="14" class="focus" type="text" />
+            [% END %]
             <input type="submit" class="submit" value="Submit" />
 
             [% 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 %]" />
+                    <input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
 
                     <label for="return_date_override_remember"> Remember for next check in:</label>
                     [% IF ( return_date_override_remember ) %]
-                        <input type="checkbox" id="return_date_override_remember" onclick="this.form.barcode.focus();" name="return_date_override_remember" checked="checked" />
+                        <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
                     [% ELSE %]
-                        <input type="checkbox" id="return_date_override_remember" onclick="this.form.barcode.focus();" name="return_date_override_remember" />
+                        <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" />
                     [% END %]
 
-                    <input type="button" class="action" id="cleardate" value="Clear" name="cleardate" onclick="this.checked = false; this.form.return_date_override.value = ''; this.form.return_date_override_remember.checked = false; this.form.barcode.focus(); return false;" />
+                    <input type="button" class="action" id="cleardate" value="Clear" name="cleardate" />
             </div>
         [% END %]
             [% FOREACH inputloo IN inputloop %]
-                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
-                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
-                <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
+                <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 %]
 
 
             </fieldset>
             </div>
-            <div class="yui-u">
+            <div class="col-sm-6">
             <fieldset id="checkin_options">
                 <legend>Options</legend>
                     [% IF ( CAN_user_updatecharges_writeoff && overduecharges ) %]
@@ -626,37 +764,216 @@ $(document).ready(function () {
             <tr>
             <td class="ci-duedate">[% IF ( riloo.duedate ) %]
                     [% IF ( riloo.return_overdue ) %]
-                        <span class="overdue">[% riloo.duedate %] (overdue)</span>
-                    [% ELSE %][% riloo.duedate %]
+                        <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 %]">
-                    [% riloo.itemtitle |html %]</a></td>
-            <td class="ci-author">[% riloo.itemauthor %]</td>
-            <td class="ci-barcode"><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber %]&amp;itemnumber=[% riloo.itemnumber %]#item[% riloo.itemnumber %]">[% riloo.barcode %]</a></td>
-            <td class="ci-homelibrary">[% Branches.GetName( riloo.homebranch ) %]</td>
-            <td class="ci-holdinglibrary">[% Branches.GetName( riloo.holdingbranch ) %]</td>
-            <td class="ci-shelvinglocation">[% riloo.location %]</td>
-            <td class="ci-callnumber">[% riloo.itemcallnumber %]</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 ) %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) %]</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.borrowernumber %]">
-                    [% riloo.borsurname %], [% riloo.borfirstname %] ([% riloo.borcategorycode %])
+                <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.bornote ) %]<p><span class="circ-hlt">[% riloo.bornote %]</p></span>[% END %]
-                [% IF ( riloo.itemnote ) %]<p><span class="circ-hlt">[% riloo.itemnote %]</p></span>[% END %]
-                [% IF ( riloo.itemnotes_nonpublic ) %]<p><span class="circ-hlt">[% riloo.itemnotes_nonpublic %]</p></span>[% END %]
+                [% 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></div>
+    </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 -->
+                    [% END %]
+
+            </main>
+        </div> <!-- /.col-sm-12 -->
+    </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
+    [% INCLUDE 'calendar.inc' %]
+    [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
+    [% INCLUDE 'timepicker.inc' %]
+
+    <script>
+        function Dopop(link) {
+            var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
+            $("#barcode").focus();
+        }
+        $(document).ready(function () {
+            $(".modal").modal({ backdrop: 'static' }).on('shown.bs.modal', function() {
+                $("#barcode").prop("disabled", true);
+            }).on('hidden.bs.modal', function() {
+                $("#barcode").prop("disabled", false).focus();
+            });
+
+            $(".modal").on('hidden.bs.modal', function (e) { $("#barcode").focus(); });
+
+            $(".print-slip").on('click', function(e) {
+                e.preventDefault();
+                Dopop('hold-transfer-slip.pl?borrowernumber=[% patron.borrowernumber | html %]&amp;biblionumber=[% biblionumber | html %]');
+            });
+
+            [% IF print_slip %]
+                Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber | html %]&amp;biblionumber=[% biblionumber | html %]&amp;itemnumber=[% itemnumber | html %]');
+            [% END %]
+
+            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'returns', 'checkedintable', 'json' ) | $raw %]
+            var returns_table = KohaTable("checkedintable", {
+                    "bFilter":false,
+                    "bPaginate":false,
+                    "bInfo":false,
+                    "bSort":false,
+                    "dom": 'B<"clearfix">t',
+                    }, columns_settings);
+
+            $("#return_date_override").datetimepicker({
+                onClose: function(dateText, inst) {
+                    if (validate_date(dateText, inst) ) {
+                        $("#barcode").focus();
+                    }
+                },
+                defaultDate: -1,
+                hour: 23,
+                minute: 59,
+                maxDate: 0
+            }).on("change", function(e, value) {
+                if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
+            });
+            $("#return_date_override").on("blur", function() {
+                check_valid_return_date();
+            });
+            $("#checkin-form").submit(function( event ) {
+                if ( !check_valid_return_date() ) {
+                    event.preventDefault();
+                }
+            });
+
+            function check_valid_return_date() {
+                if ( $("#return_date_override").val() ) {
+                    var datetime = DateTime_from_syspref( $("#return_date_override").val() );
+                    var now = new Date();
+                    if ( !datetime || datetime > now ) {
+                        alert("Invalid return date/time!");
+                        $("#return_date_override").val("")
+                        return false;
+                    }
+                }
+                return true;
+            }
+
+            $("#exemptcheck").change(function () {
+                if (this.checked == true) {
+                    $("#barcode").addClass("alert");
+                    $("#exemptfines").show();
+                } else {
+                    $("#barcode").removeClass("alert");
+                    $("#exemptfines").hide();
+                }
+                $("#barcode").focus();
+            });
+            $("#dropboxcheck").change(function () {
+                if (this.checked == true) {
+                    $("#barcode").addClass("alert");
+                    $("#dropboxmode").show();
+
+                    $("#return_date_override_fields :input").prop('disabled', true);
+                    $("#return_date_override").datetimepicker("disable");
+                } else {
+                    $("#barcode").removeClass("alert");
+                    $("#dropboxmode").hide();
+
+                    $("#return_date_override_fields :input").prop('disabled', false);
+                    $("#return_date_override").datetimepicker("enable");
+                }
+                $("#barcode").focus();
+            });
+            $("#forgivemanualholdsexpire").change(function () {
+                if (this.checked == true) {
+                    $("#barcode").addClass("alert");
+                    $("#forgivemanualholdsexpire-alert").show();
+                } else {
+                    $("#barcode").removeClass("alert");
+                    $("#forgivemanualholdsexpire-alert").hide();
+                }
+                $("#barcode").focus();
+            });
+
+            [% IF(overduecharges) %]
+                $("#barcode").focus(function () {
+                    if (($("#exemptcheck").prop("checked") == true) || ($("#dropboxcheck").prop("checked") == true)) {
+                        $("#barcode").addClass("alert");
+                    } else {
+                        $("#barcode").removeClass("alert");
+                    }
+                });
+                $("#barcode").blur(function () {
+                    $("#barcode").removeClass("alert");
+                });
+            [% END %]
+
+            $('.openWin').on("click",function(e){
+                Dopop( $(this).data("url") );
+            });
+
+            $('.print').on("click",function(e){
+                this.form.print_slip.value = 1;
+                this.form.submit();
+            });
+
+            $('.cancel-hold').on("click",function(e){
+                this.form.cancel_reserve.value = 1;
+                this.form.submit();
+            });
+
+            $('.cancel-transfer').on("click",function(e){
+                window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&amp;canceltransfer=1'
+            });
+
+            $('.action').on("click",function(e){
+                this.checked = false;
+                this.form.return_date_override.value = '';
+                this.form.return_date_override_remember.checked = false;
+                this.form.barcode.focus();
+                return false;
+            });
+        });
+    </script>
+[% END %]
 
-</div>
 [% INCLUDE 'intranet-bottom.inc' %]