Bug 16344: Add a circ rule to limit the auto renewals given a specific
[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>Holds allowed (count)</th>
417                       <th>Holds per record (count)</th>
418                       <th>On shelf holds allowed</th>
419                       <th>Item level holds</th>
420                       <th>Article requests</th>
421                       <th>Rental discount (%)</th>
422                       <th colspan="2">&nbsp;</th>
423                     </tr>
424                   </tfoot>
425                 </tbody>
426             </table>
427         </form>
428     </div>
429     <div id="defaults-for-this-library" class="container">
430     <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
431         <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>
432         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
433             <input type="hidden" name="op" value="set-branch-defaults" />
434             <input type="hidden" name="branch" value="[% current_branch %]"/>
435             <table>
436                 <tr>
437                     <th>&nbsp;</th>
438                     <th>Total current checkouts allowed</th>
439                     <th>Total current on-site checkouts allowed</th>
440                     <th>Hold policy</th>
441                     <th>Hold pickup library match</th>
442                     <th>Return policy</th>
443                     <th>Actions</th>
444                 </tr>
445                 <tr>
446                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
447                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
448                     <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
449                     <td>
450                         <select name="holdallowed">
451                             [% IF ( default_holdallowed_any ) %]
452                             <option value="2" selected="selected">
453                             [% ELSE %]
454                             <option value="2">
455                             [% END %]
456                                 From any library
457                             </option>
458                             [% IF ( default_holdallowed_same ) %]
459                             <option value="1" selected="selected">
460                             [% ELSE %]
461                             <option value="1">
462                             [% END %]
463                                 From home library
464                             </option>
465                             [% IF ( default_holdallowed_none ) %]
466                             <option value="0" selected="selected">
467                             [% ELSE %]
468                             <option value="0">
469                             [% END %]
470                                 No holds allowed
471                             </option>
472                         </select>
473                     </td>
474                     <td>
475                         <select name="hold_fulfillment_policy">
476                             [% IF default_hold_fulfillment_policy == 'any' %]
477                                 <option value="any" selected="selected">
478                                     any library
479                                 </option>
480                             [% ELSE %]
481                                 <option value="any">
482                                     any library
483                                 </option>
484                             [% END %]
485
486                             [% IF default_hold_fulfillment_policy == 'homebranch' %]
487                                 <option value="homebranch" selected="selected">
488                                     item's home library
489                                 </option>
490                             [% ELSE %]
491                                 <option value="homebranch">
492                                     item's home library
493                                 </option>
494                             [% END %]
495
496                             [% IF default_hold_fulfillment_policy == 'holdingbranch' %]
497                                 <option value="holdingbranch" selected="selected">
498                                     item's holding library
499                                 </option>
500                             [% ELSE %]
501                                 <option value="holdingbranch">
502                                     item's holding library
503                                 </option>
504                             [% END %]
505                         </select>
506                     </td>
507                     <td>
508                         <select name="returnbranch">
509                             [% IF ( default_returnbranch == 'homebranch' ) %]
510                             <option value="homebranch" selected="selected">
511                             [% ELSE %]
512                             <option value="homebranch">
513                             [% END %]
514                                 Item returns home
515                             </option>
516                             [% IF ( default_returnbranch == 'holdingbranch' ) %]
517                             <option value="holdingbranch" selected="selected">
518                             [% ELSE %]
519                             <option value="holdingbranch">
520                             [% END %]
521                                 Item returns to issuing library
522                             </option>
523                             [% IF ( default_returnbranch == 'noreturn' ) %]
524                             <option value="noreturn" selected="selected">
525                             [% ELSE %]
526                             <option value="noreturn">
527                             [% END %]
528                                 Item floats
529                             </option>
530                         </select>
531                     </td>
532                     <td class="actions">
533                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
534                         <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>
535                     </td>
536                 </tr>
537             </table>
538         </form>
539     </div>
540     [% IF ( show_branch_cat_rule_form ) %]
541     <div id="holds-policy-by-patron-category" class="container">
542     <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
543         <p>For this library, you can specify the maximum number of loans that
544             a patron of a given category can make, regardless of the item type.
545         </p>
546         <p>If the total amount loanable for a given patron category is left blank,
547            no limit applies, except possibly for a limit you define for a specific item type.
548         </p>
549         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
550             <input type="hidden" name="op" value="add-branch-cat" />
551             <input type="hidden" name="branch" value="[% current_branch %]"/>
552             <table>
553                 <tr>
554                     <th>Patron category</th>
555                     <th>Total current checkouts allowed</th>
556                     <th>Total current on-site checkouts allowed</th>
557                     <th>&nbsp;</th>
558                 </tr>
559                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
560                     [% UNLESS ( loop.odd ) %]
561                     <tr class="highlight">
562                     [% ELSE %]
563                     <tr>
564                     [% END %]
565                         <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
566                                 <em>Default</em>
567                             [% ELSE %]
568                                 [% branch_cat_rule_loo.humancategorycode %]
569                             [% END %]
570                         </td>
571                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
572                                 Unlimited
573                             [% ELSE %]
574                                 [% branch_cat_rule_loo.maxissueqty %]
575                             [% END %]
576                         </td>
577                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
578                                 Unlimited
579                             [% ELSE %]
580                                 [% branch_cat_rule_loo.maxonsiteissueqty %]
581                             [% END %]
582                         </td>
583
584                         <td class="actions">
585                             <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>
586                         </td>
587                     </tr>
588                 [% END %]
589                 <tr>
590                     <td>
591                         <select name="categorycode">
592                         [% FOREACH patron_category IN patron_categories%]
593                             <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
594                         [% END %]
595                         </select>
596                     </td>
597                     <td><input name="maxissueqty" size="3" /></td>
598                     <td><input name="maxonsiteissueqty" size="3" /></td>
599                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
600                 </tr>
601             </table>
602         </form>
603     </div>
604     [% END %]
605
606     <div id="refund-lost-item-fee-on-return" class="container">
607   [% IF current_branch == '*' %]
608     <h3>Default lost item fee refund on return policy</h3>
609   [% ELSE %]
610     <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) %]</h3>
611   [% END %]
612         <p>Specify the default policy for lost item fees on return.
613         </p>
614         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
615             <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
616             <input type="hidden" name="branch" value="[% current_branch %]" />
617             <table>
618                 <tr>
619                     <th>Refund lost item fee</th>
620                     <th>&nbsp;</th>
621                 </tr>
622                 <tr>
623                     <td>
624                         <select name="refund">
625                           [#% Default branch %#]
626                           [% IF ( current_branch == '*' ) %]
627                             [% IF ( refundLostItemFeeRule.refund ) %]
628                             <option value="1" selected="selected">
629                             [% ELSE %]
630                             <option value="1">
631                             [% END %]
632                                 Yes
633                             </option>
634                             [% IF ( not refundLostItemFeeRule.refund ) %]
635                             <option value="0" selected="selected">
636                             [% ELSE %]
637                             <option value="0">
638                             [% END %]
639                                 No
640                             </option>
641                           [% ELSE %]
642                           [#% Branch-specific %#]
643                             [% IF ( not refundLostItemFeeRule ) %]
644                                 <option value="*" selected="selected">
645                             [% ELSE %]
646                                 <option value="*">
647                             [% END %]
648                               [% IF defaultRefundRule %]
649                                 Use default (Yes)
650                               [% ELSE %]
651                                 Use default (No)
652                               [% END %]
653                                 </option>
654                             [% IF ( not refundLostItemFeeRule ) %]
655                                 <option value="1">Yes</option>
656                                 <option value="0">No</option>
657                             [% ELSE %]
658                                 [% IF ( refundLostItemFeeRule.refund ) %]
659                                 <option value="1" selected="selected">
660                                 [% ELSE %]
661                                 <option value="1">
662                                 [% END %]
663                                     Yes
664                                 </option>
665                                 [% IF ( not refundLostItemFeeRule.refund ) %]
666                                 <option value="0" selected="selected">
667                                 [% ELSE %]
668                                 <option value="0">
669                                 [% END %]
670                                     No
671                                 </option>
672                             [% END %]
673                           [% END %]
674                         </select>
675                     </td>
676                     <td class="actions">
677                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
678                     </td>
679                     </td>
680                 </tr>
681             </table>
682         </form>
683     </div>
684
685     <div id="holds-policy-by-item-type" class="container">
686     <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
687         <p>
688             For this library, you can edit rules for given itemtypes, regardless
689             of the patron's category.
690         </p>
691         <p>
692             Currently, this means hold policies.
693             The various policies have the following effects:
694         </p>
695         <ul>
696             <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
697             <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
698             <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
699         </ul>
700         <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
701             <strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
702         </p>
703
704         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
705             <input type="hidden" name="op" value="add-branch-item" />
706             <input type="hidden" name="branch" value="[% current_branch %]"/>
707             <table>
708                 <tr>
709                     <th>Item type</th>
710                     <th>Hold policy</th>
711                     <th>Hold pickup library match</th>
712                     <th>Return policy</th>
713                     <th>&nbsp;</th>
714                 </tr>
715                 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
716                     [% UNLESS ( loop.odd ) %]
717                     <tr class="highlight">
718                     [% ELSE %]
719                     <tr>
720                     [% END %]
721                         <td>[% IF ( branch_item_rule_loo.default_translated_description ) %]
722                                 <em>Default</em>
723                             [% ELSE %]
724                                 [% branch_item_rule_loo.translated_description %]
725                             [% END %]
726                         </td>
727                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
728                                 From any library
729                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
730                                 From home library
731                             [% ELSE %]
732                                 No holds allowed
733                             [% END %]
734                         </td>
735                         <td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
736                                 any library
737                             [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
738                                 item's home library
739                             [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
740                                 item's holding library
741                             [% END %]
742                         </td>
743                         <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
744                                 Item returns home
745                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
746                                 Item returns to issuing branch
747                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
748                                 Item floats
749                             [% ELSE %]
750                                 Error - unknown option
751                             [% END %]
752                         </td>
753                         <td class="actions">
754                             <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>
755                         </td>
756                     </tr>
757                 [% END %]
758                 <tr>
759                     <td>
760                         <select name="itemtype">
761                         [% FOREACH itemtypeloo IN itemtypeloop %]
762                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
763                         [% END %]
764                         </select>
765                     </td>
766                     <td>
767                         <select name="holdallowed">
768                             <option value="2">From any library</option>
769                             <option value="1">From home library</option>
770                             <option value="0">No holds allowed</option>
771                         </select>
772                     </td>
773                     <td>
774                         <select name="hold_fulfillment_policy">
775                             <option value="any">
776                                 any library
777                             </option>
778
779                             <option value="homebranch">
780                                 item's home library
781                             </option>
782
783                             <option value="holdingbranch">
784                                 item's holding library
785                             </option>
786                         </select>
787                     </td>
788                     <td>
789                         <select name="returnbranch">
790                             <option value="homebranch">Item returns home</option>
791                             <option value="holdingbranch">Item returns to issuing library</option>
792                             <option value="noreturn">Item floats</option>
793                         </select>
794                     </td>
795                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
796                 </tr>
797             </table>
798         </form>
799     </div>
800 </div>
801
802 </div>
803 <div class="yui-b">
804 [% INCLUDE 'admin-menu.inc' %]
805 </div>
806 </div>
807 [% INCLUDE 'intranet-bottom.inc' %]