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>
61 <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
62 current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
63 or the specific rule's type, whichever is less.</p>
64 <p>To modify a rule, create a new one with the same patron category and item type.</p>
67 [% UNLESS restricted_to_own_library %]
68 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
70 <select name="branch" id="branch" style="width:20em;">
71 <option value="*">Standard rules for all libraries</option>
72 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
75 [% IF ( definedbranch ) %]
76 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
77 <label for="tobranch"><strong>Clone these rules to:</strong></label>
78 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
79 <select name="tobranch" id="tobranch">
80 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
82 <input type="submit" id="clone_rules" value="Clone" />
87 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
88 <input type="hidden" name="op" value="add" />
89 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
90 <table id="default-circulation-rules">
94 <th class="fixed_sort">Patron category</th>
96 <th class="fixed_sort">Item type</th>
97 <th class="noExport">Actions</th>
99 <th>Current checkouts allowed</th>
100 <th>Current on-site checkouts allowed</th>
104 <th>Hard due date</th>
105 <th>Decreased loan period for high holds (day)</th>
107 <th>Fine charging interval</th>
108 <th>When to charge</th>
109 <th>Fine grace period</th>
110 <th>Overdue fines cap (amount)</th>
111 <th>Cap fine at replacement price</th>
112 <th>Suspension in days (day)</th>
113 <th>Max. suspension duration (day)</th>
114 <th>Suspension charging interval</th>
115 <th>Renewals allowed (count)</th>
116 [% IF Koha.Preference('UnseenRenewals') %]
117 <th>Unseen renewals allowed (count)</th>
119 <th>Renewal period</th>
120 <th>No renewal before</th>
121 <th>Automatic renewal</th>
122 <th>No automatic renewal after</th>
123 <th>No automatic renewal after (hard limit)</th>
124 <th>Holds allowed (total)</th>
125 <th>Holds allowed (daily)</th>
126 <th>Holds per record (count)</th>
127 <th>On shelf holds allowed</th>
128 <th>OPAC item level holds</th>
129 <th>Article requests</th>
130 <th>Rental discount (%)</th>
131 <th class="noExport">Actions</th>
135 [% SET row_count = 0 %]
136 [% FOREACH c IN categorycodes %]
137 [% SET c = '' UNLESS c.defined %]
138 [% FOREACH i IN itemtypes %]
139 [% SET i = '' UNLESS i.defined %]
140 [% SET note = all_rules.$c.$i.note %]
141 [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
142 [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
143 [% SET issuelength = all_rules.$c.$i.issuelength %]
144 [% SET daysmode = all_rules.$c.$i.daysmode %]
145 [% SET lengthunit = all_rules.$c.$i.lengthunit %]
146 [% SET hardduedate = all_rules.$c.$i.hardduedate %]
147 [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
148 [% SET fine = all_rules.$c.$i.fine %]
149 [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
150 [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
151 [% SET firstremind = all_rules.$c.$i.firstremind %]
152 [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
153 [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
154 [% SET finedays = all_rules.$c.$i.finedays %]
155 [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
156 [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
157 [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
158 [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
159 [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
160 [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
161 [% SET auto_renew = all_rules.$c.$i.auto_renew %]
162 [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
163 [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
164 [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
165 [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
166 [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
167 [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
168 [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
169 [% SET article_requests = all_rules.$c.$i.article_requests %]
170 [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
171 [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
173 [% SET show_rule = note || maxissueqty || maxonsiteissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || unseenrenewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount || decreaseloanholds %]
175 [% SET row_count = row_count + 1 %]
176 <tr row_countd="row_[% row_count | html %]">
177 <td>[% IF ( c == undef ) %]1[% ELSE %]0[% END %]</td>
182 [% Categories.GetName(c) | html %]
185 <td>[% IF ( i == undef ) %]1[% ELSE %]0[% END %]</td>
190 [% ItemTypes.GetDescription(i,1) | html %]
194 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
195 <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>
198 [% IF note.defined && note != '' %]
199 <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
200 [% ELSE %]<span> </span>[% END %]
203 [% IF maxissueqty.defined && maxissueqty != '' %]
204 [% maxissueqty | html %]
206 <span>Unlimited</span>
210 [% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
211 [% maxonsiteissueqty | html %]
213 <span>Unlimited</span>
216 <td>[% issuelength | html %]</td>
218 [% SWITCH daysmode %]
219 [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
220 [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
221 [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
222 [% CASE 'Dayweek' %]<span title="Use the calendar to push the due date to the next open matching weekday for weekly loan periods, or the next open day otherwise">Same week day</span>
223 [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
227 [% IF ( lengthunit == 'days' ) %]
229 [% ELSIF ( lengthunit == 'hours') %]
236 [% IF ( hardduedate ) %]
237 [% IF ( hardduedatecompare == '-1' ) %]
238 before [% hardduedate | $KohaDates %]
239 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
240 [% ELSIF ( hardduedatecompare == '0' ) %]
241 on [% hardduedate | $KohaDates %]
242 <input type="hidden" name="hardduedatecomparebackup" value="0" />
243 [% ELSIF ( hardduedatecompare == '1' ) %]
244 after [% hardduedate | $KohaDates %]
245 <input type="hidden" name="hardduedatecomparebackup" value="1" />
248 <span>None defined</span>
251 <td>[% decreaseloanholds | html %]</td>
252 <td>[% fine | html %]</td>
253 <td>[% chargeperiod | html %]</td>
254 <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
255 <td>[% firstremind | html %]</td>
256 <td>[% overduefinescap FILTER format("%.2f") %]</td>
258 [% IF cap_fine_to_replacement_price %]
259 <input type="checkbox" checked="checked" disabled="disabled" />
261 <input type="checkbox" disabled="disabled" />
264 <td>[% finedays | html %]</td>
265 <td>[% maxsuspensiondays | html %]</td>
266 <td>[% suspension_chargeperiod | html %]</td>
267 <td>[% renewalsallowed | html %]</td>
268 [% IF Koha.Preference('UnseenRenewals') %]
269 <td>[% unseenrenewalsallowed | html %]</td>
271 <td>[% renewalperiod | html %]</td>
272 <td>[% norenewalbefore | html %]</td>
280 <td>[% no_auto_renewal_after | html %]</td>
281 <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
283 [% IF reservesallowed.defined && reservesallowed != '' %]
284 [% reservesallowed | html %]
286 <span>Unlimited</span>
290 [% IF holds_per_day.defined && holds_per_day != '' %]
291 [% holds_per_day | html %]
293 <span>Unlimited</span>
297 [% IF holds_per_record.defined && holds_per_record != '' %]
298 [% holds_per_record | html %]
300 <span>Unlimited</span>
304 [% IF onshelfholds == 1 %]
306 [% ELSIF onshelfholds == 2 %]
307 <span>If all unavailable</span>
309 <span>If any unavailable</span>
313 [% IF opacitemholds == 'F'%]
315 [% ELSIF opacitemholds == 'Y'%]
318 <span>Don't allow</span>
322 [% IF article_requests == 'no' %]
324 [% ELSIF article_requests == 'yes' %]
326 [% ELSIF article_requests == 'bib_only' %]
327 <span>Record only</span>
328 [% ELSIF article_requests == 'item_only' %]
329 <span>Item only</span>
332 <td>[% rentaldiscount | html %]</td>
334 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
335 <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>
344 <select name="categorycode" id="categorycode">
345 <option value="*">All</option>
346 [% FOREACH patron_category IN patron_categories%]
347 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
353 <select name="itemtype" id="matrixitemtype" style="width:13em;">
354 <option value="*">All</option>
355 [% FOREACH itemtypeloo IN itemtypeloop %]
356 [% NEXT IF itemtypeloo.parent_type %]
357 [% SET children = itemtypeloo.children_with_localization %]
359 <optgroup label="[% itemtypeloo.translated_description | html %]">
360 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
361 [% FOREACH child IN children %]
362 <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
366 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
372 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
373 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
374 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
376 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
377 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
378 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
379 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
381 <select name="daysmode" id="daysmode">
382 <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
383 <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
384 <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
385 <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
386 <option value="Dayweek" title="Use the calendar to push the due date to the next open matching weekday for weekly loan periods, or the next open day otherwise">Same week day</option>
390 <select name="lengthunit" id="lengthunit">
391 <option value="days" selected="selected">Days</option>
392 <option value="hours">Hours</option>
396 <select name="hardduedatecompare" id="hardduedatecompare">
397 <option value="-1">Before</option>
398 <option value="0">Exactly on</option>
399 <option value="1">After</option>
401 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
402 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
404 <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
405 <td><input type="text" name="fine" id="fine" size="4" /></td>
406 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
408 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
409 <option value="0">End of interval</option>
410 <option value="1">Start of interval</option>
413 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
414 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
415 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
416 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
417 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
418 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
419 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
420 [% IF Koha.Preference('UnseenRenewals') %]
421 <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
423 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
424 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
426 <select name="auto_renew" id="auto_renew">
427 <option value="no" selected>No</option>
428 <option value="yes">Yes</option>
431 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
433 <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"/>
434 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
436 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
437 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
438 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
440 <select name="onshelfholds" id="onshelfholds">
441 <option value="1">Yes</option>
442 <option value="0">If any unavailable</option>
443 <option value="2">If all unavailable</option>
447 <select id="opacitemholds" name="opacitemholds">
448 <option value="N">Don't allow</option>
449 <option value="Y">Allow</option>
450 <option value="F">Force</option>
454 <select id="article_requests" name="article_requests">
455 <option value="no">No</option>
456 <option value="yes">Yes</option>
457 <option value="bib_only">Record only</option>
458 <option value="item_only">Item only</option>
461 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
463 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
464 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
465 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
471 <th>Patron category</th>
476 <th>Current checkouts allowed</th>
477 <th>Current on-site checkouts allowed</th>
481 <th>Hard due date</th>
482 <th>Decreased loan period for high holds (day)</th>
484 <th>Fine charging interval</th>
485 <th>Charge when?</th>
486 <th>Fine grace period</th>
487 <th>Overdue fines cap (amount)</th>
488 <th>Cap fine at replacement price</th>
489 <th>Suspension in days (day)</th>
490 <th>Max. suspension duration (day)</th>
491 <th>Suspension charging interval</th>
492 <th>Renewals allowed (count)</th>
493 [% IF Koha.Preference('UnseenRenewals') %]
494 <th>Unseen renewals allowed (count)</th>
496 <th>Renewal period</th>
497 <th>No renewal before</th>
498 <th>Automatic renewal</th>
499 <th>No automatic renewal after</th>
500 <th>No automatic renewal after (hard limit)</th>
501 <th>Holds allowed (total)</th>
502 <th>Holds allowed (daily)</th>
503 <th>Holds per record (count)</th>
504 <th>On shelf holds allowed</th>
505 <th>OPAC item level holds</th>
506 <th>Article requests</th>
507 <th>Rental discount (%)</th>
515 <div id="defaults-for-this-library" class="container">
516 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
517 <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>
518 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
519 <input type="hidden" name="op" value="set-branch-defaults" />
520 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
524 <th>Total current checkouts allowed</th>
525 <th>Total current on-site checkouts allowed</th>
526 <th>Maximum total holds allowed (count)</th>
528 <th>Hold pickup library match</th>
529 <th>Return policy</th>
530 <th class="noExport">Actions</th>
533 <td><em>Defaults</em></td>
535 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
536 <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
539 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
540 <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
543 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
544 <input name="max_holds" size="3" value="[% rule_value | html %]" />
547 <select name="holdallowed">
548 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
553 [% IF holdallowed == 2 %]
554 <option value="2" selected="selected">
561 [% IF holdallowed == 3 %]
562 <option value="3" selected="selected">
566 From local hold group
569 [% IF holdallowed == 1 %]
570 <option value="1" selected="selected">
577 [% IF holdallowed == 0 %]
578 <option value="0" selected="selected">
587 <select name="hold_fulfillment_policy">
588 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
594 [% IF hold_fulfillment_policy == 'any' %]
595 <option value="any" selected="selected">
604 [% IF hold_fulfillment_policy == 'holdgroup' %]
605 <option value="holdgroup" selected="selected">
609 <option value="holdgroup">
614 [% IF hold_fulfillment_policy == 'patrongroup' %]
615 <option value="patrongroup" selected="selected">
619 <option value="patrongroup">
624 [% IF hold_fulfillment_policy == 'homebranch' %]
625 <option value="homebranch" selected="selected">
629 <option value="homebranch">
634 [% IF hold_fulfillment_policy == 'holdingbranch' %]
635 <option value="holdingbranch" selected="selected">
636 item's holding library
639 <option value="holdingbranch">
640 item's holding library
646 <select name="returnbranch">
647 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
653 [% IF returnbranch == 'homebranch' %]
654 <option value="homebranch" selected="selected">
656 <option value="homebranch">
660 [% IF returnbranch == 'holdingbranch' %]
661 <option value="holdingbranch" selected="selected">
663 <option value="holdingbranch">
665 Item returns to issuing library
667 [% IF returnbranch == 'noreturn' %]
668 <option value="noreturn" selected="selected">
670 <option value="noreturn">
677 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
678 <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>
684 [% IF ( show_branch_cat_rule_form ) %]
685 <div id="holds-policy-by-patron-category" class="container">
686 <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
687 <p>For this library, you can specify the maximum number of loans that
688 a patron of a given category can make, regardless of the item type.
690 <p>If the total amount loanable for a given patron category is left blank,
691 no limit applies, except possibly for a limit you define for a specific item type.
693 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
694 <input type="hidden" name="op" value="add-branch-cat" />
695 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
698 <th>Patron category</th>
699 <th>Total current checkouts allowed</th>
700 <th>Total current on-site checkouts allowed</th>
701 <th>Total holds allowed</th>
704 [% FOREACH c IN categorycodes %]
706 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
707 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
708 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
710 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
716 [% Categories.GetName(c) | html %]
720 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
721 [% patron_maxissueqty | html %]
723 <span>Unlimited</span>
727 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
728 [% patron_maxonsiteissueqty | html %]
730 <span>Unlimited</span>
734 [% IF max_holds.defined && max_holds != '' %]
735 [% max_holds | html %]
737 <span>Unlimited</span>
742 <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>
749 <select name="categorycode">
750 [% FOREACH patron_category IN patron_categories%]
751 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
755 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
756 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
757 <td><input name="max_holds" size="3" type="text" /></td>
758 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
765 <div id="refund-lost-item-fee-on-return" class="container">
766 [% IF current_branch == '*' %]
767 <h3>Default lost item fee refund on return policy</h3>
769 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
771 <p>Specify the default policy for lost item fees on return.
773 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
774 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
775 <input type="hidden" name="branch" value="[% current_branch | html %]" />
778 <th>Refund lost item fee</th>
783 <select name="lostreturn">
784 [%# Default branch %]
785 [% IF ( current_branch == '*' ) %]
786 [% IF ( defaultRefundRule == 'refund' ) %]
787 <option value="refund" selected="selected">Refund lost item charge</option>
788 <option value="charge">Refund lost item charge and charge new overdue fine</option>
789 <option value="restore">Refund lost item charge and restore overdue fine</option>
790 <option value="0">Leave lost item charge</option>
791 [% ELSIF ( defaultRefundRule == 'charge' ) %]
792 <option value="refund">Refund lost item charge</option>
793 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
794 <option value="restore">Refund lost item charge and restore overdue fine</option>
795 <option value="0">Leave lost item charge</option>
796 [% ELSIF ( defaultRefundRule == 'restore' ) %]
797 <option value="refund">Refund lost item charge</option>
798 <option value="charge">Refund lost item charge and charge new overdue fine</option>
799 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
800 <option value="0">Leave lost item charge</option>
801 [% ELSIF ( defaultRefundRule == 0 ) %]
802 <option value="refund">Refund lost item charge</option>
803 <option value="charge">Refund lost item charge and charge new overdue fine</option>
804 <option value="restore">Refund lost item charge and restore overdue fine</option>
805 <option value="0" selected="selected">Leave lost item charge</option>
807 <option value="refund">Refund lost item charge</option>
808 <option value="charge">Refund lost item charge and charge new overdue fine</option>
809 <option value="restore">Refund lost item charge and restore overdue fine</option>
810 <option value="0">Leave lost item charge</option>
813 [%# Branch-specific %]
814 [% IF ( not refundLostItemFeeRule ) %]
815 <option value="*" selected="selected">
819 [% IF defaultRefundRule == 'refund' %]
820 Use default (Refund lost item charge)
821 [% ELSIF defaultRefundRule == 'charge' %]
822 Use default (Refund lost item charge and restore overdue fine)
823 [% ELSIF defaultRefundRule == 'restore' %]
824 Use default (Refund lost item charge and charge new overdue fine)
826 Use default (Leave lost item charge)
829 [% IF ( not refundLostItemFeeRule ) %]
830 <option value="refund">Refund lost item charge</option>
831 <option value="charge">Refund lost item charge and charge new overdue fine</option>
832 <option value="restore">Refund lost item charge and restore overdue fine</option>
833 <option value="0">Leave lost item charge</option>
835 [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
836 <option value="refund" selected="selected">Refund lost item charge</option>
837 <option value="charge">Refund lost item charge and charge new overdue fine</option>
838 <option value="restore">Refund lost item charge and restore overdue fine</option>
839 <option value="0">Leave lost item charge</option>
840 [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
841 <option value="refund">Refund lost item charge</option>
842 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
843 <option value="restore">Refund lost item charge and restore overdue fine</option>
844 <option value="0">Leave lost item charge</option>
845 [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
846 <option value="refund">Refund lost item charge</option>
847 <option value="charge">Refund lost item charge and charge new overdue fine</option>
848 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
849 <option value="0">Leave lost item charge</option>
850 [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
851 <option value="refund">Refund lost item charge</option>
852 <option value="charge">Refund lost item charge and charge new overdue fine</option>
853 <option value="restore">Refund lost item charge and restore overdue fine</option>
854 <option value="0" selected="selected">Leave lost item charge</option>
861 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
869 <div id="holds-policy-by-item-type" class="container">
870 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
872 For this library, you can edit rules for given itemtypes, regardless
873 of the patron's category.
876 Currently, this means hold policies.
877 The various policies have the following effects:
880 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
881 <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>
882 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
883 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
885 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
886 <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>.
889 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
890 <input type="hidden" name="op" value="add-branch-item" />
891 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
896 <th>Hold pickup library match</th>
897 <th>Return policy</th>
900 [% FOREACH i IN itemtypeloop %]
901 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
902 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
903 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
905 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
908 [% i.translated_description | html %]
911 [% IF holdallowed == 2 %]
912 <span>From any library</span>
913 [% ELSIF holdallowed == 3 %]
914 <span>From local hold group</span>
915 [% ELSIF holdallowed == 1 %]
916 <span>From home library</span>
918 <span>No holds allowed</span>
922 [% IF hold_fulfillment_policy == 'any' %]
923 <span>any library</span>
924 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
925 <span>item's home library</span>
926 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
927 <span>item's hold group</span>
928 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
929 <span>patron's hold group</span>
930 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
931 <span>item's holding library</span>
935 [% IF returnbranch == 'homebranch' %]
936 <span>Item returns home</span>
937 [% ELSIF returnbranch == 'holdingbranch' %]
938 <span>Item returns to issuing branch</span>
939 [% ELSIF returnbranch == 'noreturn' %]
940 <span>Item floats</span>
944 <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>
951 <select name="itemtype">
952 [% FOREACH itemtypeloo IN itemtypeloop %]
953 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
958 <select name="holdallowed">
959 <option value="2">From any library</option>
960 <option value="3">From local hold group</option>
961 <option value="1">From home library</option>
962 <option value="0">No holds allowed</option>
966 <select name="hold_fulfillment_policy">
971 <option value="holdgroup">
975 <option value="patrongroup">
979 <option value="homebranch">
983 <option value="holdingbranch">
984 item's holding library
989 <select name="returnbranch">
990 <option value="homebranch">Item returns home</option>
991 <option value="holdingbranch">Item returns to issuing library</option>
992 <option value="noreturn">Item floats</option>
995 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1001 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1003 <div class="col-sm-2 col-sm-pull-10">
1005 [% INCLUDE 'admin-menu.inc' %]
1007 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1008 </div> <!-- /.row -->
1010 [% MACRO jsinclude BLOCK %]
1011 [% Asset.js("js/admin-menu.js") | $raw %]
1012 [% INCLUDE 'datatables.inc' %]
1013 [% INCLUDE 'calendar.inc' %]
1015 $(document).ready(function() {
1016 $("#default-circulation-rules").dataTable($.extend(true,{},dataTablesDefaults, {
1018 { "bVisible": false, "aTargets": [ 0,2 ] },
1019 { "bSortable": false, "aTargets": ["_all"] }
1021 "aaSortingFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
1027 function clear_edit(){
1028 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
1029 if ( !cancel ) return;
1030 $('#default-circulation-rules td').removeClass('highlighted-row');
1031 var edit_row = $("#edit_row");
1032 $(edit_row).find("input").each(function(){
1033 var type = $(this).attr("type");
1034 if (type != "button" && type != "submit" ) {
1036 $(this).prop('disabled', false);
1038 if ( type == "checkbox" ) {
1039 $(this).prop('checked', false);
1042 $(edit_row).find("select").prop('disabled', false);
1043 $(edit_row).find("select option:first-child").attr("selected", "selected");
1044 $(edit_row).find("td:last input[name='clear']").remove();
1047 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1049 $(document).ready(function() {
1050 $('[data-toggle="popover"]').popover();
1052 $(".delete").on("click",function(){
1053 return confirmDelete(MSG_CONFIRM_DELETE);
1056 $("#clone_rules").on("click",function(){
1057 var library_dropdown = document.getElementById("branch");
1058 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
1059 var selected_library_text = $("#branch option:selected").text();
1060 var to_library = $("#tobranch option:selected").text();
1061 var MSG_CONFIRM_CLONE;
1062 if (selected_library === "*") {
1063 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);
1064 return confirmClone(MSG_CONFIRM_CLONE);
1066 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);
1067 return confirmClone(MSG_CONFIRM_CLONE);
1071 $('#selectlibrary').find("input:submit").hide();
1072 $('#branch').change(function() {
1073 $('#selectlibrary').submit();
1075 $(".editrule").click(function(){
1076 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
1077 var edit = confirm(_("Are you sure you want to edit another rule?"));
1078 if (!edit) return false;
1080 $('#default-circulation-rules td').removeClass('highlighted-row');
1081 $(this).parent().parent().find("td").each(function (i) {
1082 $(this).addClass('highlighted-row');
1083 itm = $(this).text();
1084 itm = itm.replace(/^\s*|\s*$/g,'');
1085 var current_column = $("#edit_row td:eq("+i+")");
1087 // specific processing for the Note column
1088 var note = $(this).find("a[name='viewnote']").data("content");
1089 $(current_column).find("input[type='text']").val(note);
1090 } else if ( i == 9 ) {
1091 // specific processing for the Hard due date column
1092 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1093 var input_value = '';
1094 if (typeof select_value === 'undefined'){
1095 select_value = '-1';
1097 input_value = itm.split(' ')[1];
1099 $(current_column).find("input[type='text']").val(input_value);
1100 $(current_column).find("select").val(select_value);
1101 } else if ( i == 15 ) {
1102 // specific processing for cap_fine_to_replacement_price
1103 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1104 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1105 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1107 $(current_column).find("input[type='text']").val(itm);
1108 // select the corresponding option
1109 $(current_column).find("select option").each(function(){
1110 opt = $(this).text().toLowerCase();
1111 itm = itm.replace(/.*->(.*)/,"$1"); //If item type is part of a group we need to clear the parent description
1112 opt = opt.replace(/^\s*|\s*$/g,'');
1113 if ( opt == itm.toLowerCase() ) {
1114 $(this).attr('selected', 'selected');
1117 if ( i == 0 || i == 1 ) {
1118 // Disable the 2 first columns, we cannot update them.
1119 var val = $(current_column).find("select option:selected").val();
1120 var name = "categorycode";
1124 // Remove potential previous input added
1125 $(current_column).find("input").remove();
1126 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1127 } else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 ) {
1128 // If the value is not an integer for
1129 // - "Current checkouts allowed"
1130 // - "Current on-site checkouts allowed"
1131 // - "Holds allowed (total)"
1132 // - "Holds allowed (daily)"
1133 // - "Holds per record (count)"
1134 // The value is "Unlimited" (or an equivalent translated string)
1135 // an it should be set to an empty string
1136 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
1137 $(current_column).find("input[type='text']").val("");
1142 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1143 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1146 $(".clear_edit").on("click",function(e){
1153 [% INCLUDE 'intranet-bottom.inc' %]