Bug 23112: (follow-up) Conditionally prevent checkout
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / ill / ill-requests.tt
index 5088252..b5ccab4 100644 (file)
 
                 [% ELSIF query_type == 'check_out' and !whole.error %]
                     [% IF !whole.stage || whole.stage == 'form' %]
-                        <h1 id="ill-issue-title">Issue requested item to [% request.patron.firstname %] [% request.patron.surname %]</h1>
+                        <h1 id="ill-issue-title">Issue requested item to [% INCLUDE 'patron-title.inc' patron = request.patron %]</h1>
                         [% IF !request.biblio_id || request.biblio_id.length == 0 %]
                         <div class="alert">This item cannot be issued as it has no biblio record associated with it</div>
                         [% END %]
                             </div>
                             [% ELSE %]
                             <div class="alert">
-                                There was a problem checking this item out, please check for problems with the <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% whole.value.patron.borrowernumber %]">patron's account</a>
+                                There was a problem checking this item out, please check for problems with the <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% whole.value.patron.borrowernumber | uri %]">patron's account</a>
                             </div>
                             [% END %]
                         [% END %]
                                                 <option value=""></option>
                                                 [% FOREACH stat IN whole.value.statistical %]
                                                     [% IF stat.borrowernumber == params.inhouse %]
-                                                        <option value="[% stat.cardnumber %]" selected>[% stat.firstname %] [% stat.surname %]</option>
+                                                        <option value="[% stat.cardnumber | html %]" selected>[% INCLUDE 'patron-title.inc' patron = stat %]</option>
                                                     [% ELSE %]
-                                                        <option value="[% stat.cardnumber %]">[% stat.firstname %] [% stat.surname %]</option>
+                                                        <option value="[% stat.cardnumber | html %]">[% INCLUDE 'patron-title.inc' patron = stat %]</option>
                                                     [% END %]
                                                 [% END %]
                                             </select>
                                             [% IF whole.value.errors.inhouse %]
                                             <span class="required">You must choose a valid patron</span>
                                             [% END %]
-                                            <div class="hint">If you do not wish to check out the item to [% request.patron.firstname | html %] [% request.patron.surname | html %] and would rather issue it to an in-house statistical patron, choose the patron here</div>
+                                            <div class="hint">If you do not wish to check out the item to [% INCLUDE 'patron-title.inc' patron = request.patron %] and would rather issue it to an in-house statistical patron, choose the patron here</div>
                                         </li>
                                         <li class="ill_checkout_item_type">
                                             <label for="item_type" class="ill_checkout_item_type_label required">Item type:</label>
                                         [% IF items.size == 1 %]
                                             <li>
                                                 <label for="barcode" class="ill_checkout_barcode_label">Item barcode:</label>
-                                                [% items.0.barcode %]
+                                                [% items.0.barcode | html %]
                                             </li>
                                         [% END %]
                                         <li class="ill_checkout_branchcode">
                                             [% ELSE %]
                                                 [% FOREACH branch IN whole.value.libraries.unblessed %]
                                                     [% IF branch.branchcode == branchcode %]
-                                                        [% branch.branchname %]
+                                                        [% branch.branchname | html %]
                                                     [% END %]
                                                 [% END %]
                                             [% END %]
                                     <input type="hidden" value="check_out" name="method">
                                     <input type="hidden" value="form" name="stage">
                                     [% IF items.size == 1 %]
-                                        <input name="branchcode" type="hidden" value="[% branchcode  %]">
-                                        <input name="item_type" type="hidden" value="[% items.0.itype %]">
+                                        <input name="branchcode" type="hidden" value="[% branchcode | html %]">
+                                        <input name="item_type" type="hidden" value="[% items.0.itype | html %]">
                                     [% END %]
                                     <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
                                     <input type="submit" value="Submit">
                             <ol>
                                 <li>
                                     <label>Checked out to:</label>
-                                    [% whole.value.patron.firstname | html %] [% whole.value.patron.surname | html %]
+                                    [% INCLUDE 'patron-title.inc' patron = whole.value.patron %]
                                 </li>
                                 <li>
                                     <label>Due date:</label>
                         [% FOREACH action IN request.available_actions %]
                             [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %]
                             [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %]
+                            [% needs_all = action.needs_all.size ? action.needs_all : [] %]
                             [% has_prefs_count = 0 %]
                             [% has_perms_count = 0 %]
+                            [% has_all_count = 0 %]
                             [% FOREACH pref IN needs_prefs %]
                                 [% IF Koha.Preference(pref) %]
                                     [% has_prefs_count = has_prefs_count + 1 %]
                                     [% has_perms_count = has_perms_count + 1 %]
                                 [% END %]
                             [% END %]
-                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size %]
+                            [% FOREACH func IN needs_all %]
+                                [% IF func(request) %]
+                                    [% has_all_count = has_all_count + 1 %]
+                                [% END %]
+                            [% END %]
+                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
                             [% IF action.method == 'migrate' %]
                                 [% IF backends.size > 2 %]
                                     <div class="dropdown btn-group">
     </script>
     [% INCLUDE 'ill-list-table-strings.inc' %]
     [% Asset.js("js/ill-list-table.js") | $raw %]
-    [% Asset.js("js/ill-check-out.js") | $raw %]
 [% END %]
 
 [% TRY %]