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