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