0283d80fe9ebc5e212a02154c62bb8174f3f2bf1
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / smart-rules.tt
1 [% USE Branches %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'calendar.inc' %]
6 <script type="text/javascript">
7 //<![CDATA[
8
9 function clear_edit(){
10     var cancel = confirm(_("Are you sure you want to cancel your changes?"));
11     if ( !cancel ) return;
12     $('#default-circulation-rules td').removeClass('highlighted-row');
13     var edit_row = $("#edit_row");
14     $(edit_row).find("input").each(function(){
15         var type = $(this).attr("type");
16         if (type != "button" && type != "submit" ) {
17             $(this).val("");
18             $(this).prop('disabled', false);
19         }
20         if ( type == "checkbox" ) {
21             $(this).prop('checked', false);
22         }
23     });
24     $(edit_row).find("select").prop('disabled', false);
25     $(edit_row).find("select option:first").attr("selected", "selected");
26     $(edit_row).find("td:last input[name='clear']").remove();
27 }
28
29 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
30
31 $(document).ready(function() {
32     $(".delete").on("click",function(){
33         return confirmDelete(MSG_CONFIRM_DELETE);
34     });
35
36         $('#cap_fine_to_replacement_price').on('change', function(){
37             $('#overduefinescap').prop('disabled', $(this).is(':checked') );
38         });
39         $('#selectlibrary').find("input:submit").hide();
40         $('#branch').change(function() {
41                 $('#selectlibrary').submit();
42         });
43         $(".editrule").click(function(){
44             if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
45                 var edit = confirm(_("Are you sure you want to edit another rule?"));
46                 if (!edit) return false;
47             }
48             $('#default-circulation-rules td').removeClass('highlighted-row');
49             $(this).parent().parent().find("td").each(function (i) {
50                 $(this).addClass('highlighted-row');
51                 itm = $(this).text();
52                 itm = itm.replace(/^\s*|\s*$/g,'');
53                 var current_column = $("#edit_row td:eq("+i+")");
54                 if ( i == 6 ) {
55                     // specific processing for the Hard due date column
56                     var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
57                     var input_value = '';
58                     if (typeof select_value === 'undefined'){
59                         select_value = '-1';
60                     }else {
61                         input_value = itm.split(' ')[1];
62                     }
63                     $(current_column).find("input[type='text']").val(input_value);
64                     $(current_column).find("select").val(select_value);
65                 } else if ( i == 12 ) {
66                     // specific processing for cap_fine_to_replacement_price
67                     var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
68                     $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
69                     $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
70                 } else {
71                     $(current_column).find("input[type='text']").val(itm);
72                     // select the corresponding option
73                     $(current_column).find("select option").each(function(){
74                         opt = $(this).text().toLowerCase();
75                         opt = opt.replace(/^\s*|\s*$/g,'');
76                         if ( opt == itm.toLowerCase() ) {
77                             $(this).attr('selected', 'selected');
78                         }
79                     });
80                     if ( i == 0 || i == 1 ) {
81                         // Disable the 2 first columns, we cannot update them.
82                         var val = $(current_column).find("select option:selected").val();
83                         var name = "categorycode";
84                         if ( i == 1 ) {
85                             name="itemtype";
86                         }
87                         // Remove potential previous input added
88                         $(current_column).find("input").remove();
89                         $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
90                     } else if ( i == 2 || i == 3 ) {
91                         // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
92                         // The value is "Unlimited" (or an equivalent translated string)
93                         // an it should be set to an empty string
94                         if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
95                             $(current_column).find("input[type='text']").val("");
96                         }
97                     }
98                 }
99             });
100             $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
101             $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
102             return false;
103         });
104         $(".clear_edit").on("click",function(e){
105             e.preventDefault();
106             clear_edit();
107         });
108 });
109 //]]>
110 </script>
111 </head>
112 <body id="admin_smart-rules" class="admin">
113 [% INCLUDE 'header.inc' %]
114 [% INCLUDE 'prefs-admin-search.inc' %]
115
116 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Circulation and fine rules</div>
117
118 <div id="doc3" class="yui-t1">
119
120 <div id="bd">
121     <div id="yui-main">
122     <div class="yui-b">
123     <h1 class="parameters">
124         [% IF humanbranch %]
125             Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
126         [% ELSE %]
127             Defining circulation and fine rules for all libraries
128         [% END %]
129     </h1>
130     <div class="help">
131         <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
132         <ul>
133             <li>same library, same patron category, same item type</li>
134             <li>same library, same patron category, all item types</li>
135             <li>same library, all patron categories, same item type</li>
136             <li>same library, all patron categories, all item types</li>
137             <li>default (all libraries), same patron category, same item type</li>
138             <li>default (all libraries), same patron category, all item types</li>
139             <li>default (all libraries), all patron categories, same item type</li>
140             <li>default (all libraries), all patron categories, all item types</li>
141         </ul>
142         <p>To modify a rule, create a new one with the same patron category and item type.</p>
143     </div>
144     <div>
145         <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
146         Select a library :
147             <select name="branch" id="branch" style="width:20em;">
148                 <option value="*">All libraries</option>
149                 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
150             </select>
151         </form>
152         [% IF ( definedbranch ) %]
153             <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
154                 <label for="tobranch"><strong>Clone these rules to:</strong></label>
155                 <input type="hidden" name="frombranch" value="[% current_branch %]" />
156                 <select name="tobranch" id="tobranch">
157                     [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
158                 </select>
159                 <input type="submit" value="Clone" />
160             </form>
161         [% END %]
162
163         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
164             <input type="hidden" name="op" value="add" />
165             <input type="hidden" name="branch" value="[% current_branch %]"/>
166             <table id="default-circulation-rules">
167             <thead>
168             <tr>
169                 <th>Patron category</th>
170                 <th>Item type</th>
171                 <th>Current checkouts allowed</th>
172                 <th>Current on-site checkouts allowed</th>
173                 <th>Loan period</th>
174                 <th>Unit</th>
175                 <th>Hard due date</th>
176                 <th>Fine amount</th>
177                 <th>Fine charging interval</th>
178                 <th>When to charge</th>
179                 <th>Fine grace period</th>
180                 <th>Overdue fines cap (amount)</th>
181                 <th>Cap fine at replacement price</th>
182                 <th>Suspension in days (day)</th>
183                 <th>Max. suspension duration (day)</th>
184                 <th>Renewals allowed (count)</th>
185                 <th>Renewal period</th>
186                 <th>No renewal before</th>
187                 <th>Automatic renewal</th>
188                 <th>No automatic renewal after</th>
189                 <th>No automatic renewal after (hard limit)</th>
190                 <th>Holds allowed (count)</th>
191                 <th>Holds per record (count)</th>
192                 <th>On shelf holds allowed</th>
193                 <th>Item level holds</th>
194                 <th>Article requests</th>
195                 <th>Rental discount (%)</th>
196                 <th>Actions</th>
197             </tr>
198             </thead>
199             <tbody>
200                                 [% FOREACH rule IN rules %]
201                                         <tr id="row_[% loop.count %]">
202                                                         <td>[% IF ( rule.default_humancategorycode ) %]
203                                                                         <em>All</em>
204                                                                 [% ELSE %]
205                                                                         [% rule.humancategorycode %]
206                                                                 [% END %]
207                                                         </td>
208                             <td>[% IF rule.default_translated_description %]
209                                                                         <em>All</em>
210                                                                 [% ELSE %]
211                                                                         [% rule.translated_description %]
212                                                                 [% END %]
213                                                         </td>
214                                                         <td>[% IF ( rule.unlimited_maxissueqty ) %]
215                                                                         Unlimited
216                                                                 [% ELSE %]
217                                                                         [% rule.maxissueqty %]
218                                                                 [% END %]
219                                                         </td>
220                             <td>[% IF rule.unlimited_maxonsiteissueqty %]
221                                     Unlimited
222                                 [% ELSE %]
223                                     [% rule.maxonsiteissueqty %]
224                                 [% END %]
225                             </td>
226                                                         <td>[% rule.issuelength %]</td>
227                                                         <td>
228                                                             [% rule.lengthunit %]
229                                                         </td>
230                             <td>
231                               [% IF ( rule.hardduedate ) %]
232                                 [% IF ( rule.hardduedatebefore ) %]
233                                   before [% rule.hardduedate %]
234                                   <input type="hidden" name="hardduedatecomparebackup" value="-1" />
235                                 [% ELSIF ( rule.hardduedateexact ) %]
236                                   on [% rule.hardduedate %]
237                                   <input type="hidden" name="hardduedatecomparebackup" value="0" />
238                                 [% ELSIF ( rule.hardduedateafter ) %]
239                                   after [% rule.hardduedate %]
240                                   <input type="hidden" name="hardduedatecomparebackup" value="1" />
241                                 [% END %]
242                               [% ELSE %]
243                                 None defined
244                               [% END %]
245                             </td>
246                                                         <td>[% rule.fine %]</td>
247                                                         <td>[% rule.chargeperiod %]</td>
248                 <td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
249                                                         <td>[% rule.firstremind %]</td>
250                             <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
251                             <td>
252                                 [% IF rule.cap_fine_to_replacement_price %]
253                                     <input type="checkbox" checked="checked" disabled="disabled" />
254                                 [% ELSE %]
255                                     <input type="checkbox" disabled="disabled" />
256                                 [% END %]
257                             </td>
258                                                         <td>[% rule.finedays %]</td>
259                             <td>[% rule.maxsuspensiondays %]</td>
260                                                         <td>[% rule.renewalsallowed %]</td>
261                             <td>[% rule.renewalperiod %]</td>
262                             <td>[% rule.norenewalbefore %]</td>
263                             <td>
264                                 [% IF ( rule.auto_renew ) %]
265                                 Yes
266                                 [% ELSE %]
267                                 No
268                                 [% END %]
269                             </td>
270                             <td>[% rule.no_auto_renewal_after %]</td>
271                             <td>[% rule.no_auto_renewal_after_hard_limit %]</td>
272                                                         <td>[% rule.reservesallowed %]</td>
273                                                         <td>[% rule.holds_per_record %]</td>
274                                                         <td>
275                                                             [% IF rule.onshelfholds == 1 %]
276                                                                 Yes
277                                                             [% ELSIF rule.onshelfholds == 2 %]
278                                                                 If all unavailable
279                                                             [% ELSE %]
280                                                                 If any unavailable
281                                                             [% END %]</td>
282                                                         <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
283                                                         <td>
284                                                             [% IF rule.article_requests == 'no' %]
285                                                                 No
286                                                             [% ELSIF rule.article_requests == 'yes' %]
287                                                                 Yes
288                                                             [% ELSIF rule.article_requests == 'bib_only' %]
289                                                                 Record only
290                                                             [% ELSIF rule.article_requests == 'item_only' %]
291                                                                 Item only
292                                                             [% END %]
293                                                         </td>
294                                                         <td>[% rule.rentaldiscount %]</td>
295                                                         <td class="actions">
296                                                           <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
297                                                           <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
298                                                         </td>
299                         </tr>
300                 [% END %]
301                 <tr id="edit_row">
302                     <td>
303                         <select name="categorycode" id="categorycode">
304                             <option value="*">All</option>
305                         [% FOREACH patron_category IN patron_categories%]
306                             <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
307                         [% END %]
308                         </select>
309                     </td>
310                     <td>
311                         <select name="itemtype" id="matrixitemtype" style="width:13em;">
312                             <option value="*">All</option>
313                         [% FOREACH itemtypeloo IN itemtypeloop %]
314                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
315                         [% END %]
316                         </select>
317                     </td>
318                     <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
319                     <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
320                     <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
321                     <td>
322                       <select name="lengthunit" id="lengthunit">
323                         <option value="days" selected="selected">Days</option>
324                         <option value="hours">Hours</option>
325                       </select>
326                     </td>
327                     <td>
328                         <select name="hardduedatecompare" id="hardduedatecompare">
329                            <option value="-1">Before</option>
330                            <option value="0">Exactly on</option>
331                            <option value="1">After</option>
332                         </select>
333                         <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" />
334                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
335                     </td>
336                     <td><input type="text" name="fine" id="fine" size="4" /></td>
337                     <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
338                     <td>
339                         <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
340                            <option value="0">End of interval</option>
341                            <option value="1">Start of interval</option>
342                         </select>
343                     </td>
344                     <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
345                     <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
346                     <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
347                     <td><input type="text" name="finedays" id="fined" size="3" /> </td>
348                     <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
349                     <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
350                     <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
351                     <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
352                     <td>
353                         <select name="auto_renew" id="auto_renew">
354                             <option value="no" selected>No</option>
355                             <option value="yes">Yes</option>
356                         </select>
357                     </td>
358                     <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
359                     <td>
360                         <input type="text" size="10" name="no_auto_renewal_after_hard_limit" id="no_auto_renewal_after_hard_limit" value="[% no_auto_renewal_after_hard_limit %]" class="datepicker"/>
361                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
362                     </td>
363                     <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
364                     <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
365                     <td>
366                         <select name="onshelfholds" id="onshelfholds">
367                             <option value="1">Yes</option>
368                             <option value="0">If any unavailable</option>
369                             <option value="2">If all unavailable</option>
370                         </select>
371                     </td>
372                     <td>
373                         <select id="opacitemholds" name="opacitemholds">
374                             <option value="N">Don't allow</option>
375                             <option value="Y">Allow</option>
376                             <option value="F">Force</option>
377                         </select>
378                     </td>
379                     <td>
380                         <select id="article_requests" name="article_requests">
381                             <option value="no">No</option>
382                             <option value="yes">Yes</option>
383                             <option value="bib_only">Record only</option>
384                             <option value="item_only">Item only</option>
385                         </select>
386                     </td>
387                     <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
388                     <td class="actions">
389                         <input type="hidden" name="branch" value="[% current_branch %]"/>
390                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
391                         <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
392                     </td>
393                 </tr>
394                 <tfoot>
395                     <tr>
396                       <th>Patron category</th>
397                       <th>Item type</th>
398                       <th>Current checkouts allowed</th>
399                       <th>Current on-site checkouts allowed</th>
400                       <th>Loan period</th>
401                       <th>Unit</th>
402                       <th>Hard due date</th>
403                       <th>Fine amount</th>
404                       <th>Fine charging interval</th>
405                       <th>Charge when?</th>
406                       <th>Fine grace period</th>
407                       <th>Overdue fines cap (amount)</th>
408                       <th>Cap fine at replacement price</th>
409                       <th>Suspension in days (day)</th>
410                       <th>Max. suspension duration (day)</th>
411                       <th>Renewals allowed (count)</th>
412                       <th>Renewal period</th>
413                       <th>No renewal before</th>
414                       <th>Automatic renewal</th>
415                       <th>No automatic renewal after</th>
416                        <th>No automatic renewal after (hard limit)</th>
417                       <th>Holds allowed (count)</th>
418                       <th>Holds per record (count)</th>
419                       <th>On shelf holds allowed</th>
420                       <th>Item level holds</th>
421                       <th>Article requests</th>
422                       <th>Rental discount (%)</th>
423                       <th colspan="2">&nbsp;</th>
424                     </tr>
425                   </tfoot>
426                 </tbody>
427             </table>
428         </form>
429     </div>
430     <div id="defaults-for-this-library" class="container">
431     <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
432         <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p>
433         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
434             <input type="hidden" name="op" value="set-branch-defaults" />
435             <input type="hidden" name="branch" value="[% current_branch %]"/>
436             <table>
437                 <tr>
438                     <th>&nbsp;</th>
439                     <th>Total current checkouts allowed</th>
440                     <th>Total current on-site checkouts allowed</th>
441                     <th>Hold policy</th>
442                     <th>Hold pickup library match</th>
443                     <th>Return policy</th>
444                     <th>Actions</th>
445                 </tr>
446                 <tr>
447                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
448                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
449                     <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
450                     <td>
451                         <select name="holdallowed">
452                             [% IF ( default_holdallowed_any ) %]
453                             <option value="2" selected="selected">
454                             [% ELSE %]
455                             <option value="2">
456                             [% END %]
457                                 From any library
458                             </option>
459                             [% IF ( default_holdallowed_same ) %]
460                             <option value="1" selected="selected">
461                             [% ELSE %]
462                             <option value="1">
463                             [% END %]
464                                 From home library
465                             </option>
466                             [% IF ( default_holdallowed_none ) %]
467                             <option value="0" selected="selected">
468                             [% ELSE %]
469                             <option value="0">
470                             [% END %]
471                                 No holds allowed
472                             </option>
473                         </select>
474                     </td>
475                     <td>
476                         <select name="hold_fulfillment_policy">
477                             [% IF default_hold_fulfillment_policy == 'any' %]
478                                 <option value="any" selected="selected">
479                                     any library
480                                 </option>
481                             [% ELSE %]
482                                 <option value="any">
483                                     any library
484                                 </option>
485                             [% END %]
486
487                             [% IF default_hold_fulfillment_policy == 'homebranch' %]
488                                 <option value="homebranch" selected="selected">
489                                     item's home library
490                                 </option>
491                             [% ELSE %]
492                                 <option value="homebranch">
493                                     item's home library
494                                 </option>
495                             [% END %]
496
497                             [% IF default_hold_fulfillment_policy == 'holdingbranch' %]
498                                 <option value="holdingbranch" selected="selected">
499                                     item's holding library
500                                 </option>
501                             [% ELSE %]
502                                 <option value="holdingbranch">
503                                     item's holding library
504                                 </option>
505                             [% END %]
506                         </select>
507                     </td>
508                     <td>
509                         <select name="returnbranch">
510                             [% IF ( default_returnbranch == 'homebranch' ) %]
511                             <option value="homebranch" selected="selected">
512                             [% ELSE %]
513                             <option value="homebranch">
514                             [% END %]
515                                 Item returns home
516                             </option>
517                             [% IF ( default_returnbranch == 'holdingbranch' ) %]
518                             <option value="holdingbranch" selected="selected">
519                             [% ELSE %]
520                             <option value="holdingbranch">
521                             [% END %]
522                                 Item returns to issuing library
523                             </option>
524                             [% IF ( default_returnbranch == 'noreturn' ) %]
525                             <option value="noreturn" selected="selected">
526                             [% ELSE %]
527                             <option value="noreturn">
528                             [% END %]
529                                 Item floats
530                             </option>
531                         </select>
532                     </td>
533                     <td class="actions">
534                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
535                         <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
536                     </td>
537                 </tr>
538             </table>
539         </form>
540     </div>
541     [% IF ( show_branch_cat_rule_form ) %]
542     <div id="holds-policy-by-patron-category" class="container">
543     <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
544         <p>For this library, you can specify the maximum number of loans that
545             a patron of a given category can make, regardless of the item type.
546         </p>
547         <p>If the total amount loanable for a given patron category is left blank,
548            no limit applies, except possibly for a limit you define for a specific item type.
549         </p>
550         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
551             <input type="hidden" name="op" value="add-branch-cat" />
552             <input type="hidden" name="branch" value="[% current_branch %]"/>
553             <table>
554                 <tr>
555                     <th>Patron category</th>
556                     <th>Total current checkouts allowed</th>
557                     <th>Total current on-site checkouts allowed</th>
558                     <th>&nbsp;</th>
559                 </tr>
560                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
561                     [% UNLESS ( loop.odd ) %]
562                     <tr class="highlight">
563                     [% ELSE %]
564                     <tr>
565                     [% END %]
566                         <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
567                                 <em>Default</em>
568                             [% ELSE %]
569                                 [% branch_cat_rule_loo.humancategorycode %]
570                             [% END %]
571                         </td>
572                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
573                                 Unlimited
574                             [% ELSE %]
575                                 [% branch_cat_rule_loo.maxissueqty %]
576                             [% END %]
577                         </td>
578                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
579                                 Unlimited
580                             [% ELSE %]
581                                 [% branch_cat_rule_loo.maxonsiteissueqty %]
582                             [% END %]
583                         </td>
584
585                         <td class="actions">
586                             <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% branch_cat_rule_loo.categorycode %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
587                         </td>
588                     </tr>
589                 [% END %]
590                 <tr>
591                     <td>
592                         <select name="categorycode">
593                         [% FOREACH patron_category IN patron_categories%]
594                             <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
595                         [% END %]
596                         </select>
597                     </td>
598                     <td><input name="maxissueqty" size="3" /></td>
599                     <td><input name="maxonsiteissueqty" size="3" /></td>
600                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
601                 </tr>
602             </table>
603         </form>
604     </div>
605     [% END %]
606
607     <div id="refund-lost-item-fee-on-return" class="container">
608   [% IF current_branch == '*' %]
609     <h3>Default lost item fee refund on return policy</h3>
610   [% ELSE %]
611     <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) %]</h3>
612   [% END %]
613         <p>Specify the default policy for lost item fees on return.
614         </p>
615         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
616             <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
617             <input type="hidden" name="branch" value="[% current_branch %]" />
618             <table>
619                 <tr>
620                     <th>Refund lost item fee</th>
621                     <th>&nbsp;</th>
622                 </tr>
623                 <tr>
624                     <td>
625                         <select name="refund">
626                           [#% Default branch %#]
627                           [% IF ( current_branch == '*' ) %]
628                             [% IF ( refundLostItemFeeRule.refund ) %]
629                             <option value="1" selected="selected">
630                             [% ELSE %]
631                             <option value="1">
632                             [% END %]
633                                 Yes
634                             </option>
635                             [% IF ( not refundLostItemFeeRule.refund ) %]
636                             <option value="0" selected="selected">
637                             [% ELSE %]
638                             <option value="0">
639                             [% END %]
640                                 No
641                             </option>
642                           [% ELSE %]
643                           [#% Branch-specific %#]
644                             [% IF ( not refundLostItemFeeRule ) %]
645                                 <option value="*" selected="selected">
646                             [% ELSE %]
647                                 <option value="*">
648                             [% END %]
649                               [% IF defaultRefundRule %]
650                                 Use default (Yes)
651                               [% ELSE %]
652                                 Use default (No)
653                               [% END %]
654                                 </option>
655                             [% IF ( not refundLostItemFeeRule ) %]
656                                 <option value="1">Yes</option>
657                                 <option value="0">No</option>
658                             [% ELSE %]
659                                 [% IF ( refundLostItemFeeRule.refund ) %]
660                                 <option value="1" selected="selected">
661                                 [% ELSE %]
662                                 <option value="1">
663                                 [% END %]
664                                     Yes
665                                 </option>
666                                 [% IF ( not refundLostItemFeeRule.refund ) %]
667                                 <option value="0" selected="selected">
668                                 [% ELSE %]
669                                 <option value="0">
670                                 [% END %]
671                                     No
672                                 </option>
673                             [% END %]
674                           [% END %]
675                         </select>
676                     </td>
677                     <td class="actions">
678                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
679                     </td>
680                     </td>
681                 </tr>
682             </table>
683         </form>
684     </div>
685
686     <div id="holds-policy-by-item-type" class="container">
687     <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
688         <p>
689             For this library, you can edit rules for given itemtypes, regardless
690             of the patron's category.
691         </p>
692         <p>
693             Currently, this means hold policies.
694             The various policies have the following effects:
695         </p>
696         <ul>
697             <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
698             <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
699             <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
700         </ul>
701         <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
702             <strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
703         </p>
704
705         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
706             <input type="hidden" name="op" value="add-branch-item" />
707             <input type="hidden" name="branch" value="[% current_branch %]"/>
708             <table>
709                 <tr>
710                     <th>Item type</th>
711                     <th>Hold policy</th>
712                     <th>Hold pickup library match</th>
713                     <th>Return policy</th>
714                     <th>&nbsp;</th>
715                 </tr>
716                 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
717                     [% UNLESS ( loop.odd ) %]
718                     <tr class="highlight">
719                     [% ELSE %]
720                     <tr>
721                     [% END %]
722                         <td>[% IF ( branch_item_rule_loo.default_translated_description ) %]
723                                 <em>Default</em>
724                             [% ELSE %]
725                                 [% branch_item_rule_loo.translated_description %]
726                             [% END %]
727                         </td>
728                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
729                                 From any library
730                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
731                                 From home library
732                             [% ELSE %]
733                                 No holds allowed
734                             [% END %]
735                         </td>
736                         <td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
737                                 any library
738                             [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
739                                 item's home library
740                             [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
741                                 item's holding library
742                             [% END %]
743                         </td>
744                         <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
745                                 Item returns home
746                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
747                                 Item returns to issuing branch
748                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
749                                 Item floats
750                             [% ELSE %]
751                                 Error - unknown option
752                             [% END %]
753                         </td>
754                         <td class="actions">
755                             <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=[% branch_item_rule_loo.itemtype %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
756                         </td>
757                     </tr>
758                 [% END %]
759                 <tr>
760                     <td>
761                         <select name="itemtype">
762                         [% FOREACH itemtypeloo IN itemtypeloop %]
763                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
764                         [% END %]
765                         </select>
766                     </td>
767                     <td>
768                         <select name="holdallowed">
769                             <option value="2">From any library</option>
770                             <option value="1">From home library</option>
771                             <option value="0">No holds allowed</option>
772                         </select>
773                     </td>
774                     <td>
775                         <select name="hold_fulfillment_policy">
776                             <option value="any">
777                                 any library
778                             </option>
779
780                             <option value="homebranch">
781                                 item's home library
782                             </option>
783
784                             <option value="holdingbranch">
785                                 item's holding library
786                             </option>
787                         </select>
788                     </td>
789                     <td>
790                         <select name="returnbranch">
791                             <option value="homebranch">Item returns home</option>
792                             <option value="holdingbranch">Item returns to issuing library</option>
793                             <option value="noreturn">Item floats</option>
794                         </select>
795                     </td>
796                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
797                 </tr>
798             </table>
799         </form>
800     </div>
801 </div>
802
803 </div>
804 <div class="yui-b">
805 [% INCLUDE 'admin-menu.inc' %]
806 </div>
807 </div>
808 [% INCLUDE 'intranet-bottom.inc' %]