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