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