Bug 23039: Hold found modal on checkin screen ( circulation.pl ) obscures Check in...
authorOwen Leonard <oleonard@myacpl.org>
Tue, 30 Jul 2019 15:16:26 +0000 (15:16 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 7 Oct 2019 11:24:13 +0000 (12:24 +0100)
This patch modifies the checkin process so that any errors or messages
related to the current checkin are displayed in any hold/transit modal
which is displayed. This prevents any information from being hidden by
the modal.

This patch also adds an "information" button to the checkout form which
the user can click to redisplay the last modal which was dismissed
(unless confirming the modal reloads the page).

To test, apply the patch and rebuild the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Test the checkin process with various types of items:
   - Item not checked out
   - Item not checked out, on hold
   - Item not checked out, needs to be transferred
   - Item is marked lost, needs to be transferred
   - Item checked out, patron has waiting holds (with
     WaitingNotifyAtCheckin enabled)
   - Item checked out, patron has outstanding fines (with
     FineNotifyAtCheckin enabled)

 - Test that the modal redisplay button works in cases where the modal
   is dismissed without triggering a page reload:
   - Hold confirmation -> Ignore
   - Transfer confirmation -> OK

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

index 60ced27..9b02c87 100644 (file)
@@ -2163,6 +2163,38 @@ li {
 }
 
 .modal-dialog {
+    .dialog {
+        border-radius: 0;
+        border-width: 1px 0 0 0;
+        margin: 15px -15px -15px -15px;
+        padding: 15px;
+        text-align: left;
+        width: unset;
+
+        h3 {
+            margin: unset;
+            text-align: left;
+        }
+
+        &.alert {
+            background: #FFFADE none;
+            border-color: #E0C726;
+
+            .problem {
+                background-color: transparent;
+            }
+        }
+
+        &.message {
+            background: #E8EDF6 none;
+            border-color: #A4BEDD;
+
+            .problem {
+                background-color: transparent;
+            }
+        }
+    }
+
     &.modal-wide {
         width: 80%;
     }
index 2f5493b..9768072 100644 (file)
                             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
                         [% END %]
 
-                        [% IF hold_auto_filled %]
+                        [% BLOCK all_checkin_messages %]
+                            [% 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>
 
-                            <div id="holds-auto-fill" class="modal audio-alert-action" tabindex="-1" role="dialog" aria-labelledby="HoldsAutoFillLabel">
-                                <div class="modal-dialog" role="document">
-                                    <div class="modal-content">
-                                        <div class="modal-header">
-                                            <h3 class="modal-title" id="HoldsAutoFillLabel">
-                                                Hold found:
-                                                <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 %]
+                                        [% INCLUDE display_holdpatron_address %]
+
+                                        [% IF ( patron.phone ) %]
+                                            <li>[% patron.phone | html %]</li>
+                                        [% END %]
 
-                                            <h4>Hold for: </h4>
-                                            <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 ( patron.email ) %]
+                                            <li>
+                                                [% IF ( transfertodo ) %]
+                                                    [% patron.email | html %]
+                                                [% ELSE %]
+                                                    <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
                                                 [% END %]
-                                                [% IF ( patron.email ) %]
-                                                    <li>
-                                                        [% IF ( diffbranch ) %]
-                                                            [% patron.email | html %]
-                                                        [% ELSE %]
-                                                            <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
-                                                        [% END %]
-                                                    </li>
+                                            </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 %]
+
+                                    <a href="#" class="btn btn-default print print-slip">
+                                        <i class="fa fa-print"></i> Print
+                                    </a>
+                                </div> <!-- /.hold-auto-filled -->
+                            [% END # /IF hold_auto_filled %]
+
+                            [% 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 ( 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 %]
-                                                [% UNLESS ( diffbranch) %]
-                                                    [% INCLUDE display_bormessagepref %]
+                                                <br />New value:
+                                                [% IF errmsgloo.NotForLoanStatusUpdated.to %]
+                                                    [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) | html %].
+                                                [% ELSE %]
+                                                    Available for loan.
                                                 [% END %]
-                                                [% IF ( patron.debarred ) %]
-                                                    <li class="error">Patron is RESTRICTED</li>
+                                            </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 %]
-                                                [% IF ( patron.gonenoaddress ) %]
-                                                    <li class="error">Patron's address is in doubt</li>
+                                                <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 %]
-                                            </ul>
-                                            [% IF ( diffbranch ) %]
-                                                <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                             </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 %]
-                                                <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
+                                                <p class="problem">Item was lost, now found.</p>
                                             [% END %]
