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