8 [% USE CirculationRules %]
10 [% PROCESS 'i18n.inc' %]
11 [% SET footerjs = 1 %]
13 [% SET branchcode = humanbranch || undef %]
15 [% SET categorycodes = [] %]
16 [% FOREACH pc IN patron_categories %]
17 [% categorycodes.push( pc.id ) %]
19 [% categorycodes.push(undef) %]
21 [% SET itemtypes = [] %]
22 [% FOREACH i IN itemtypeloop %]
23 [% itemtypes.push( i.itemtype ) %]
25 [% itemtypes.push(undef) %]
27 [% INCLUDE 'doc-head-open.inc' %]
28 <title>[% FILTER collapse %]
29 [% t("Circulation and fine rules") | html %] ›
30 [% t("Administration") | html %] ›
31 [% t("Koha") | html %]
33 [% INCLUDE 'doc-head-close.inc' %]
36 <body id="admin_smart-rules" class="admin">
37 [% WRAPPER 'header.inc' %]
38 [% INCLUDE 'prefs-admin-search.inc' %]
41 [% WRAPPER 'sub-header.inc' %]
42 [% WRAPPER breadcrumbs %]
43 [% WRAPPER breadcrumb_item %]
44 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
46 [% WRAPPER breadcrumb_item bc_active= 1 %]
47 <span>Circulation and fine rules</span>
49 [% END #/ WRAPPER breadcrumbs %]
50 [% END #/ WRAPPER sub-header.inc %]
52 <div class="main container-fluid">
54 <div class="col-sm-10 col-sm-push-2">
56 <h1 class="parameters">
58 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
60 Defining circulation and fine rules for all libraries
64 <div class="page-section bg-info">
65 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
67 <li>same library, same patron category, same item type</li>
68 <li>same library, same patron category, all item types</li>
69 <li>same library, all patron categories, same item type</li>
70 <li>same library, all patron categories, all item types</li>
71 <li>default (all libraries), same patron category, same item type</li>
72 <li>default (all libraries), same patron category, all item types</li>
73 <li>default (all libraries), all patron categories, same item type</li>
74 <li>default (all libraries), all patron categories, all item types</li>
77 <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
78 current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
79 or the specific rule's type, whichever is less.</p>
80 <p>To modify a rule, create a new one with the same patron category and item type.</p>
83 <div class="page-section">
84 [% UNLESS restricted_to_own_library %]
85 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
87 <select name="branch" id="branch" style="width:20em;">
88 <option value="*">Standard rules for all libraries</option>
89 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
92 [% IF ( definedbranch ) %]
93 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
94 <label for="tobranch"><strong>Clone these rules to:</strong></label>
95 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
96 <select name="tobranch" id="tobranch">
97 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
99 <input type="submit" id="clone_rules" class="btn btn-primary" value="Clone" />
105 <div class="page-section">
106 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
107 <input type="hidden" name="op" value="add" />
108 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
109 <table id="default-circulation-rules">
113 <th class="fixed_sort">Patron category</th>
115 <th class="fixed_sort">Item type</th>
116 <th class="noExport">Actions</th>
118 <th>Current checkouts allowed</th>
119 <th>Current on-site checkouts allowed</th>
123 <th>Hard due date</th>
124 <th>Decreased loan period for high holds (day)</th>
126 <th>Fine charging interval</th>
127 <th>When to charge</th>
128 <th>Fine/suspension grace period</th>
129 <th>Overdue fines cap (amount)</th>
130 <th>Cap fine at replacement price</th>
131 <th>Suspension in days (day)</th>
132 <th>Max. suspension duration (day)</th>
133 <th>Suspension charging interval</th>
134 <th>Renewals allowed (count)</th>
135 [% IF Koha.Preference('UnseenRenewals') %]
136 <th>Unseen renewals allowed (count)</th>
138 <th>Renewal period</th>
139 <th>No renewal before</th>
140 <th>No automatic renewal before</th>
141 <th>Automatic renewal</th>
142 <th>No automatic renewal after</th>
143 <th>No automatic renewal after (hard limit)</th>
144 <th>Holds allowed (total)</th>
145 <th>Holds allowed (daily)</th>
146 <th>Holds per record (count)</th>
147 <th>On shelf holds allowed</th>
148 <th>OPAC item level holds</th>
149 <th>Holds pickup period (day)</th>
150 [% IF Koha.Preference('ArticleRequests') %]
151 <th>Article requests</th>
153 <th>Rental discount (%)</th>
154 [% IF Koha.Preference('UseRecalls') %]
155 <th>Recalls allowed (total)</th>
156 <th>Recalls per record (count)</th>
157 <th>On shelf recalls allowed</th>
158 <th>Recall due date interval (day)</th>
159 <th>Recall overdue fine amount</th>
160 <th>Recall pickup period (day)</th>
162 <th class="noExport">Actions</th>
166 [% SET row_count = 0 %]
167 [% FOREACH c IN categorycodes %]
168 [% SET c = '' UNLESS c.defined %]
169 [% FOREACH i IN itemtypes %]
170 [% SET i = '' UNLESS i.defined %]
171 [% SET note = all_rules.$c.$i.note %]
172 [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
173 [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
174 [% SET issuelength = all_rules.$c.$i.issuelength %]
175 [% SET daysmode = all_rules.$c.$i.daysmode %]
176 [% SET lengthunit = all_rules.$c.$i.lengthunit %]
177 [% SET hardduedate = all_rules.$c.$i.hardduedate %]
178 [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
179 [% SET fine = all_rules.$c.$i.fine %]
180 [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
181 [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
182 [% SET firstremind = all_rules.$c.$i.firstremind %]
183 [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
184 [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
185 [% SET finedays = all_rules.$c.$i.finedays %]
186 [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
187 [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
188 [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
189 [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
190 [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
191 [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
192 [% SET noautorenewalbefore = all_rules.$c.$i.noautorenewalbefore %]
193 [% SET auto_renew = all_rules.$c.$i.auto_renew %]
194 [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
195 [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
196 [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
197 [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
198 [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
199 [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
200 [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
201 [% SET article_requests = all_rules.$c.$i.article_requests %]
202 [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
203 [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
204 [% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
205 [% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
206 [% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
207 [% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
208 [% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
209 [% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
210 [% SET holds_pickup_period = all_rules.$c.$i.holds_pickup_period %]
212 [% 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 || noautorenewalbefore || 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 || recalls_allowed || recalls_per_record || on_shelf_recalls || recall_due_date_interval || recall_overdue_fine || recall_shelf_time || holds_pickup_period %]
214 [% SET row_count = row_count + 1 %]
215 <tr row_countd="row_[% row_count | html %]">
216 <td>[% IF ( c == undef ) %]
221 <td data-code="[% c | html %]">
225 [% Categories.GetName(c) | html %]
228 <td>[% IF ( i == undef ) %]
233 <td data-code="[% i | html %]">
237 [% ItemTypes.GetDescription(i,1) | html %]
241 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
242 <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-can"></i> Delete</a>
245 [% IF note.defined && note != '' %]
246 <a id="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
247 [% ELSE %]<span> </span>[% END %]
250 [% IF maxissueqty.defined && maxissueqty != '' %]
251 [% maxissueqty | html %]
253 <span>Unlimited</span>
257 [% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
258 [% maxonsiteissueqty | html %]
260 <span>Unlimited</span>
263 <td>[% issuelength | html %]</td>
264 <td data-code="[% daysmode | html %]">
265 [% SWITCH daysmode %]
266 [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
267 [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
268 [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
269 [% 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>
270 [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
273 <td data-code="[% lengthunit | html %]">
274 [% IF ( lengthunit == 'days' ) %]
276 [% ELSIF ( lengthunit == 'hours') %]
279 <span>Undefined</span>
282 <td data-code="[% hardduedatecompare | html %]" data-duedate="[% hardduedate | $KohaDates %]">
283 [% IF ( hardduedate ) %]
284 [% IF ( hardduedatecompare == '-1' ) %]
285 before [% hardduedate | $KohaDates %]
286 [% ELSIF ( hardduedatecompare == '0' ) %]
287 on [% hardduedate | $KohaDates %]
288 [% ELSIF ( hardduedatecompare == '1' ) %]
289 after [% hardduedate | $KohaDates %]
292 <span>None defined</span>
295 <td>[% decreaseloanholds | html %]</td>
296 <td>[% fine | $Price %]</td>
297 <td>[% chargeperiod | html %]</td>
298 <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
299 <td>[% firstremind | html %]</td>
300 <td>[% IF overduefinescap %][% overduefinescap | $Price %][% ELSE %][% END %]</td>
302 [% IF cap_fine_to_replacement_price %]
303 <input type="checkbox" checked="checked" disabled="disabled" />
305 <input type="checkbox" disabled="disabled" />
308 <td>[% finedays | html %]</td>
309 <td>[% maxsuspensiondays | html %]</td>
310 <td>[% suspension_chargeperiod | html %]</td>
311 <td>[% renewalsallowed | html %]</td>
312 [% IF Koha.Preference('UnseenRenewals') %]
314 [% IF unseenrenewalsallowed.defined && unseenrenewalsallowed != '' %]
315 [% unseenrenewalsallowed | html %]
317 <span>Unlimited</span>
321 <td>[% renewalperiod | html %]</td>
322 <td>[% norenewalbefore | html %]</td>
323 <td>[% noautorenewalbefore | html %]</td>
324 <td data-code="[%- IF auto_renew -%]yes[%- ELSE -%]no[%- END -%]">
331 <td>[% no_auto_renewal_after | html %]</td>
332 <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
334 [% IF reservesallowed.defined && reservesallowed != '' %]
335 [% reservesallowed | html %]
337 <span>Unlimited</span>
341 [% IF holds_per_day.defined && holds_per_day != '' %]
342 [% holds_per_day | html %]
344 <span>Unlimited</span>
348 [% IF holds_per_record.defined && holds_per_record != '' %]
349 [% holds_per_record | html %]
351 <span>Unlimited</span>
354 <td data-code="[% onshelfholds | html %]">
355 [% IF onshelfholds == 1 %]
357 [% ELSIF onshelfholds == 2 %]
358 <span>If all unavailable</span>
360 <span>If any unavailable</span>
363 <td data-code="[% opacitemholds | html %]">
364 [% IF opacitemholds == 'F'%]
366 [% ELSIF opacitemholds == 'Y'%]
369 <span>Don't allow</span>
373 [% IF holds_pickup_period == '' %]
374 <span title="Will use ReservesMaxPickupDelay system preference value ([% Koha.Preference('ReservesMaxPickupDelay') | html %])">Default</span>
376 [% holds_pickup_period | html %]
379 [% IF Koha.Preference('ArticleRequests') %]
380 <td data-code="[% article_requests | html %]">
381 [% IF article_requests == 'no' %]
383 [% ELSIF article_requests == 'yes' %]
385 [% ELSIF article_requests == 'bib_only' %]
386 <span>Record only</span>
387 [% ELSIF article_requests == 'item_only' %]
388 <span>Item only</span>
392 <td>[% rentaldiscount | html %]</td>
393 [% IF Koha.Preference('UseRecalls') %]
394 <td>[% recalls_allowed | html %]</td>
395 <td>[% recalls_per_record | html %]</td>
396 <td data-code="[% on_shelf_recalls | html %]">
397 [% IF on_shelf_recalls == 'all' %]
398 <span>If all unavailable</span>
400 <span>If any unavailable</span>
403 <td>[% recall_due_date_interval | html %]</td>
404 <td>[% recall_overdue_fine | $Price %]</td>
405 <td>[% recall_shelf_time | html %]</td>
408 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
409 <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-can"></i> Delete</a>
415 <tr class="noExport" id="edit_row">
418 <select name="categorycode" id="categorycode">
419 <option value="*">All</option>
420 [% FOREACH patron_category IN patron_categories%]
421 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
427 <select name="itemtype" id="matrixitemtype" style="width:13em;">
428 <option value="*">All</option>
429 [% FOREACH itemtypeloo IN itemtypeloop %]
430 [% NEXT IF itemtypeloo.parent_type %]
431 [% SET children = itemtypeloo.children_with_localization %]
432 [% IF children.count %]
433 <optgroup label="[% itemtypeloo.translated_description | html %]">
434 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
435 [% FOREACH child IN children %]
436 <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
440 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
446 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
447 <button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button>
448 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
450 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
451 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
452 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
453 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
455 <select name="daysmode" id="daysmode">
456 <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
457 <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
458 <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
459 <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
460 <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>
464 <select name="lengthunit" id="lengthunit">
465 <option value="days" selected="selected">Days</option>
466 <option value="hours">Hours</option>
470 <select name="hardduedatecompare" id="hardduedatecompare">
471 <option value="-1">Before</option>
472 <option value="0">Exactly on</option>
473 <option value="1">After</option>
475 <input type="text" size="10" id="hardduedate" name="hardduedate" class="flatpickr" />
476 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
478 <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
479 <td><input type="text" name="fine" id="fine" size="4" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /></td>
480 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
482 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
483 <option value="0">End of interval</option>
484 <option value="1">Start of interval</option>
487 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
488 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /> </td>
489 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
490 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
491 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
492 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
493 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
494 [% IF Koha.Preference('UnseenRenewals') %]
495 <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
497 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
498 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
499 <td><input type="text" name="noautorenewalbefore" id="noautorenewalbefore" size="3" /></td>
501 <select name="auto_renew" id="auto_renew">
502 <option value="no" selected>No</option>
503 <option value="yes">Yes</option>
506 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
508 <input type="text" size="10" name="no_auto_renewal_after_hard_limit" id="no_auto_renewal_after_hard_limit" class="flatpickr"/>
509 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
511 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
512 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
513 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
515 <select name="onshelfholds" id="onshelfholds">
516 <option value="1">Yes</option>
517 <option value="0">If any unavailable</option>
518 <option value="2">If all unavailable</option>
522 <select id="opacitemholds" name="opacitemholds">
523 <option value="N">Don't allow</option>
524 <option value="Y">Allow</option>
525 <option value="F">Force</option>
528 <td><input type="text" name="holds_pickup_period" id="holds_pickup_period" size="2" /></td>
529 [% IF Koha.Preference('ArticleRequests') %]
531 <select id="article_requests" name="article_requests">
532 <option value="no">No</option>
533 <option value="yes">Yes</option>
534 <option value="bib_only">Record only</option>
535 <option value="item_only">Item only</option>
539 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
540 [% IF Koha.Preference('UseRecalls') %]
541 <td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
542 <td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
544 <select name="on_shelf_recalls" id="on_shelf_recalls">
545 <option value="any">If any unavailable</option>
546 <option value="all">If all unavailable</option>
549 <td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
550 <td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6" inputmode="decimal" pattern="^\d+(\.\d{2})?$"></td>
551 <td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
554 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
555 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
556 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
563 <th>Patron category</th>
568 <th>Current checkouts allowed</th>
569 <th>Current on-site checkouts allowed</th>
573 <th>Hard due date</th>
574 <th>Decreased loan period for high holds (day)</th>
576 <th>Fine charging interval</th>
577 <th>Charge when?</th>
578 <th>Fine/suspension grace period</th>
579 <th>Overdue fines cap (amount)</th>
580 <th>Cap fine at replacement price</th>
581 <th>Suspension in days (day)</th>
582 <th>Max. suspension duration (day)</th>
583 <th>Suspension charging interval</th>
584 <th>Renewals allowed (count)</th>
585 [% IF Koha.Preference('UnseenRenewals') %]
586 <th>Unseen renewals allowed (count)</th>
588 <th>Renewal period</th>
589 <th>No renewal before</th>
590 <th>No automatic renewal before</th>
591 <th>Automatic renewal</th>
592 <th>No automatic renewal after</th>
593 <th>No automatic renewal after (hard limit)</th>
594 <th>Holds allowed (total)</th>
595 <th>Holds allowed (daily)</th>
596 <th>Holds per record (count)</th>
597 <th>On shelf holds allowed</th>
598 <th>OPAC item level holds</th>
599 <th>Holds pickup period (day)</th>
600 [% IF Koha.Preference('ArticleRequests') %]
601 <th>Article requests</th>
603 <th>Rental discount (%)</th>
604 [% IF Koha.Preference('UseRecalls') %]
605 <th>Recalls allowed (total)</th>
606 <th>Recalls per record (count)</th>
607 <th>On shelf recalls allowed</th>
608 <th>Recall due date interval (day)</th>
609 <th>Recall overdue fine amount</th>
610 <th>Recall pickup period (day)</th>
617 </div><!-- ./page-section -->
619 <div id="defaults-for-this-library" class="page-section">
620 <h2>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h2>
621 <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>
622 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
623 <input type="hidden" name="op" value="set-branch-defaults" />
624 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
628 <th>Total current checkouts allowed</th>
629 <th>Total current on-site checkouts allowed</th>
630 <th>Maximum total holds allowed (count)</th>
632 <th>Hold pickup library match</th>
633 <th>Return policy</th>
634 <th class="noExport">Actions</th>
636 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
637 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', { want_rule => 1 } ) %]
638 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
639 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
640 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
641 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
642 [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
645 [% IF ( default_checkout_hold_and_return_policy ) %]
654 <input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
657 <input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
660 <input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
663 <select name="holdallowed">
668 [% IF holdallowed.rule_value == 'from_any_library' %]
669 <option value="from_any_library" selected="selected">
671 <option value="from_any_library">
676 [% IF holdallowed.rule_value == 'from_local_hold_group' %]
677 <option value="from_local_hold_group" selected="selected">
679 <option value="from_local_hold_group">
681 From local hold group
684 [% IF holdallowed.rule_value == 'from_home_library' %]
685 <option value="from_home_library" selected="selected">
687 <option value="from_home_library">
692 [% IF holdallowed.rule_value == 'not_allowed' %]
693 <option value="not_allowed" selected="selected">
695 <option value="not_allowed">
702 <select name="hold_fulfillment_policy">
708 [% IF hold_fulfillment_policy.rule_value == 'any' %]
709 <option value="any" selected="selected">
718 [% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
719 <option value="holdgroup" selected="selected">
723 <option value="holdgroup">
728 [% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
729 <option value="patrongroup" selected="selected">
733 <option value="patrongroup">
738 [% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
739 <option value="homebranch" selected="selected">
743 <option value="homebranch">
748 [% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
749 <option value="holdingbranch" selected="selected">
750 item's holding library
753 <option value="holdingbranch">
754 item's holding library
760 <select name="returnbranch">
766 [% IF returnbranch.rule_value == 'homebranch' %]
767 <option value="homebranch" selected="selected">
769 <option value="homebranch">
773 [% IF returnbranch.rule_value == 'holdingbranch' %]
774 <option value="holdingbranch" selected="selected">
776 <option value="holdingbranch">
778 Item returns to issuing library
780 [% IF returnbranch.rule_value == 'noreturn' %]
781 <option value="noreturn" selected="selected">
783 <option value="noreturn">
787 [% IF returnbranch.rule_value == 'returnbylibrarygroup' %]
788 <option value="returnbylibrarygroup" selected="selected">
790 <option value="returnbylibrarygroup">
792 Item floats by library group
797 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
798 [% IF ( default_checkout_hold_and_return_policy ) %]
799 <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>
807 [% IF ( show_branch_cat_rule_form ) %]
808 <div id="holds-policy-by-patron-category" class="page-section">
809 <h2>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h2>
810 <p>For this library, you can specify the maximum number of loans that
811 a patron of a given category can make, regardless of the item type.
813 <p>If the total amount loanable for a given patron category is left blank,
814 no limit applies, except possibly for a limit you define for a specific item type.
816 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
817 <input type="hidden" name="op" value="add-branch-cat" />
818 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
821 <th>Patron category</th>
822 <th>Total current checkouts allowed</th>
823 <th>Total current on-site checkouts allowed</th>
824 <th>Total holds allowed</th>
827 [% FOREACH c IN categorycodes %]
829 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
830 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
831 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
833 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
839 [% Categories.GetName(c) | html %]
843 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
844 [% patron_maxissueqty | html %]
846 <span>Unlimited</span>
850 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
851 [% patron_maxonsiteissueqty | html %]
853 <span>Unlimited</span>
857 [% IF max_holds.defined && max_holds != '' %]
858 [% max_holds | html %]
860 <span>Unlimited</span>
865 <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-can"></i> Delete</a>
872 <select name="categorycode">
873 [% FOREACH patron_category IN patron_categories%]
874 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
878 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
879 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
880 <td><input name="max_holds" size="3" type="text" /></td>
881 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
888 <div id="waiting-hold-cancel-category" class="page-section">
890 <h2>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h2>
892 <h2>Default waiting hold cancellation policy</h2>
894 <p>Specify if waiting holds can be cancelled for a given patron category.</p>
895 <form id="set-waiting-hold-cancellation" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
896 <input type="hidden" name="op" value="set-waiting-hold-cancellation" />
897 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
900 <th>Patron category</th>
902 <th>Cancellation allowed</th>
905 [% FOREACH c IN categorycodes %]
906 [% SET c = '*' UNLESS c.defined AND c != '' %]
907 [% FOREACH i IN itemtypes %]
908 [% SET i = '*' UNLESS i.defined AND i != '' %]
910 [% SET waiting_hold_cancellation = CirculationRules.Search( current_branch, c, i, 'waiting_hold_cancellation' ) %]
912 [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %]
918 [% Categories.GetName(c) | html %]
925 [% ItemTypes.GetDescription(i,1) | html %]
929 [% IF waiting_hold_cancellation %]
936 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-waiting-hold-cancellation&waiting_hold_cancellation_category=[% c | uri %]&waiting_hold_cancellation_itemtype=[% i | uri %]&branch=[% current_branch | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
944 <select name="waiting_hold_cancellation_category" id="waiting_hold_cancellation_category">
945 <option value="*">All</option>
946 [% FOREACH patron_category IN patron_categories %]
947 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
952 <select name="waiting_hold_cancellation_itemtype" id="waiting_hold_cancellation_itemtype">
953 <option value="*">All</option>
954 [% FOREACH itemtype IN itemtypeloop %]
955 <option value="[% itemtype.itemtype | html %]">[% ItemTypes.GetDescription(itemtype.itemtype) | html %]</option>
960 <select name="waiting_hold_cancellation_policy" id="waiting_hold_cancellation_policy">
961 <option value="0" selected>No</option>
962 <option value="1">Yes</option>
965 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
971 [% IF Koha.Preference('ArticleRequests') %]
972 <div id="open-article-requests-limit-patron-category" class="page-section">
974 <h2>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h2>
976 <h2>Default open article requests limit</h2>
978 <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
979 <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
980 <input type="hidden" name="op" value="add-open-article-requests-limit" />
981 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
984 <th>Patron category</th>
985 <th>Total article requests</th>
988 [% FOREACH c IN categorycodes %]
990 [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %]
992 [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %]
995 [% Categories.GetName(c) | html %]
998 [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %]
999 [% open_article_requests_limit | html %]
1001 <span>Unlimited</span>
1005 <td class="actions">
1006 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-open-article-requests-limit&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash-can"></i> Delete</a>
1013 <select name="categorycode">
1014 [% FOREACH patron_category IN patron_categories %]
1015 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1019 <td><input name="open_article_requests_limit" size="3" type="text" /></td>
1020 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1026 <div id="article-request-fee-category" class="page-section">
1027 [% IF humanbranch %]
1028 <h2>Article request fees for [% Branches.GetName( humanbranch ) | html %]</h2>
1030 <h2>Default article request fees</h2>
1032 <p>Specify the article request fee for a given patron category.</p>
1033 <form id="set-article-request-fee" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1034 <input type="hidden" name="op" value="set-article-request-fee" />
1035 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1038 <th>Patron category</th>
1042 [% FOREACH c IN categorycodes %]
1043 [% SET c = '*' UNLESS c.defined AND c != '' %]
1045 [% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %]
1047 [% IF ( article_request_fee.defined && article_request_fee != '' ) %]
1053 [% Categories.GetName(c) | html %]
1057 [% IF article_request_fee.defined && article_request_fee != '' %]
1058 [% article_request_fee | $Price %]
1063 <td class="actions">
1064 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-article-request-fee&article_request_fee_category=[% c | uri %]&branch=[% current_branch | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
1071 <select name="article_request_fee_category" id="article_request_fee_category">
1072 <option value="*">All</option>
1073 [% FOREACH patron_category IN patron_categories%]
1074 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1078 <td><input name="article_request_fee" size="5" type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /></td>
1079 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1086 <div id="refund-lost-item-fee-on-return" class="page-section">
1087 [% IF current_branch == '*' %]
1088 <h2>Default lost item fee refund on return policy</h2>
1090 <h2>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h2>
1092 <p>Specify the default policy for lost item fees on return.</p>
1093 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1094 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
1095 <input type="hidden" name="branch" value="[% current_branch | html %]" />
1098 <th>Refund lost item replacement fee</th>
1099 <th>Refund lost item processing fee</th>
1104 <select name="lostreturn">
1105 [%# Default branch %]
1106 [% IF ( current_branch == '*' ) %]
1107 [% IF ( defaultRefundRule == 'refund' ) %]
1108 <option value="refund" selected="selected">Refund lost item charge</option>
1109 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1110 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1111 <option value="restore">Refund lost item charge and restore overdue fine</option>
1112 <option value="0">Leave lost item charge</option>
1113 [% ELSIF ( defaultRefundRule == 'refund_unpaid' ) %]
1114 <option value="refund">Refund lost item charge</option>
1115 <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1116 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1117 <option value="restore">Refund lost item charge and restore overdue fine</option>
1118 <option value="0">Leave lost item charge</option>
1119 [% ELSIF ( defaultRefundRule == 'charge' ) %]
1120 <option value="refund">Refund lost item charge</option>
1121 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1122 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1123 <option value="restore">Refund lost item charge and restore overdue fine</option>
1124 <option value="0">Leave lost item charge</option>
1125 [% ELSIF ( defaultRefundRule == 'restore' ) %]
1126 <option value="refund">Refund lost item charge</option>
1127 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1128 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1129 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1130 <option value="0">Leave lost item charge</option>
1131 [% ELSIF ( defaultRefundRule == 0 ) %]
1132 <option value="refund">Refund lost item charge</option>
1133 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1134 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1135 <option value="restore">Refund lost item charge and restore overdue fine</option>
1136 <option value="0" selected="selected">Leave lost item charge</option>
1138 <option value="refund">Refund lost item charge</option>
1139 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1140 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1141 <option value="restore">Refund lost item charge and restore overdue fine</option>
1142 <option value="0">Leave lost item charge</option>
1145 [%# Branch-specific %]
1146 [% IF ( not refundLostItemFeeRule ) %]
1147 <option value="*" selected="selected">
1151 [% IF defaultRefundRule == 'refund' %]
1152 <span>Use default (Refund lost item charge)</span>
1153 [% ELSIF defaultRefundRule == 'refund_unpaid' %]
1154 Use default (Refund lost item charge (only if unpaid))
1155 [% ELSIF defaultRefundRule == 'charge' %]
1156 <span>Use default (Refund lost item charge and charge new overdue fine)</span>
1157 [% ELSIF defaultRefundRule == 'restore' %]
1158 <span>Use default (Refund lost item charge and restore overdue fine)</span>
1160 <span>Use default (Leave lost item charge)</span>
1163 [% IF ( not refundLostItemFeeRule ) %]
1164 <option value="refund">Refund lost item charge</option>
1165 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1166 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1167 <option value="restore">Refund lost item charge and restore overdue fine</option>
1168 <option value="0">Leave lost item charge</option>
1170 [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
1171 <option value="refund" selected="selected">Refund lost item charge</option>
1172 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1173 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1174 <option value="restore">Refund lost item charge and restore overdue fine</option>
1175 <option value="0">Leave lost item charge</option>
1176 [% ELSIF ( refundLostItemFeeRule.rule_value == 'refund_unpaid' ) %]
1177 <option value="refund">Refund lost item charge</option>
1178 <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1179 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1180 <option value="restore">Refund lost item charge and restore overdue fine</option>
1181 <option value="0">Leave lost item charge</option>
1182 [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
1183 <option value="refund">Refund lost item charge</option>
1184 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1185 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1186 <option value="restore">Refund lost item charge and restore overdue fine</option>
1187 <option value="0">Leave lost item charge</option>
1188 [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
1189 <option value="refund">Refund lost item charge</option>
1190 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1191 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1192 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1193 <option value="0">Leave lost item charge</option>
1194 [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
1195 <option value="refund">Refund lost item charge</option>
1196 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1197 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1198 <option value="restore">Refund lost item charge and restore overdue fine</option>
1199 <option value="0" selected="selected">Leave lost item charge</option>
1206 <select name="processingreturn">
1207 [%# Default branch %]
1208 [% IF ( current_branch == '*' ) %]
1209 [% IF ( defaultProcessingRefundRule == 'refund' ) %]
1210 <option value="refund" selected="selected">Refund lost item processing charge</option>
1211 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1212 <option value="0">Leave lost item processing charge</option>
1213 [% ELSIF ( defaultProcessingRefundRule == 'refund_unpaid' ) %]
1214 <option value="refund">Refund lost item charge</option>
1215 <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1216 <option value="0">Leave lost item processing charge</option>
1217 [% ELSIF ( defaultProcessingRefundRule == 0 ) %]
1218 <option value="refund">Refund lost item processing charge</option>
1219 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1220 <option value="0" selected="selected">Leave lost item processing charge</option>
1222 <option value="refund">Refund lost item processing charge</option>
1223 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1224 <option value="0">Leave lost item processing charge</option>
1227 [%# Branch-specific %]
1228 [% IF ( not refundProcessingFeeRule ) %]
1229 <option value="*" selected="selected">
1233 [% IF defaultProcessingRefundRule == 'refund' %]
1234 <span>Use default (Refund lost item processing charge)</span>
1235 [% ELSIF defaultProcessingRefundRule == 'refund_unpaid' %]
1236 Use default (Refund lost item processing charge (only if unpaid))
1238 <span>Use default (Leave lost item processing charge)</span>
1241 [% IF ( not refundProcessingFeeRule ) %]
1242 <option value="refund">Refund lost item processing charge</option>
1243 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1244 <option value="0">Leave lost item processing charge</option>
1246 [% IF ( refundProcessingFeeRule.rule_value == 'refund' ) %]
1247 <option value="refund" selected="selected">Refund lost item processing charge</option>
1248 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1249 <option value="0">Leave lost item processing charge</option>
1250 [% ELSIF ( refundProcessingFeeRule.rule_value == 'refund_unpaid' ) %]
1251 <option value="refund">Refund lost item processing charge</option>
1252 <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1253 <option value="0">Leave lost item processing charge</option>
1254 [% ELSIF ( refundProcessingFeeRule.rule_value == 0 ) %]
1255 <option value="refund">Refund lost item processing charge</option>
1256 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1257 <option value="0" selected="selected">Leave lost item processing charge</option>
1263 <td class="actions">
1264 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
1271 <div id="holds-policy-by-item-type" class="page-section">
1272 <h2>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h2>
1274 For this library, you can edit rules for given itemtypes, regardless of the patron's category.
1277 Currently, this means hold policies. The various policies have the following effects:
1280 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
1281 <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>
1282 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
1283 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
1286 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</p>
1287 <p><strong>Important:</strong></p>
1290 <li>The hold 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>.</li>
1291 <li>The return policy is applied based on the CircControlReturnsBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CircControlReturnsBranch">[% Koha.Preference('CircControlReturnsBranch') | html %]</a>.</li>
1292 <li>When return policy is set to 'item floats by library group' the item's homebranch will be used to find groups.</li>
1295 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1296 <input type="hidden" name="op" value="add-branch-item" />
1297 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1301 <th>Hold policy</th>
1302 <th>Hold pickup library match</th>
1303 <th>Return policy</th>
1306 [% FOREACH i IN itemtypeloop %]
1307 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1308 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1309 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1311 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1314 [% i.translated_description | html %]
1317 [% IF holdallowed == 'from_any_library' %]
1318 <span>From any library</span>
1319 [% ELSIF holdallowed == 'from_local_hold_group' %]
1320 <span>From local hold group</span>
1321 [% ELSIF holdallowed == 'from_home_library' %]
1322 <span>From home library</span>
1324 <span>No holds allowed</span>
1328 [% IF hold_fulfillment_policy == 'any' %]
1329 <span>any library</span>
1330 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
1331 <span>item's home library</span>
1332 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
1333 <span>item's hold group</span>
1334 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
1335 <span>patron's hold group</span>
1336 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
1337 <span>item's holding library</span>
1341 [% IF returnbranch == 'homebranch' %]
1342 <span>Item returns home</span>
1343 [% ELSIF returnbranch == 'holdingbranch' %]
1344 <span>Item returns to issuing branch</span>
1345 [% ELSIF returnbranch == 'noreturn' %]
1346 <span>Item floats</span>
1347 [% ELSIF returnbranch == 'returnbylibrarygroup'%]
1348 <span>Item floats by library group</span>
1351 <td class="actions">
1352 <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-can"></i> Delete</a>
1359 <select name="itemtype">
1360 [% FOREACH itemtypeloo IN itemtypeloop %]
1361 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
1366 <select name="holdallowed">
1367 <option value="from_any_library">From any library</option>
1368 <option value="from_local_hold_group">From local hold group</option>
1369 <option value="from_home_library">From home library</option>
1370 <option value="not_allowed">No holds allowed</option>
1374 <select name="hold_fulfillment_policy">
1375 <option value="any">
1379 <option value="holdgroup">
1383 <option value="patrongroup">
1387 <option value="homebranch">
1391 <option value="holdingbranch">
1392 item's holding library
1397 <select name="returnbranch">
1398 <option value="homebranch">Item returns home</option>
1399 <option value="holdingbranch">Item returns to issuing library</option>
1400 <option value="noreturn">Item floats</option>
1401 <option value="returnbylibrarygroup">Item floats by library group</option>
1404 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1410 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1412 <div class="col-sm-2 col-sm-pull-10">
1414 [% INCLUDE 'admin-menu.inc' %]
1416 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1417 </div> <!-- /.row -->
1419 [% MACRO jsinclude BLOCK %]
1420 [% Asset.js("js/admin-menu.js") | $raw %]
1421 [% INCLUDE 'datatables.inc' %]
1422 [% INCLUDE 'calendar.inc' %]
1423 [% INCLUDE 'columns_settings.inc' %]
1424 [% INCLUDE 'format_price.inc' %]
1426 $(document).ready(function() {
1427 KohaTable("default-circulation-rules", {
1429 { "visible": false, "targets": [ 0,2 ] },
1430 { "orderable": false, "targets": ["_all"] }
1432 "orderFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
1438 function clear_edit(){
1439 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
1440 if ( !cancel ) return;
1441 $('#default-circulation-rules td').removeClass('highlighted-row');
1442 var edit_row = $("#edit_row");
1443 $(edit_row).find("input").each(function(){
1444 var type = $(this).attr("type");
1445 if (type != "button" && type != "submit" ) {
1447 $(this).prop('disabled', false);
1449 if ( type == "checkbox" ) {
1450 $(this).prop('checked', false);
1453 $(edit_row).find("select").prop('disabled', false);
1454 $(edit_row).find("select option:first-child").attr("selected", "selected");
1455 $(edit_row).find("td:last input[name='clear']").remove();
1458 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1460 $(document).ready(function() {
1461 $('[data-toggle="popover"]').popover();
1463 $(".delete").on("click",function(){
1464 return confirmDelete(MSG_CONFIRM_DELETE);
1467 $("#clone_rules").on("click",function(){
1468 var library_dropdown = document.getElementById("branch");
1469 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
1470 var selected_library_text = $("#branch option:selected").text();
1471 var to_library = $("#tobranch option:selected").text();
1472 var MSG_CONFIRM_CLONE;
1473 if (selected_library === "*") {
1474 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);
1475 return confirmClone(MSG_CONFIRM_CLONE);
1477 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);
1478 return confirmClone(MSG_CONFIRM_CLONE);
1482 $('#selectlibrary').find("input:submit").hide();
1483 $('#branch').change(function() {
1484 $('#selectlibrary').submit();
1486 $(".editrule").click(function(){
1487 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
1488 var edit = confirm(_("Are you sure you want to edit another rule?"));
1489 if (!edit) return false;
1491 $('#default-circulation-rules td').removeClass('highlighted-row');
1492 $(this).parent().parent().find("td").each(function (i) {
1493 $(this).addClass('highlighted-row');
1494 itm_code = $(this).data('code');
1495 itm_text = $(this).text();
1496 itm_text = itm_text.replace(/^\s*|\s*$/g,'');
1497 var current_column = $("#edit_row td:eq("+i+")");
1499 // specific processing for the Note column
1500 var note = $(this).find("a[id='viewnote']").data("content");
1501 $(current_column).find("input[type='text']").val(note);
1502 } else if ( i == 9 ) {
1503 // specific processing for Hard due date
1504 $(current_column).find("select").val(itm_code);
1505 var hardduedate = $(this).data('duedate');
1507 var fp = document.querySelector("#hardduedate")._flatpickr;
1508 hardduedate = fp.parseDate( hardduedate, flatpickr_dateformat_string );
1509 if( hardduedate) fp.setDate( hardduedate, 1 );
1511 } else if ( i == 26 ) {
1512 // specific processing for No automatic renewal after (hard limit)
1513 var renewdate = itm_text;
1515 var fp = document.querySelector("#no_auto_renewal_after_hard_limit")._flatpickr;
1516 renewdate = fp.parseDate( renewdate, flatpickr_dateformat_string );
1517 if( renewdate) fp.setDate( renewdate, 1 );
1519 } else if ( i == 16 ) {
1520 // specific processing for cap_fine_to_replacement_price
1521 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1522 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1523 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1525 $(current_column).find("input[type='text']").val(itm_text);
1527 $(current_column).find("input[inputmode='decimal']").each(function() {
1528 $(this).val(itm_text.unformat_price());
1530 // select the corresponding option
1531 $(current_column).find("select option").each(function(){
1532 opt = $(this).attr('value');
1533 if ( opt == itm_code ) {
1534 $(this).attr('selected', 'selected');
1537 var current_input_id = $(current_column).children('input').first().attr('id');
1538 if ( i == 0 || i == 1 ) {
1539 // Disable the 2 first columns, we cannot update them.
1540 var val = $(current_column).find("select option:selected").val();
1541 var name = "categorycode";
1545 // Remove potential previous input added
1546 $(current_column).find("input").remove();
1547 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1548 } else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 || current_input_id === "holds_pickup_period" ) {
1549 // If the value is not an integer for
1550 // - "Current checkouts allowed"
1551 // - "Current on-site checkouts allowed"
1552 // - "Holds allowed (total)"
1553 // - "Holds allowed (daily)"
1554 // - "Holds per record (count)"
1555 // - "Holds pickup period (day)"
1556 // The value is "Unlimited" (or an equivalent translated string)
1557 // an it should be set to an empty string
1558 if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) {
1559 $(current_column).find("input[type='text']").val("");
1564 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1565 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1568 $(".clear_edit").on("click",function(e){
1573 $("#set-article-requests-daily-limit").on("submit", function(){
1574 if (! $("input[name='open_article_requests_limit'").val().length){
1575 alert("Please set a daily limit for this patron's category");
1581 $("#set-article-request-fee").on("submit", function(){
1582 if (! $("input[name='article_request_fee'").val().length){
1583 alert("Please set a valid value for the fee");
1591 [% INCLUDE 'intranet-bottom.inc' %]