Bug 22330: Transfer limits should be respected for placing holds in staff interface...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reserve / request.tt
index 9ed0bd8..fd7571e 100644 (file)
@@ -6,6 +6,7 @@
 [% USE Categories %]
 [% USE ItemTypes %]
 [% USE AuthorisedValues %]
+[% USE Price %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 [% UNLESS ( multi_hold ) %]
@@ -14,7 +15,6 @@
     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Confirm holds</title>
 [% END %]
 [% INCLUDE 'doc-head-close.inc' %]
-[% Asset.css("css/datatables.css") | $raw %]
 </head>
 
 <body id="circ_request" class="catalog">
@@ -69,7 +69,7 @@
         [% UNLESS borrowers %]
                 <label for="patron">Patron: </label>
                 <div class="hint">Enter patron card number or partial name:</div>
-                <input type="text" size="40" id="patron" class="focus" name="findborrower" />
+                <input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
                 <input type="submit" value="Search" />
             [% IF multi_hold %]
                 <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
     [% END %]
 
     [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
-    <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has outstanding fines: [% amount_outstanding | format('%.2f') %]</strong></li>
+    <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li>
     [% END %]
 
     [% IF ( diffbranch ) %]
         <li>
             <label for="pickup">Pickup at:</label>
             <select name="pickup" size="1" id="pickup">
-                [% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 } }) %]
+                [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
             </select>
         </li>
 
                                 Patron is from different library
                             [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
                                 Patron already has hold for this item
+                            [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
+                                Cannot be transferred to pickup library
                             [% ELSE %]
                                 [% itemloo.not_holdable | html %]
                             [% END %]
                             [% SET branchcodes = [] %]
 
                             [% FOREACH h IN biblioloo.reserveloop %]
-                                [% branchcodes.push( h.branchcode ) | $raw %]
+                                [% branchcodes.push( h.branchcode ) %]
                             [% END %]
                             [% branchcodes = branchcodes.unique %]
 
                                 [% SET holds_by_branch = [] %]
                                 [% FOREACH h IN biblioloo.reserveloop %]
                                     [% IF h.branchcode == b %]
-                                        [% holds_by_branch.push( h ) | $raw %]
+                                        [% holds_by_branch.push( h ) %]
                                     [% END %]
                                 [% END %]
                                 <fieldset>
 
                             [% FOREACH h IN biblioloo.reserveloop %]
                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
-                                [% itemtypes.push( hold_itemtype ) | $raw %]
+                                [% itemtypes.push( hold_itemtype ) %]
                             [% END %]
                             [% itemtypes = itemtypes.unique %]
 
                                 [% FOREACH h IN biblioloo.reserveloop %]
                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
                                     [% IF hold_itemtype == i %]
-                                        [% holds_by_itemtype.push( h ) | $raw %]
+                                        [% holds_by_itemtype.push( h ) %]
                                     [% END %]
                                 [% END %]
 
                             [% SET branchcodes = [] %]
 
                             [% FOREACH h IN biblioloo.reserveloop %]
-                                [% branchcodes.push( h.branchcode ) | $raw %]
+                                [% branchcodes.push( h.branchcode ) %]
                             [% END %]
                             [% branchcodes = branchcodes.unique %]
 
                                     [% SET holds_by_branch = [] %]
                                     [% FOREACH h IN biblioloo.reserveloop %]
                                         [% IF h.branchcode == b %]
-                                            [% holds_by_branch.push( h ) | $raw %]
+                                            [% holds_by_branch.push( h ) %]
                                         [% END %]
                                     [% END %]
 
                                     [% SET itemtypes = [] %]
                                     [% FOREACH h IN holds_by_branch %]
                                         [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
-                                        [% itemtypes.push( hold_itemtype ) | $raw %]
+                                        [% itemtypes.push( hold_itemtype ) %]
                                     [% END %]
                                     [% itemtypes = itemtypes.unique %]
 
                                             [% FOREACH h IN holds_by_branch %]
                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
                                                 [% IF hold_itemtype == i %]
-                                                    [% holds_by_itemtype.push( h ) | $raw %]
+                                                    [% holds_by_itemtype.push( h ) %]
                                                 [% END %]
                                             [% END %]
                                             [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'datatables.inc' %]
     [% INCLUDE 'calendar.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
     [% Asset.js("js/circ-patron-search-results.js") | $raw %]
     <script>
+        var biblionumber = "[% biblionumber %]";
+        var borrowernumber = "[% patron.borrowernumber %]";
         var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
         var patron_homebranch = "[% Branches.GetName( patron.branchcode ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
         var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
             [% END %][% END %][% END %]
         };
         var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
+        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
 
         $(document).ready(function() {
             function ToggleHoldsToPlace() {
                 ToggleHoldsToPlace();
             });
 
+            [% IF Koha.Preference('UseBranchTransferLimits') %]
+                $("#pickup").on('change', function(){
+                    var pickup = $("#pickup").val();
+                    var url = "?pickup=" + pickup;
+                    url += "&borrowernumber=" + borrowernumber;
+                    url += "&biblionumber=" + biblionumber;
+                    window.location.replace(url);
+                });
+            [% END %]
+
             [% IF AutoResumeSuspendedHolds %]
                 $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
             [% END %]