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