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