8 [% USE CirculationRules %]
11 [% SET branchcode = humanbranch || undef %]
13 [% SET categorycodes = [] %]
14 [% FOREACH pc IN patron_categories %]
15 [% categorycodes.push( pc.id ) %]
17 [% categorycodes.push(undef) %]
19 [% SET itemtypes = [] %]
20 [% FOREACH i IN itemtypeloop %]
21 [% itemtypes.push( i.itemtype ) %]
23 [% itemtypes.push(undef) %]
25 [% INCLUDE 'doc-head-open.inc' %]
26 <title>Koha › Administration › Circulation and fine rules</title>
27 [% INCLUDE 'doc-head-close.inc' %]
30 <body id="admin_smart-rules" class="admin">
31 [% INCLUDE 'header.inc' %]
32 [% INCLUDE 'prefs-admin-search.inc' %]
34 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Circulation and fine rules</div>
36 <div class="main container-fluid">
38 <div class="col-sm-10 col-sm-push-2">
41 <h1 class="parameters">
43 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
45 Defining circulation and fine rules for all libraries
49 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
51 <li>same library, same patron category, same item type</li>
52 <li>same library, same patron category, all item types</li>
53 <li>same library, all patron categories, same item type</li>
54 <li>same library, all patron categories, all item types</li>
55 <li>default (all libraries), same patron category, same item type</li>
56 <li>default (all libraries), same patron category, all item types</li>
57 <li>default (all libraries), all patron categories, same item type</li>
58 <li>default (all libraries), all patron categories, all item types</li>
60 <p>To modify a rule, create a new one with the same patron category and item type.</p>
63 [% UNLESS restricted_to_own_library %]
64 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
66 <select name="branch" id="branch" style="width:20em;">
67 <option value="*">Standard rules for all libraries</option>
68 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
71 [% IF ( definedbranch ) %]
72 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
73 <label for="tobranch"><strong>Clone these rules to:</strong></label>
74 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
75 <select name="tobranch" id="tobranch">
76 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
78 <input type="submit" id="clone_rules" value="Clone" />
83 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
84 <input type="hidden" name="op" value="add" />
85 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
86 <table id="default-circulation-rules">
89 <th>Patron category</th>
93 <th>Current checkouts allowed</th>
94 <th>Current on-site checkouts allowed</th>
97 <th>Hard due date</th>
99 <th>Fine charging interval</th>
100 <th>When to charge</th>
101 <th>Fine grace period</th>
102 <th>Overdue fines cap (amount)</th>
103 <th>Cap fine at replacement price</th>
104 <th>Suspension in days (day)</th>
105 <th>Max. suspension duration (day)</th>
106 <th>Suspension charging interval</th>
107 <th>Renewals allowed (count)</th>
108 <th>Renewal period</th>
109 <th>No renewal before</th>
110 <th>Automatic renewal</th>
111 <th>No automatic renewal after</th>
112 <th>No automatic renewal after (hard limit)</th>
113 <th>Holds allowed (total)</th>
114 <th>Holds allowed (daily)</th>
115 <th>Holds per record (count)</th>
116 <th>On shelf holds allowed</th>
117 <th>OPAC item level holds</th>
118 <th>Article requests</th>
119 <th>Rental discount (%)</th>
124 [% SET row_count = 0 %]
125 [% FOREACH c IN categorycodes %]
126 [% SET c = '' UNLESS c.defined %]
127 [% FOREACH i IN itemtypes %]
128 [% SET i = '' UNLESS i.defined %]
129 [% SET note = all_rules.$c.$i.note %]
130 [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
131 [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
132 [% SET issuelength = all_rules.$c.$i.issuelength %]
133 [% SET lengthunit = all_rules.$c.$i.lengthunit %]
134 [% SET hardduedate = all_rules.$c.$i.hardduedate %]
135 [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
136 [% SET fine = all_rules.$c.$i.fine %]
137 [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
138 [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
139 [% SET firstremind = all_rules.$c.$i.firstremind %]
140 [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
141 [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
142 [% SET finedays = all_rules.$c.$i.finedays %]
143 [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
144 [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
145 [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
146 [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
147 [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
148 [% SET auto_renew = all_rules.$c.$i.auto_renew %]
149 [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
150 [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
151 [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
152 [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
153 [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
154 [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
155 [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
156 [% SET article_requests = all_rules.$c.$i.article_requests %]
157 [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
159 [% SET show_rule = maxissueqty || maxonsiteissueqty || issuelength || lengthunit || hardduedate || hardduedatebefore || hardduedateexact || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalsallowed || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || article_requests %]
161 [% SET row_count = row_count + 1 %]
162 <tr row_countd="row_[% row_count | html %]">
167 [% Categories.GetName(c) | html %]
174 [% ItemTypes.GetDescription(i) | html %]
178 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
179 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% i || '*' | html %]&categorycode=[% c || '*' | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
182 [% IF note.defined && note != '' %]
183 <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
184 [% ELSE %]<span> </span>[% END %]
187 [% IF maxissueqty.defined && maxissueqty != '' %]
188 [% maxissueqty | html %]
190 <span>Unlimited</span>
194 [% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
195 [% maxonsiteissueqty | html %]
197 <span>Unlimited</span>
200 <td>[% issuelength | html %]</td>
202 [% IF ( lengthunit == 'days' ) %]
204 [% ELSIF ( lengthunit == 'hours') %]
211 [% IF ( hardduedate ) %]
212 [% IF ( hardduedatecompare == '-1' ) %]
213 before [% hardduedate | $KohaDates %]
214 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
215 [% ELSIF ( hardduedatecompare == '0' ) %]
216 on [% hardduedate | $KohaDates %]
217 <input type="hidden" name="hardduedatecomparebackup" value="0" />
218 [% ELSIF ( hardduedatecompare == '1' ) %]
219 after [% hardduedate | $KohaDates %]
220 <input type="hidden" name="hardduedatecomparebackup" value="1" />
223 <span>None defined</span>
226 <td>[% fine | html %]</td>
227 <td>[% chargeperiod | html %]</td>
228 <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
229 <td>[% firstremind | html %]</td>
230 <td>[% overduefinescap FILTER format("%.2f") %]</td>
232 [% IF cap_fine_to_replacement_price %]
233 <input type="checkbox" checked="checked" disabled="disabled" />
235 <input type="checkbox" disabled="disabled" />
238 <td>[% finedays | html %]</td>
239 <td>[% maxsuspensiondays | html %]</td>
240 <td>[% suspension_chargeperiod | html %]</td>
241 <td>[% renewalsallowed | html %]</td>
242 <td>[% renewalperiod | html %]</td>
243 <td>[% norenewalbefore | html %]</td>
251 <td>[% no_auto_renewal_after | html %]</td>
252 <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
254 [% IF reservesallowed.defined && reservesallowed != '' %]
255 [% reservesallowed | html %]
257 <span>Unlimited</span>
261 [% IF holds_per_day.defined && holds_per_day != '' %]
262 [% holds_per_day | html %]
264 <span>Unlimited</span>
268 [% IF holds_per_record.defined && holds_per_record != '' %]
269 [% holds_per_record | html %]
271 <span>Unlimited</span>
275 [% IF onshelfholds == 1 %]
277 [% ELSIF onshelfholds == 2 %]
278 <span>If all unavailable</span>
280 <span>If any unavailable</span>
284 [% IF opacitemholds == 'F'%]
286 [% ELSIF opacitemholds == 'Y'%]
289 <span>Don't allow</span>
293 [% IF article_requests == 'no' %]
295 [% ELSIF article_requests == 'yes' %]
297 [% ELSIF article_requests == 'bib_only' %]
298 <span>Record only</span>
299 [% ELSIF article_requests == 'item_only' %]
300 <span>Item only</span>
303 <td>[% rentaldiscount | html %]</td>
305 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
306 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% i || '*' | uri %]&categorycode=[% c || '*' | uri %]&branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
314 <select name="categorycode" id="categorycode">
315 <option value="*">All</option>
316 [% FOREACH patron_category IN patron_categories%]
317 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
322 <select name="itemtype" id="matrixitemtype" style="width:13em;">
323 <option value="*">All</option>
324 [% FOREACH itemtypeloo IN itemtypeloop %]
325 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
330 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
331 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
332 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
334 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
335 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
336 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
337 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
339 <select name="lengthunit" id="lengthunit">
340 <option value="days" selected="selected">Days</option>
341 <option value="hours">Hours</option>
345 <select name="hardduedatecompare" id="hardduedatecompare">
346 <option value="-1">Before</option>
347 <option value="0">Exactly on</option>
348 <option value="1">After</option>
350 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
351 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
353 <td><input type="text" name="fine" id="fine" size="4" /></td>
354 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
356 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
357 <option value="0">End of interval</option>
358 <option value="1">Start of interval</option>
361 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
362 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
363 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
364 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
365 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
366 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
367 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
368 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
369 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
371 <select name="auto_renew" id="auto_renew">
372 <option value="no" selected>No</option>
373 <option value="yes">Yes</option>
376 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
378 <input type="text" size="10" name="no_auto_renewal_after_hard_limit" id="no_auto_renewal_after_hard_limit" value="[% no_auto_renewal_after_hard_limit | html %]" class="datepicker"/>
379 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
381 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
382 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
383 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
385 <select name="onshelfholds" id="onshelfholds">
386 <option value="1">Yes</option>
387 <option value="0">If any unavailable</option>
388 <option value="2">If all unavailable</option>
392 <select id="opacitemholds" name="opacitemholds">
393 <option value="N">Don't allow</option>
394 <option value="Y">Allow</option>
395 <option value="F">Force</option>
399 <select id="article_requests" name="article_requests">
400 <option value="no">No</option>
401 <option value="yes">Yes</option>
402 <option value="bib_only">Record only</option>
403 <option value="item_only">Item only</option>
406 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
408 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
409 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
410 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
415 <th>Patron category</th>
419 <th>Current checkouts allowed</th>
420 <th>Current on-site checkouts allowed</th>
423 <th>Hard due date</th>
425 <th>Fine charging interval</th>
426 <th>Charge when?</th>
427 <th>Fine grace period</th>
428 <th>Overdue fines cap (amount)</th>
429 <th>Cap fine at replacement price</th>
430 <th>Suspension in days (day)</th>
431 <th>Max. suspension duration (day)</th>
432 <th>Suspension charging interval</th>
433 <th>Renewals allowed (count)</th>
434 <th>Renewal period</th>
435 <th>No renewal before</th>
436 <th>Automatic renewal</th>
437 <th>No automatic renewal after</th>
438 <th>No automatic renewal after (hard limit)</th>
439 <th>Holds allowed (total)</th>
440 <th>Holds allowed (daily)</th>
441 <th>Holds per record (count)</th>
442 <th>On shelf holds allowed</th>
443 <th>OPAC item level holds</th>
444 <th>Article requests</th>
445 <th>Rental discount (%)</th>
453 <div id="defaults-for-this-library" class="container">
454 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
455 <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>
456 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
457 <input type="hidden" name="op" value="set-branch-defaults" />
458 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
462 <th>Total current checkouts allowed</th>
463 <th>Total current on-site checkouts allowed</th>
464 <th>Maximum total holds allowed (count)</th>
466 <th>Hold pickup library match</th>
467 <th>Return policy</th>
471 <td><em>Defaults</em></td>
473 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
474 <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
477 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
478 <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
481 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
482 <input name="max_holds" size="3" value="[% rule_value | html %]" />
485 <select name="holdallowed">
486 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
491 [% IF holdallowed == 2 %]
492 <option value="2" selected="selected">
499 [% IF holdallowed == 3 %]
500 <option value="3" selected="selected">
504 From local hold group
507 [% IF holdallowed == 1 %]
508 <option value="1" selected="selected">
515 [% IF holdallowed == 0 %]
516 <option value="0" selected="selected">
525 <select name="hold_fulfillment_policy">
526 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
532 [% IF hold_fulfillment_policy == 'any' %]
533 <option value="any" selected="selected">
542 [% IF hold_fulfillment_policy == 'holdgroup' %]
543 <option value="holdgroup" selected="selected">
547 <option value="holdgroup">
552 [% IF hold_fulfillment_policy == 'patrongroup' %]
553 <option value="patrongroup" selected="selected">
557 <option value="patrongroup">
562 [% IF hold_fulfillment_policy == 'homebranch' %]
563 <option value="homebranch" selected="selected">
567 <option value="homebranch">
572 [% IF hold_fulfillment_policy == 'holdingbranch' %]
573 <option value="holdingbranch" selected="selected">
574 item's holding library
577 <option value="holdingbranch">
578 item's holding library
584 <select name="returnbranch">
585 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
591 [% IF returnbranch == 'homebranch' %]
592 <option value="homebranch" selected="selected">
594 <option value="homebranch">
598 [% IF returnbranch == 'holdingbranch' %]
599 <option value="holdingbranch" selected="selected">
601 <option value="holdingbranch">
603 Item returns to issuing library
605 [% IF returnbranch == 'noreturn' %]
606 <option value="noreturn" selected="selected">
608 <option value="noreturn">
615 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
616 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=*&branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
622 [% IF ( show_branch_cat_rule_form ) %]
623 <div id="holds-policy-by-patron-category" class="container">
624 <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
625 <p>For this library, you can specify the maximum number of loans that
626 a patron of a given category can make, regardless of the item type.
628 <p>If the total amount loanable for a given patron category is left blank,
629 no limit applies, except possibly for a limit you define for a specific item type.
631 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
632 <input type="hidden" name="op" value="add-branch-cat" />
633 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
636 <th>Patron category</th>
637 <th>Total current checkouts allowed</th>
638 <th>Total current on-site checkouts allowed</th>
639 <th>Total holds allowed</th>
642 [% FOREACH c IN categorycodes %]
644 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
645 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
646 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
648 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
654 [% Categories.GetName(c) | html %]
658 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
659 [% patron_maxissueqty | html %]
661 <span>Unlimited</span>
665 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
666 [% patron_maxonsiteissueqty | html %]
668 <span>Unlimited</span>
672 [% IF max_holds.defined && max_holds != '' %]
673 [% max_holds | html %]
675 <span>Unlimited</span>
680 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
687 <select name="categorycode">
688 [% FOREACH patron_category IN patron_categories%]
689 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
693 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
694 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
695 <td><input name="max_holds" size="3" type="text" /></td>
696 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
703 <div id="refund-lost-item-fee-on-return" class="container">
704 [% IF current_branch == '*' %]
705 <h3>Default lost item fee refund on return policy</h3>
707 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
709 <p>Specify the default policy for lost item fees on return.
711 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
712 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
713 <input type="hidden" name="branch" value="[% current_branch | html %]" />
716 <th>Refund lost item fee</th>
721 <select name="refund">
722 [%# Default branch %]
723 [% IF ( current_branch == '*' ) %]
724 [% IF ( defaultRefundRule ) %]
725 <option value="1" selected="selected">
731 [% IF ( not defaultRefundRule ) %]
732 <option value="0" selected="selected">
739 [%# Branch-specific %]
740 [% IF ( not refundLostItemFeeRule ) %]
741 <option value="*" selected="selected">
745 [% IF defaultRefundRule %]
751 [% IF ( not refundLostItemFeeRule ) %]
752 <option value="1">Yes</option>
753 <option value="0">No</option>
755 [% IF ( refundLostItemFeeRule.rule_value ) %]
756 <option value="1" selected="selected">
762 [% IF ( not refundLostItemFeeRule.rule_value ) %]
763 <option value="0" selected="selected">
774 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
782 <div id="holds-policy-by-item-type" class="container">
783 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
785 For this library, you can edit rules for given itemtypes, regardless
786 of the patron's category.
789 Currently, this means hold policies.
790 The various policies have the following effects:
793 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
794 <li><strong>From local hold group:</strong> Only patrons from libraries in the same item's home library hold groups may put this book on hold.</li>
795 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
796 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
798 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
799 <strong>Important: </strong>The policies are applied based on the ReservesControlBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesControlBranch">[% Koha.Preference('ReservesControlBranch') | html %]</a>.
802 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
803 <input type="hidden" name="op" value="add-branch-item" />
804 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
809 <th>Hold pickup library match</th>
810 <th>Return policy</th>
813 [% FOREACH i IN itemtypeloop %]
814 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
815 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
816 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
818 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
821 [% i.translated_description | html %]
824 [% IF holdallowed == 2 %]
825 <span>From any library</span>
826 [% ELSIF holdallowed == 3 %]
827 <span>From local hold group</span>
828 [% ELSIF holdallowed == 1 %]
829 <span>From home library</span>
831 <span>No holds allowed</span>
835 [% IF hold_fulfillment_policy == 'any' %]
836 <span>any library</span>
837 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
838 <span>item's home library</span>
839 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
840 <span>item's hold group</span>
841 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
842 <span>patron's hold group</span>
843 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
844 <span>item's holding library</span>
848 [% IF returnbranch == 'homebranch' %]
849 <span>Item returns home</span>
850 [% ELSIF returnbranch == 'holdingbranch' %]
851 <span>Item returns to issuing branch</span>
852 [% ELSIF returnbranch == 'noreturn' %]
853 <span>Item floats</span>
857 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&itemtype=[% i.itemtype | uri %]&branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
864 <select name="itemtype">
865 [% FOREACH itemtypeloo IN itemtypeloop %]
866 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
871 <select name="holdallowed">
872 <option value="2">From any library</option>
873 <option value="3">From local hold group</option>
874 <option value="1">From home library</option>
875 <option value="0">No holds allowed</option>
879 <select name="hold_fulfillment_policy">
884 <option value="holdgroup">
888 <option value="patrongroup">
892 <option value="homebranch">
896 <option value="holdingbranch">
897 item's holding library
902 <select name="returnbranch">
903 <option value="homebranch">Item returns home</option>
904 <option value="holdingbranch">Item returns to issuing library</option>
905 <option value="noreturn">Item floats</option>
908 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
914 </div> <!-- /.col-sm-10.col-sm-push-2 -->
916 <div class="col-sm-2 col-sm-pull-10">
918 [% INCLUDE 'admin-menu.inc' %]
920 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
921 </div> <!-- /.row -->
923 [% MACRO jsinclude BLOCK %]
924 [% Asset.js("js/admin-menu.js") | $raw %]
925 [% INCLUDE 'calendar.inc' %]
928 function clear_edit(){
929 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
930 if ( !cancel ) return;
931 $('#default-circulation-rules td').removeClass('highlighted-row');
932 var edit_row = $("#edit_row");
933 $(edit_row).find("input").each(function(){
934 var type = $(this).attr("type");
935 if (type != "button" && type != "submit" ) {
937 $(this).prop('disabled', false);
939 if ( type == "checkbox" ) {
940 $(this).prop('checked', false);
943 $(edit_row).find("select").prop('disabled', false);
944 $(edit_row).find("select option:first").attr("selected", "selected");
945 $(edit_row).find("td:last input[name='clear']").remove();
948 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
950 $(document).ready(function() {
951 $('[data-toggle="popover"]').popover();
953 $(".delete").on("click",function(){
954 return confirmDelete(MSG_CONFIRM_DELETE);
957 $("#clone_rules").on("click",function(){
958 var library_dropdown = document.getElementById("branch");
959 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
960 var selected_library_text = $("#branch option:selected").text();
961 var to_library = $("#tobranch option:selected").text();
962 var MSG_CONFIRM_CLONE;
963 if (selected_library === "*") {
964 MSG_CONFIRM_CLONE = _("Are you sure you want to clone this standard rule to %s library? This will override the existing rules in this library.").format(to_library);
965 return confirmClone(MSG_CONFIRM_CLONE);
967 MSG_CONFIRM_CLONE = _("Are you sure you want to clone this circulation and fine rule from %s to %s library? This will override the existing rules in this library.").format(selected_library_text, to_library);
968 return confirmClone(MSG_CONFIRM_CLONE);
972 $('#selectlibrary').find("input:submit").hide();
973 $('#branch').change(function() {
974 $('#selectlibrary').submit();
976 $(".editrule").click(function(){
977 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
978 var edit = confirm(_("Are you sure you want to edit another rule?"));
979 if (!edit) return false;
981 $('#default-circulation-rules td').removeClass('highlighted-row');
982 $(this).parent().parent().find("td").each(function (i) {
983 $(this).addClass('highlighted-row');
984 itm = $(this).text();
985 itm = itm.replace(/^\s*|\s*$/g,'');
986 var current_column = $("#edit_row td:eq("+i+")");
988 // specific processing for the Note column
989 var note = $(this).find("a[name='viewnote']").data("content");
990 $(current_column).find("input[type='text']").val(note);
991 } else if ( i == 8 ) {
992 // specific processing for the Hard due date column
993 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
994 var input_value = '';
995 if (typeof select_value === 'undefined'){
998 input_value = itm.split(' ')[1];
1000 $(current_column).find("input[type='text']").val(input_value);
1001 $(current_column).find("select").val(select_value);
1002 } else if ( i == 14 ) {
1003 // specific processing for cap_fine_to_replacement_price
1004 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1005 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1006 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1008 $(current_column).find("input[type='text']").val(itm);
1009 // select the corresponding option
1010 $(current_column).find("select option").each(function(){
1011 opt = $(this).text().toLowerCase();
1012 opt = opt.replace(/^\s*|\s*$/g,'');
1013 if ( opt == itm.toLowerCase() ) {
1014 $(this).attr('selected', 'selected');
1017 if ( i == 0 || i == 1 ) {
1018 // Disable the 2 first columns, we cannot update them.
1019 var val = $(current_column).find("select option:selected").val();
1020 var name = "categorycode";
1024 // Remove potential previous input added
1025 $(current_column).find("input").remove();
1026 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1027 } else if ( i == 4 || i == 5 || i == 24 || i == 25 || i == 26 ) {
1028 // If the value is not an integer for
1029 // - "Current checkouts allowed"
1030 // - "Current on-site checkouts allowed"
1031 // - "Holds allowed (total)"
1032 // - "Holds allowed (daily)"
1033 // - "Holds per record (count)"
1034 // The value is "Unlimited" (or an equivalent translated string)
1035 // an it should be set to an empty string
1036 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
1037 $(current_column).find("input[type='text']").val("");
1042 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1043 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1046 $(".clear_edit").on("click",function(e){
1053 [% INCLUDE 'intranet-bottom.inc' %]