Bug 21346: Convert dialogs to modals.
authorChristopher Brannon <cbrannon@cdalibrary.org>
Sun, 4 Nov 2018 03:47:30 +0000 (03:47 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 26 Apr 2019 00:42:20 +0000 (00:42 +0000)
This addresses most of the transfer dialogs.  There are some dialogs
that I have not converted because I don't know what triggers them,
therefore I cannot test them.

The following scenarios have been addresses, and should be tested:

FOR TRANSFERS

1) Checkin with no issue, hold or transfer; not at home (AutomaticItemReturn set to Don't)
     * Should give 3 options - Yes, Yes with print, or No.
     * Yes and Yes with print should trigger a transfer back home.
     * No should do nothing.
     * Print should open a window for printing, with correct
     information.
     * All three options should close the modal.

     TO TEST:
     1) Set AutomaticItemREturn to Don't.
     2) Check in an item with no issues, holds or transfers set, at a
     location other than the owning library.
     3) Test conditions above.

2) Checkin with no issue, hold or transfer; not at home (AutomaticItemReturn set to Do)
    * Should give 2 options - Print or OK.
    * Should automatically set transfer.
    * Print should open a window for printing, with correct information.
    * Both buttons should close modal.

    TO TEST:
    1) Set AutomaticItemReturn to Do.
    2) Check in an item with no issues, holds or transfers set, at a
    location other than the owning library.
    3) Test conditions above.

3) Checkin with no issues or holds, but transfer already set
    * Should give 3 options - OK, Print or Cancel.
    * OK and print should not touch existing transfer.
    * Cancel should remove the exisiting transfer.
    * Print should open a window for printing, with correct information.
    * All three options should close the modal.

    TO TEST:
    1) Check in an item following step 2 of either test above.
    2) Check in item again, while a transfer exists.
    3) Test conditions above.

WRONG BRANCH

4) If AllowReturnToBranch is not set "to any library", and the item is not checked in at the appropriate branch, the wrong-branch-modal pops up:
    * Should give 1 option - OK.
    * Should not check anything in or initiate a transfer.
    * OK should close the modal.

    TO TEST:
    1) Set AllowReturnToBranch to "only the library the item is from".
    You can test the other settings, as long as you pay attention to
    where you are checking the item in at.
    2) Check in an item at a branch other than the owning library.
    3) Test conditions above.

Signed-off-by: Lisette <lisetteslatah@gmail.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 5ed171a45c46f63b18266ad3a3d0a978719ca285)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f3b362120f0b8a75a89ad6846e7bdad93b2e37ca)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

index 5b02a1d..901fe2e 100644 (file)
     </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"  onclick="$('#barcode').focus(); return false;"></i> OK</button>
+                    </div>
+                </form>
+            </div>
+        </div>
     </div>
 [% END %]
 
 <!-- case of a mistake in transfer loop -->
-[% IF ( WrongTransfer && !transfertodo ) %]
-    <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" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% TransferWaitingAt %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
-        <button class="deny" 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 ( patron.cardnumber ) %]<h5>Hold for:</h5>
-        <ul>
-            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">
-            [% patron.surname %], [% patron.firstname %]</a> ([% patron.cardnumber %]) <span class="patron-category"> - [% patron.category.description %]</span> </li>
-            [% INCLUDE display_holdpatron_address %]
-            [% IF ( patron.phone ) %]<li>[% patron.phone %]</li>[% END %]
-            [% IF ( patron.email ) %]<li><a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</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="[% patron.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"  onclick="$('#barcode').focus(); return false;"></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" type="submit" onclick="window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&amp;canceltransfer=1'"><i class="fa fa-times"></i> Cancel transfer</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
 [% END %]
 
 [% IF ( found ) %]
                </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>
-            <p><button type="button" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% returnbranch %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button></p>
+    [% 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>
+                        <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
+                        <input type="hidden" name="transferitem" value="[% itemnumber | 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 %]
+                        <input type="hidden" name="barcode" value="0" />
+                        <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
+                        <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
+                        [% END %]
+                    </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"  onclick="$('#barcode').focus(); return false;"></i> No</button>
+                        [% ELSE %]
+                        <button type="submit" class="btn btn-default approve"><i class="fa fa-check" onclick="$('#barcode').focus(); return false;"></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 %]
+                    </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" value="Yes" class="print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% returnbranch %]&amp;op=slip"><i class="fa fa-print"></i> Yes, print slip</button>
-    [% END %]
-    <button type="submit" name="dotransfer" value="Yes" class="submit"><i class="fa fa-check"></i> Yes</button>
-    <button type="submit" name="notransfer" value="No" 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>
+>>>>>>> f3b362120f... Bug 21346: Convert dialogs to modals.
     [% END %]
 
     [% IF ( diffbranch ) %]