-                                        </div>
-                                        <div class="modal-footer">
-                                            <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" class="btn btn-default print print-slip"><i class="fa fa-print"></i> Print slip and continue</button>
-                                        </div>
-                                    </div> <!-- /.modal-content -->
-                                </div> <!-- /.modal-dialog -->
-                            </div> <!-- /#holds-auto-fill -->
-                        [% END # /IF hold_auto_filled %]
-
-
-                        [% 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 %]
+                                            [% 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 %]
 
-                        <!-- 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 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 # /FOREACH errmsgloo %]
+                                </div> <!-- /.dialog.dialog-alert -->
+                            [% END #/IF errmsgloop %]
+
+                            [% 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 # /IF checkinmsg %]
+                        [% END # /BLOCK all_checkin_messages %]
 
                         [% IF wrongbranch %]
                             <div id="wrong-branch-modal" class="modal fade audio-alert-action">
                                                         [% Branches.GetName( rightbranch ) | html %]
                                                     </strong>
                                                 </p>
+                                                [% INCLUDE all_checkin_messages %]
                                             </div> <!-- /.modal-body -->
                                             <div class="modal-footer">
                                                 <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
                         [% END # /IF wrongbranch %]
 
                         <!-- case of a mistake in transfer loop -->
-                        [% UNLESS ( hold_auto_filled && diffbranch ) %]
-                            [% 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> <!-- /mainform -->
-                                            </div> <!-- /.modal-footer -->
-                                        </div> <!-- /.modal-content -->
-                                    </div> <!-- /.modal-dialog -->
-                                </div> <!-- /#wrong-transfer-modal -->
-                            [% END # /IF WrongTransfer && !transfertodo %]
-                        [% END # /UNLESS hold_auto_filled && diffbranch %]
+
+                        [% 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>
+                                            [% INCLUDE all_checkin_messages %]
+                                        </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> <!-- /mainform -->
+                                        </div> <!-- /.modal-footer -->
+                                    </div> <!-- /.modal-content -->
+                                </div> <!-- /.modal-dialog -->
+                            </div> <!-- /#wrong-transfer-modal -->
+                        [% END # /IF WrongTransfer && !transfertodo %]
 
                         [% IF ( found ) %]
                             [% IF ( waiting ) %]
 
                                                     <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 %]" />
+                                                    [% INCLUDE all_checkin_messages %]
                                                 </div> <!-- /.modal-body -->
 
                                                 <div class="modal-footer">
                                                     <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
                                                     <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
                                                     <input type="hidden" name="barcode" value="0" />
+                                                    [% INCLUDE all_checkin_messages %]
                                                 </div>
                                                 <div class="modal-footer">
                                                     [% IF !transfer %]
                                                     <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 %]" />
+                                                    [% INCLUDE all_checkin_messages %]
                                                 </div>
 
                                                 <div class="modal-footer">
                             [% END #/IF reserved %]
                         [% END # /IF found %]
 
-                        [% 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 # /FOREACH errmsgloo %]
-                            </div> <!-- /.dialog.dialog-alert -->
-                        [% END #/IF errmsgloop %]
-
-                        [% 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 # /IF checkinmsg %]
+                        <div class="static_checkin_messages" style="display:none">
+                            [% INCLUDE all_checkin_messages %]
+                        </div>
 
                         <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
                             <fieldset id="circ_returns_checkin">
+                                <div class="show_checkin_dialog" style="float:right;display:none"><button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" title="Show the last checkin message"><i class="fa fa-info"></i></button></div>
                                 <h3>Check in</h3>
                                 <div class="row">
                                     <div class="col-sm-6">
             $("#barcode").focus();
         }
         $(document).ready(function () {
+            $(".static_checkin_messages").show();
             $(".modal").modal({ backdrop: 'static' }).on('shown.bs.modal', function() {
                 $("#barcode").prop("disabled", true);
+                $(".static_checkin_messages").hide();
+                $(".show_checkin_dialog").show();
             }).on('hidden.bs.modal', function() {
                 $("#barcode").prop("disabled", false).focus();
             });
 
-            $(".modal").on('hidden.bs.modal', function (e) { $("#barcode").focus(); });
+            $("body").on("click", ".show_checkin_dialog button", function(e){
+                e.preventDefault();
+                $(".modal").modal("show");
+            });
 
             $(".print-slip").on('click', function(e) {
                 e.preventDefault();
                     $("#return_date_remember").hide();
                 }
             });
+            $('[data-toggle="tooltip"]').tooltip();
         });
     </script>
 [% END %]