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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
37 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
40 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
43 <a href="#" aria-current="page">
44 Circulation and fine rules
50 <div class="main container-fluid">
52 <div class="col-sm-10 col-sm-push-2">
55 <h1 class="parameters">
57 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
59 Defining circulation and fine rules for all libraries
63 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
65 <li>same library, same patron category, same item type</li>
66 <li>same library, same patron category, all item types</li>
67 <li>same library, all patron categories, same item type</li>
68 <li>same library, all patron categories, all item types</li>
69 <li>default (all libraries), same patron category, same item type</li>
70 <li>default (all libraries), same patron category, all item types</li>
71 <li>default (all libraries), all patron categories, same item type</li>
72 <li>default (all libraries), all patron categories, all item types</li>
75 <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
76 current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
77 or the specific rule's type, whichever is less.</p>
78 <p>To modify a rule, create a new one with the same patron category and item type.</p>
81 [% UNLESS restricted_to_own_library %]
82 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
84 <select name="branch" id="branch" style="width:20em;">
85 <option value="*">Standard rules for all libraries</option>
86 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
89 [% IF ( definedbranch ) %]
90 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
91 <label for="tobranch"><strong>Clone these rules to:</strong></label>
92 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
93 <select name="tobranch" id="tobranch">
94 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
96 <input type="submit" id="clone_rules" value="Clone" />
101 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
102 <input type="hidden" name="op" value="add" />
103 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
104 <table id="default-circulation-rules">
108 <th class="fixed_sort">Patron category</th>
110 <th class="fixed_sort">Item type</th>
111 <th class="noExport">Actions</th>
113 <th>Current checkouts allowed</th>
114 <th>Current on-site checkouts allowed</th>
118 <th>Hard due date</th>
119 <th>Decreased loan period for high holds (day)</th>
121 <th>Fine charging interval</th>
122 <th>When to charge</th>
123 <th>Fine grace period</th>
124 <th>Overdue fines cap (amount)</th>
125 <th>Cap fine at replacement price</th>
126 <th>Suspension in days (day)</th>
127 <th>Max. suspension duration (day)</th>
128 <th>Suspension charging interval</th>
129 <th>Renewals allowed (count)</th>
130 [% IF Koha.Preference('UnseenRenewals') %]
131 <th>Unseen renewals allowed (count)</th>
133 <th>Renewal period</th>
134 <th>No renewal before</th>
135 <th>Automatic renewal</th>
136 <th>No automatic renewal after</th>
137 <th>No automatic renewal after (hard limit)</th>
138 <th>Holds allowed (total)</th>
139 <th>Holds allowed (daily)</th>
140 <th>Holds per record (count)</th>
141 <th>On shelf holds allowed</th>
142 <th>OPAC item level holds</th>
143 <th>Article requests</th>
144 <th>Rental discount (%)</th>
145 <th class="noExport">Actions</th>
149 [% SET row_count = 0 %]
150 [% FOREACH c IN categorycodes %]
151 [% SET c = '' UNLESS c.defined %]
152 [% FOREACH i IN itemtypes %]
153 [% SET i = '' UNLESS i.defined %]
154 [% SET note = all_rules.$c.$i.note %]
155 [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
156 [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
157 [% SET issuelength = all_rules.$c.$i.issuelength %]
158 [% SET daysmode = all_rules.$c.$i.daysmode %]
159 [% SET lengthunit = all_rules.$c.$i.lengthunit %]
160 [% SET hardduedate = all_rules.$c.$i.hardduedate %]
161 [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
162 [% SET fine = all_rules.$c.$i.fine %]
163 [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
164 [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
165 [% SET firstremind = all_rules.$c.$i.firstremind %]
166 [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
167 [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
168 [% SET finedays = all_rules.$c.$i.finedays %]
169 [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
170 [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
171 [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
172 [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
173 [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
174 [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
175 [% SET auto_renew = all_rules.$c.$i.auto_renew %]
176 [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
177 [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
178 [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
179 [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
180 [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
181 [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
182 [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
183 [% SET article_requests = all_rules.$c.$i.article_requests %]
184 [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
185 [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
187 [% 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 %]
189 [% SET row_count = row_count + 1 %]
190 <tr row_countd="row_[% row_count | html %]">
191 <td>[% IF ( c == undef ) %]1[% ELSE %]0[% END %]</td>
196 [% Categories.GetName(c) | html %]
199 <td>[% IF ( i == undef ) %]1[% ELSE %]0[% END %]</td>
204 [% ItemTypes.GetDescription(i,1) | html %]
208 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
209 <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>
212 [% IF note.defined && note != '' %]
213 <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
214 [% ELSE %]<span> </span>[% END %]
217 [% IF maxissueqty.defined && maxissueqty != '' %]
218 [% maxissueqty | html %]
220 <span>Unlimited</span>
224 [% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
225 [% maxonsiteissueqty | html %]
227 <span>Unlimited</span>
230 <td>[% issuelength | html %]</td>
232 [% SWITCH daysmode %]
233 [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
234 [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
235 [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
236 [% 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>
237 [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
241 [% IF ( lengthunit == 'days' ) %]
243 [% ELSIF ( lengthunit == 'hours') %]
250 [% IF ( hardduedate ) %]
251 [% IF ( hardduedatecompare == '-1' ) %]
252 before [% hardduedate | $KohaDates %]
253 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
254 [% ELSIF ( hardduedatecompare == '0' ) %]
255 on [% hardduedate | $KohaDates %]
256 <input type="hidden" name="hardduedatecomparebackup" value="0" />
257 [% ELSIF ( hardduedatecompare == '1' ) %]
258 after [% hardduedate | $KohaDates %]
259 <input type="hidden" name="hardduedatecomparebackup" value="1" />
262 <span>None defined</span>
265 <td>[% decreaseloanholds | html %]</td>
266 <td>[% fine | html %]</td>
267 <td>[% chargeperiod | html %]</td>
268 <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
269 <td>[% firstremind | html %]</td>
270 <td>[% overduefinescap FILTER format("%.2f") %]</td>
272 [% IF cap_fine_to_replacement_price %]
273 <input type="checkbox" checked="checked" disabled="disabled" />
275 <input type="checkbox" disabled="disabled" />
278 <td>[% finedays | html %]</td>
279 <td>[% maxsuspensiondays | html %]</td>
280 <td>[% suspension_chargeperiod | html %]</td>
281 <td>[% renewalsallowed | html %]</td>
282 [% IF Koha.Preference('UnseenRenewals') %]
283 <td>[% unseenrenewalsallowed | html %]</td>
285 <td>[% renewalperiod | html %]</td>
286 <td>[% norenewalbefore | html %]</td>
294 <td>[% no_auto_renewal_after | html %]</td>
295 <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
297 [% IF reservesallowed.defined && reservesallowed != '' %]
298 [% reservesallowed | html %]
300 <span>Unlimited</span>
304 [% IF holds_per_day.defined && holds_per_day != '' %]
305 [% holds_per_day | html %]
307 <span>Unlimited</span>
311 [% IF holds_per_record.defined && holds_per_record != '' %]
312 [% holds_per_record | html %]
314 <span>Unlimited</span>
318 [% IF onshelfholds == 1 %]
320 [% ELSIF onshelfholds == 2 %]
321 <span>If all unavailable</span>
323 <span>If any unavailable</span>
327 [% IF opacitemholds == 'F'%]
329 [% ELSIF opacitemholds == 'Y'%]
332 <span>Don't allow</span>
336 [% IF article_requests == 'no' %]
338 [% ELSIF article_requests == 'yes' %]
340 [% ELSIF article_requests == 'bib_only' %]
341 <span>Record only</span>
342 [% ELSIF article_requests == 'item_only' %]
343 <span>Item only</span>
346 <td>[% rentaldiscount | html %]</td>
348 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
349 <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>
358 <select name="categorycode" id="categorycode">
359 <option value="*">All</option>
360 [% FOREACH patron_category IN patron_categories%]
361 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
367 <select name="itemtype" id="matrixitemtype" style="width:13em;">
368 <option value="*">All</option>
369 [% FOREACH itemtypeloo IN itemtypeloop %]
370 [% NEXT IF itemtypeloo.parent_type %]
371 [% SET children = itemtypeloo.children_with_localization %]
373 <optgroup label="[% itemtypeloo.translated_description | html %]">
374 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
375 [% FOREACH child IN children %]
376 <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
380 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
386 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
387 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
388 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
390 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
391 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
392 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
393 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
395 <select name="daysmode" id="daysmode">
396 <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
397 <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
398 <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
399 <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
400 <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>
404 <select name="lengthunit" id="lengthunit">
405 <option value="days" selected="selected">Days</option>
406 <option value="hours">Hours</option>
410 <select name="hardduedatecompare" id="hardduedatecompare">
411 <option value="-1">Before</option>
412 <option value="0">Exactly on</option>
413 <option value="1">After</option>
415 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
416 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
418 <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
419 <td><input type="text" name="fine" id="fine" size="4" /></td>
420 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
422 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
423 <option value="0">End of interval</option>
424 <option value="1">Start of interval</option>
427 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
428 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
429 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
430 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
431 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
432 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
433 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
434 [% IF Koha.Preference('UnseenRenewals') %]
435 <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
437 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
438 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
440 <select name="auto_renew" id="auto_renew">
441 <option value="no" selected>No</option>
442 <option value="yes">Yes</option>
445 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
447 <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"/>
448 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
450 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
451 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
452 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
454 <select name="onshelfholds" id="onshelfholds">
455 <option value="1">Yes</option>
456 <option value="0">If any unavailable</option>
457 <option value="2">If all unavailable</option>
461 <select id="opacitemholds" name="opacitemholds">
462 <option value="N">Don't allow</option>
463 <option value="Y">Allow</option>
464 <option value="F">Force</option>
468 <select id="article_requests" name="article_requests">
469 <option value="no">No</option>
470 <option value="yes">Yes</option>
471 <option value="bib_only">Record only</option>
472 <option value="item_only">Item only</option>
475 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
477 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
478 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
479 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
485 <th>Patron category</th>
490 <th>Current checkouts allowed</th>
491 <th>Current on-site checkouts allowed</th>
495 <th>Hard due date</th>
496 <th>Decreased loan period for high holds (day)</th>
498 <th>Fine charging interval</th>
499 <th>Charge when?</th>
500 <th>Fine grace period</th>
501 <th>Overdue fines cap (amount)</th>
502 <th>Cap fine at replacement price</th>
503 <th>Suspension in days (day)</th>
504 <th>Max. suspension duration (day)</th>
505 <th>Suspension charging interval</th>
506 <th>Renewals allowed (count)</th>
507 [% IF Koha.Preference('UnseenRenewals') %]
508 <th>Unseen renewals allowed (count)</th>
510 <th>Renewal period</th>
511 <th>No renewal before</th>
512 <th>Automatic renewal</th>
513 <th>No automatic renewal after</th>
514 <th>No automatic renewal after (hard limit)</th>
515 <th>Holds allowed (total)</th>
516 <th>Holds allowed (daily)</th>
517 <th>Holds per record (count)</th>
518 <th>On shelf holds allowed</th>
519 <th>OPAC item level holds</th>
520 <th>Article requests</th>
521 <th>Rental discount (%)</th>
529 <div id="defaults-for-this-library" class="container">
530 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
531 <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>
532 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
533 <input type="hidden" name="op" value="set-branch-defaults" />
534 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
538 <th>Total current checkouts allowed</th>
539 <th>Total current on-site checkouts allowed</th>
540 <th>Maximum total holds allowed (count)</th>
542 <th>Hold pickup library match</th>
543 <th>Return policy</th>
544 <th class="noExport">Actions</th>
547 <td><em>Defaults</em></td>
549 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
550 <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
553 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
554 <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
557 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
558 <input name="max_holds" size="3" value="[% rule_value | html %]" />
561 <select name="holdallowed">
562 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
567 [% IF holdallowed == 2 %]
568 <option value="2" selected="selected">
575 [% IF holdallowed == 3 %]
576 <option value="3" selected="selected">
580 From local hold group
583 [% IF holdallowed == 1 %]
584 <option value="1" selected="selected">
591 [% IF holdallowed == 0 %]
592 <option value="0" selected="selected">
601 <select name="hold_fulfillment_policy">
602 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
608 [% IF hold_fulfillment_policy == 'any' %]
609 <option value="any" selected="selected">
618 [% IF hold_fulfillment_policy == 'holdgroup' %]
619 <option value="holdgroup" selected="selected">
623 <option value="holdgroup">
628 [% IF hold_fulfillment_policy == 'patrongroup' %]
629 <option value="patrongroup" selected="selected">
633 <option value="patrongroup">
638 [% IF hold_fulfillment_policy == 'homebranch' %]
639 <option value="homebranch" selected="selected">
643 <option value="homebranch">
648 [% IF hold_fulfillment_policy == 'holdingbranch' %]
649 <option value="holdingbranch" selected="selected">
650 item's holding library
653 <option value="holdingbranch">
654 item's holding library
660 <select name="returnbranch">
661 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
667 [% IF returnbranch == 'homebranch' %]
668 <option value="homebranch" selected="selected">
670 <option value="homebranch">
674 [% IF returnbranch == 'holdingbranch' %]
675 <option value="holdingbranch" selected="selected">
677 <option value="holdingbranch">
679 Item returns to issuing library
681 [% IF returnbranch == 'noreturn' %]
682 <option value="noreturn" selected="selected">
684 <option value="noreturn">
691 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
692 <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>
698 [% IF ( show_branch_cat_rule_form ) %]
699 <div id="holds-policy-by-patron-category" class="container">
700 <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
701 <p>For this library, you can specify the maximum number of loans that
702 a patron of a given category can make, regardless of the item type.
704 <p>If the total amount loanable for a given patron category is left blank,
705 no limit applies, except possibly for a limit you define for a specific item type.
707 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
708 <input type="hidden" name="op" value="add-branch-cat" />
709 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
712 <th>Patron category</th>
713 <th>Total current checkouts allowed</th>
714 <th>Total current on-site checkouts allowed</th>
715 <th>Total holds allowed</th>
718 [% FOREACH c IN categorycodes %]
720 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
721 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
722 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
724 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
730 [% Categories.GetName(c) | html %]
734 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
735 [% patron_maxissueqty | html %]
737 <span>Unlimited</span>
741 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
742 [% patron_maxonsiteissueqty | html %]
744 <span>Unlimited</span>
748 [% IF max_holds.defined && max_holds != '' %]
749 [% max_holds | html %]
751 <span>Unlimited</span>
756 <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>
763 <select name="categorycode">
764 [% FOREACH patron_category IN patron_categories%]
765 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
769 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
770 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
771 <td><input name="max_holds" size="3" type="text" /></td>
772 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
779 <div id="refund-lost-item-fee-on-return" class="container">
780 [% IF current_branch == '*' %]
781 <h3>Default lost item fee refund on return policy</h3>
783 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
785 <p>Specify the default policy for lost item fees on return.
787 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
788 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
789 <input type="hidden" name="branch" value="[% current_branch | html %]" />
792 <th>Refund lost item fee</th>
797 <select name="lostreturn">
798 [%# Default branch %]
799 [% IF ( current_branch == '*' ) %]
800 [% IF ( defaultRefundRule == 'refund' ) %]
801 <option value="refund" selected="selected">Refund lost item charge</option>
802 <option value="charge">Refund lost item charge and charge new overdue fine</option>
803 <option value="restore">Refund lost item charge and restore overdue fine</option>
804 <option value="0">Leave lost item charge</option>
805 [% ELSIF ( defaultRefundRule == 'charge' ) %]
806 <option value="refund">Refund lost item charge</option>
807 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
808 <option value="restore">Refund lost item charge and restore overdue fine</option>
809 <option value="0">Leave lost item charge</option>
810 [% ELSIF ( defaultRefundRule == 'restore' ) %]
811 <option value="refund">Refund lost item charge</option>
812 <option value="charge">Refund lost item charge and charge new overdue fine</option>
813 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
814 <option value="0">Leave lost item charge</option>
815 [% ELSIF ( defaultRefundRule == 0 ) %]
816 <option value="refund">Refund lost item charge</option>
817 <option value="charge">Refund lost item charge and charge new overdue fine</option>
818 <option value="restore">Refund lost item charge and restore overdue fine</option>
819 <option value="0" selected="selected">Leave lost item charge</option>
821 <option value="refund">Refund lost item charge</option>
822 <option value="charge">Refund lost item charge and charge new overdue fine</option>
823 <option value="restore">Refund lost item charge and restore overdue fine</option>
824 <option value="0">Leave lost item charge</option>
827 [%# Branch-specific %]
828 [% IF ( not refundLostItemFeeRule ) %]
829 <option value="*" selected="selected">
833 [% IF defaultRefundRule == 'refund' %]
834 Use default (Refund lost item charge)
835 [% ELSIF defaultRefundRule == 'charge' %]
836 Use default (Refund lost item charge and restore overdue fine)
837 [% ELSIF defaultRefundRule == 'restore' %]
838 Use default (Refund lost item charge and charge new overdue fine)
840 Use default (Leave lost item charge)
843 [% IF ( not refundLostItemFeeRule ) %]
844 <option value="refund">Refund lost item charge</option>
845 <option value="charge">Refund lost item charge and charge new overdue fine</option>
846 <option value="restore">Refund lost item charge and restore overdue fine</option>
847 <option value="0">Leave lost item charge</option>
849 [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
850 <option value="refund" selected="selected">Refund lost item charge</option>
851 <option value="charge">Refund lost item charge and charge new overdue fine</option>
852 <option value="restore">Refund lost item charge and restore overdue fine</option>
853 <option value="0">Leave lost item charge</option>
854 [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
855 <option value="refund">Refund lost item charge</option>
856 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
857 <option value="restore">Refund lost item charge and restore overdue fine</option>
858 <option value="0">Leave lost item charge</option>
859 [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
860 <option value="refund">Refund lost item charge</option>
861 <option value="charge">Refund lost item charge and charge new overdue fine</option>
862 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
863 <option value="0">Leave lost item charge</option>
864 [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
865 <option value="refund">Refund lost item charge</option>
866 <option value="charge">Refund lost item charge and charge new overdue fine</option>
867 <option value="restore">Refund lost item charge and restore overdue fine</option>
868 <option value="0" selected="selected">Leave lost item charge</option>
875 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
883 <div id="holds-policy-by-item-type" class="container">
884 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
886 For this library, you can edit rules for given itemtypes, regardless
887 of the patron's category.
890 Currently, this means hold policies.
891 The various policies have the following effects:
894 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
895 <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>
896 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
897 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
899 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
900 <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>.
903 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
904 <input type="hidden" name="op" value="add-branch-item" />
905 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
910 <th>Hold pickup library match</th>
911 <th>Return policy</th>
914 [% FOREACH i IN itemtypeloop %]
915 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
916 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
917 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
919 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
922 [% i.translated_description | html %]
925 [% IF holdallowed == 2 %]
926 <span>From any library</span>
927 [% ELSIF holdallowed == 3 %]
928 <span>From local hold group</span>
929 [% ELSIF holdallowed == 1 %]
930 <span>From home library</span>
932 <span>No holds allowed</span>
936 [% IF hold_fulfillment_policy == 'any' %]
937 <span>any library</span>
938 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
939 <span>item's home library</span>
940 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
941 <span>item's hold group</span>
942 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
943 <span>patron's hold group</span>
944 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
945 <span>item's holding library</span>
949 [% IF returnbranch == 'homebranch' %]
950 <span>Item returns home</span>
951 [% ELSIF returnbranch == 'holdingbranch' %]
952 <span>Item returns to issuing branch</span>
953 [% ELSIF returnbranch == 'noreturn' %]
954 <span>Item floats</span>
958 <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>
965 <select name="itemtype">
966 [% FOREACH itemtypeloo IN itemtypeloop %]
967 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
972 <select name="holdallowed">
973 <option value="2">From any library</option>
974 <option value="3">From local hold group</option>
975 <option value="1">From home library</option>
976 <option value="0">No holds allowed</option>
980 <select name="hold_fulfillment_policy">
985 <option value="holdgroup">
989 <option value="patrongroup">
993 <option value="homebranch">
997 <option value="holdingbranch">
998 item's holding library
1003 <select name="returnbranch">
1004 <option value="homebranch">Item returns home</option>
1005 <option value="holdingbranch">Item returns to issuing library</option>
1006 <option value="noreturn">Item floats</option>
1009 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1015 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1017 <div class="col-sm-2 col-sm-pull-10">
1019 [% INCLUDE 'admin-menu.inc' %]
1021 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1022 </div> <!-- /.row -->
1024 [% MACRO jsinclude BLOCK %]
1025 [% Asset.js("js/admin-menu.js") | $raw %]
1026 [% INCLUDE 'datatables.inc' %]
1027 [% INCLUDE 'calendar.inc' %]
1029 $(document).ready(function() {
1030 $("#default-circulation-rules").dataTable($.extend(true,{},dataTablesDefaults, {
1032 { "bVisible": false, "aTargets": [ 0,2 ] },
1033 { "bSortable": false, "aTargets": ["_all"] }
1035 "aaSortingFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
1041 function clear_edit(){
1042 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
1043 if ( !cancel ) return;
1044 $('#default-circulation-rules td').removeClass('highlighted-row');
1045 var edit_row = $("#edit_row");
1046 $(edit_row).find("input").each(function(){
1047 var type = $(this).attr("type");
1048 if (type != "button" && type != "submit" ) {
1050 $(this).prop('disabled', false);
1052 if ( type == "checkbox" ) {
1053 $(this).prop('checked', false);
1056 $(edit_row).find("select").prop('disabled', false);
1057 $(edit_row).find("select option:first-child").attr("selected", "selected");
1058 $(edit_row).find("td:last input[name='clear']").remove();
1061 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1063 $(document).ready(function() {
1064 $('[data-toggle="popover"]').popover();
1066 $(".delete").on("click",function(){
1067 return confirmDelete(MSG_CONFIRM_DELETE);
1070 $("#clone_rules").on("click",function(){
1071 var library_dropdown = document.getElementById("branch");
1072 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
1073 var selected_library_text = $("#branch option:selected").text();
1074 var to_library = $("#tobranch option:selected").text();
1075 var MSG_CONFIRM_CLONE;
1076 if (selected_library === "*") {
1077 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);
1078 return confirmClone(MSG_CONFIRM_CLONE);
1080 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);
1081 return confirmClone(MSG_CONFIRM_CLONE);
1085 $('#selectlibrary').find("input:submit").hide();
1086 $('#branch').change(function() {
1087 $('#selectlibrary').submit();
1089 $(".editrule").click(function(){
1090 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
1091 var edit = confirm(_("Are you sure you want to edit another rule?"));
1092 if (!edit) return false;
1094 $('#default-circulation-rules td').removeClass('highlighted-row');
1095 $(this).parent().parent().find("td").each(function (i) {
1096 $(this).addClass('highlighted-row');
1097 itm = $(this).text();
1098 itm = itm.replace(/^\s*|\s*$/g,'');
1099 var current_column = $("#edit_row td:eq("+i+")");
1101 // specific processing for the Note column
1102 var note = $(this).find("a[name='viewnote']").data("content");
1103 $(current_column).find("input[type='text']").val(note);
1104 } else if ( i == 9 ) {
1105 // specific processing for the Hard due date column
1106 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1107 var input_value = '';
1108 if (typeof select_value === 'undefined'){
1109 select_value = '-1';
1111 input_value = itm.split(' ')[1];
1113 $(current_column).find("input[type='text']").val(input_value);
1114 $(current_column).find("select").val(select_value);
1115 } else if ( i == 15 ) {
1116 // specific processing for cap_fine_to_replacement_price
1117 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1118 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1119 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1121 $(current_column).find("input[type='text']").val(itm);
1122 // select the corresponding option
1123 $(current_column).find("select option").each(function(){
1124 opt = $(this).text().toLowerCase();
1125 itm = itm.replace(/.*->(.*)/,"$1"); //If item type is part of a group we need to clear the parent description
1126 opt = opt.replace(/^\s*|\s*$/g,'');
1127 if ( opt == itm.toLowerCase() ) {
1128 $(this).attr('selected', 'selected');
1131 if ( i == 0 || i == 1 ) {
1132 // Disable the 2 first columns, we cannot update them.
1133 var val = $(current_column).find("select option:selected").val();
1134 var name = "categorycode";
1138 // Remove potential previous input added
1139 $(current_column).find("input").remove();
1140 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1141 } else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 ) {
1142 // If the value is not an integer for
1143 // - "Current checkouts allowed"
1144 // - "Current on-site checkouts allowed"
1145 // - "Holds allowed (total)"
1146 // - "Holds allowed (daily)"
1147 // - "Holds per record (count)"
1148 // The value is "Unlimited" (or an equivalent translated string)
1149 // an it should be set to an empty string
1150 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
1151 $(current_column).find("input[type='text']").val("");
1156 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1157 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1160 $(".clear_edit").on("click",function(e){
1167 [% INCLUDE 'intranet-bottom.inc' %]