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