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