8 [% USE CirculationRules %]
10 [% SET footerjs = 1 %]
12 [% SET branchcode = humanbranch || undef %]
14 [% SET categorycodes = [] %]
15 [% FOREACH pc IN patron_categories %]
16 [% categorycodes.push( pc.id ) %]
18 [% categorycodes.push(undef) %]
20 [% SET itemtypes = [] %]
21 [% FOREACH i IN itemtypeloop %]
22 [% itemtypes.push( i.itemtype ) %]
24 [% itemtypes.push(undef) %]
26 [% INCLUDE 'doc-head-open.inc' %]
27 <title>Circulation and fine rules › Administration › Koha</title>
28 [% INCLUDE 'doc-head-close.inc' %]
31 <body id="admin_smart-rules" class="admin">
32 [% WRAPPER 'header.inc' %]
33 [% INCLUDE 'prefs-admin-search.inc' %]
36 [% WRAPPER 'sub-header.inc' %]
37 [% WRAPPER breadcrumbs %]
38 [% WRAPPER breadcrumb_item %]
39 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
41 [% WRAPPER breadcrumb_item bc_active= 1 %]
42 Circulation and fine rules
44 [% END #/ WRAPPER breadcrumbs %]
45 [% END #/ WRAPPER sub-header.inc %]
47 <div class="main container-fluid">
49 <div class="col-sm-10 col-sm-push-2">
51 <h1 class="parameters">
53 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
55 Defining circulation and fine rules for all libraries
59 <div class="page-section bg-info">
60 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
62 <li>same library, same patron category, same item type</li>
63 <li>same library, same patron category, all item types</li>
64 <li>same library, all patron categories, same item type</li>
65 <li>same library, all patron categories, all item types</li>
66 <li>default (all libraries), same patron category, same item type</li>
67 <li>default (all libraries), same patron category, all item types</li>
68 <li>default (all libraries), all patron categories, same item type</li>
69 <li>default (all libraries), all patron categories, all item types</li>
72 <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
73 current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
74 or the specific rule's type, whichever is less.</p>
75 <p>To modify a rule, create a new one with the same patron category and item type.</p>
78 <div class="page-section">
79 [% UNLESS restricted_to_own_library %]
80 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
82 <select name="branch" id="branch" style="width:20em;">
83 <option value="*">Standard rules for all libraries</option>
84 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
87 [% IF ( definedbranch ) %]
88 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
89 <label for="tobranch"><strong>Clone these rules to:</strong></label>
90 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
91 <select name="tobranch" id="tobranch">
92 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
94 <input type="submit" id="clone_rules" class="btn btn-primary" value="Clone" />
100 <div class="page-section">
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/suspension 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 [% IF Koha.Preference('ArticleRequests') %]
144 <th>Article requests</th>
146 <th>Rental discount (%)</th>
147 [% IF Koha.Preference('UseRecalls') %]
148 <th>Recalls allowed (total)</th>
149 <th>Recalls per record (count)</th>
150 <th>On shelf recalls allowed</th>
151 <th>Recall due date interval (day)</th>
152 <th>Recall overdue fine amount</th>
153 <th>Recall pickup period (day)</th>
155 <th class="noExport">Actions</th>
159 [% SET row_count = 0 %]
160 [% FOREACH c IN categorycodes %]
161 [% SET c = '' UNLESS c.defined %]
162 [% FOREACH i IN itemtypes %]
163 [% SET i = '' UNLESS i.defined %]
164 [% SET note = all_rules.$c.$i.note %]
165 [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
166 [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
167 [% SET issuelength = all_rules.$c.$i.issuelength %]
168 [% SET daysmode = all_rules.$c.$i.daysmode %]
169 [% SET lengthunit = all_rules.$c.$i.lengthunit %]
170 [% SET hardduedate = all_rules.$c.$i.hardduedate %]
171 [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
172 [% SET fine = all_rules.$c.$i.fine %]
173 [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
174 [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
175 [% SET firstremind = all_rules.$c.$i.firstremind %]
176 [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
177 [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
178 [% SET finedays = all_rules.$c.$i.finedays %]
179 [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
180 [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
181 [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
182 [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
183 [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
184 [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
185 [% SET auto_renew = all_rules.$c.$i.auto_renew %]
186 [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
187 [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
188 [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
189 [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
190 [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
191 [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
192 [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
193 [% SET article_requests = all_rules.$c.$i.article_requests %]
194 [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
195 [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
196 [% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
197 [% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
198 [% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
199 [% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
200 [% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
201 [% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
203 [% 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 || recalls_allowed || recalls_per_record || on_shelf_recalls || recall_due_date_interval || recall_overdue_fine || recall_shelf_time %]
205 [% SET row_count = row_count + 1 %]
206 <tr row_countd="row_[% row_count | html %]">
207 <td>[% IF ( c == undef ) %]
212 <td data-code="[% c %]">
216 [% Categories.GetName(c) | html %]
219 <td>[% IF ( i == undef ) %]
224 <td data-code="[% i %]">
228 [% ItemTypes.GetDescription(i,1) | html %]
232 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
233 <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>
236 [% IF note.defined && note != '' %]
237 <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
238 [% ELSE %]<span> </span>[% END %]
241 [% IF maxissueqty.defined && maxissueqty != '' %]
242 [% maxissueqty | html %]
244 <span>Unlimited</span>
248 [% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
249 [% maxonsiteissueqty | html %]
251 <span>Unlimited</span>
254 <td>[% issuelength | html %]</td>
255 <td data-code="[% daysmode %]">
256 [% SWITCH daysmode %]
257 [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
258 [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
259 [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
260 [% 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>
261 [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
264 <td data-code="[% lengthunit %]">
265 [% IF ( lengthunit == 'days' ) %]
267 [% ELSIF ( lengthunit == 'hours') %]
270 <span>Undefined</span>
273 <td data-code="[% hardduedatecompare %]">
274 [% IF ( hardduedate ) %]
275 [% IF ( hardduedatecompare == '-1' ) %]
276 before [% hardduedate | $KohaDates %]
277 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
278 [% ELSIF ( hardduedatecompare == '0' ) %]
279 on [% hardduedate | $KohaDates %]
280 <input type="hidden" name="hardduedatecomparebackup" value="0" />
281 [% ELSIF ( hardduedatecompare == '1' ) %]
282 after [% hardduedate | $KohaDates %]
283 <input type="hidden" name="hardduedatecomparebackup" value="1" />
286 <span>None defined</span>
289 <td>[% decreaseloanholds | html %]</td>
290 <td>[% fine | $Price %]</td>
291 <td>[% chargeperiod | html %]</td>
292 <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
293 <td>[% firstremind | html %]</td>
294 <td>[% IF overduefinescap %][% overduefinescap | $Price %][% ELSE %][% END %]</td>
296 [% IF cap_fine_to_replacement_price %]
297 <input type="checkbox" checked="checked" disabled="disabled" />
299 <input type="checkbox" disabled="disabled" />
302 <td>[% finedays | html %]</td>
303 <td>[% maxsuspensiondays | html %]</td>
304 <td>[% suspension_chargeperiod | html %]</td>
305 <td>[% renewalsallowed | html %]</td>
306 [% IF Koha.Preference('UnseenRenewals') %]
308 [% IF unseenrenewalsallowed.defined && unseenrenewalsallowed != '' %]
309 [% unseenrenewalsallowed | html %]
311 <span>Unlimited</span>
315 <td>[% renewalperiod | html %]</td>
316 <td>[% norenewalbefore | html %]</td>
317 <td data-code="[%- IF auto_renew -%]yes[%- ELSE -%]no[%- END -%]">
324 <td>[% no_auto_renewal_after | html %]</td>
325 <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
327 [% IF reservesallowed.defined && reservesallowed != '' %]
328 [% reservesallowed | html %]
330 <span>Unlimited</span>
334 [% IF holds_per_day.defined && holds_per_day != '' %]
335 [% holds_per_day | html %]
337 <span>Unlimited</span>
341 [% IF holds_per_record.defined && holds_per_record != '' %]
342 [% holds_per_record | html %]
344 <span>Unlimited</span>
347 <td data-code="[% onshelfholds %]">
348 [% IF onshelfholds == 1 %]
350 [% ELSIF onshelfholds == 2 %]
351 <span>If all unavailable</span>
353 <span>If any unavailable</span>
356 <td data-code="[% opacitemholds %]">
357 [% IF opacitemholds == 'F'%]
359 [% ELSIF opacitemholds == 'Y'%]
362 <span>Don't allow</span>
365 [% IF Koha.Preference('ArticleRequests') %]
366 <td data-code="[% article_requests %]">
367 [% IF article_requests == 'no' %]
369 [% ELSIF article_requests == 'yes' %]
371 [% ELSIF article_requests == 'bib_only' %]
372 <span>Record only</span>
373 [% ELSIF article_requests == 'item_only' %]
374 <span>Item only</span>
378 <td>[% rentaldiscount | html %]</td>
379 [% IF Koha.Preference('UseRecalls') %]
380 <td>[% recalls_allowed | html %]</td>
381 <td>[% recalls_per_record | html %]</td>
382 <td data-code="[% on_shelf_recalls %]">
383 [% IF on_shelf_recalls == 'all' %]
384 <span>If all unavailable</span>
386 <span>If any unavailable</span>
389 <td>[% recall_due_date_interval | html %]</td>
390 <td>[% recall_overdue_fine | $Price %]</td>
391 <td>[% recall_shelf_time | html %]</td>
394 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
395 <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>
401 <tr class="noExport" id="edit_row">
404 <select name="categorycode" id="categorycode">
405 <option value="*">All</option>
406 [% FOREACH patron_category IN patron_categories%]
407 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
413 <select name="itemtype" id="matrixitemtype" style="width:13em;">
414 <option value="*">All</option>
415 [% FOREACH itemtypeloo IN itemtypeloop %]
416 [% NEXT IF itemtypeloo.parent_type %]
417 [% SET children = itemtypeloo.children_with_localization %]
418 [% IF children.count %]
419 <optgroup label="[% itemtypeloo.translated_description | html %]">
420 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
421 [% FOREACH child IN children %]
422 <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
426 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
432 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
433 <button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button>
434 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
436 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
437 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
438 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
439 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
441 <select name="daysmode" id="daysmode">
442 <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
443 <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
444 <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
445 <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
446 <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>
450 <select name="lengthunit" id="lengthunit">
451 <option value="days" selected="selected">Days</option>
452 <option value="hours">Hours</option>
456 <select name="hardduedatecompare" id="hardduedatecompare">
457 <option value="-1">Before</option>
458 <option value="0">Exactly on</option>
459 <option value="1">After</option>
461 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="flatpickr" />
462 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
464 <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
465 <td><input type="text" name="fine" id="fine" size="4" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /></td>
466 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
468 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
469 <option value="0">End of interval</option>
470 <option value="1">Start of interval</option>
473 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
474 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /> </td>
475 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
476 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
477 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
478 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
479 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
480 [% IF Koha.Preference('UnseenRenewals') %]
481 <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
483 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
484 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
486 <select name="auto_renew" id="auto_renew">
487 <option value="no" selected>No</option>
488 <option value="yes">Yes</option>
491 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
493 <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="flatpickr"/>
494 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
496 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
497 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
498 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
500 <select name="onshelfholds" id="onshelfholds">
501 <option value="1">Yes</option>
502 <option value="0">If any unavailable</option>
503 <option value="2">If all unavailable</option>
507 <select id="opacitemholds" name="opacitemholds">
508 <option value="N">Don't allow</option>
509 <option value="Y">Allow</option>
510 <option value="F">Force</option>
513 [% IF Koha.Preference('ArticleRequests') %]
515 <select id="article_requests" name="article_requests">
516 <option value="no">No</option>
517 <option value="yes">Yes</option>
518 <option value="bib_only">Record only</option>
519 <option value="item_only">Item only</option>
523 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
524 [% IF Koha.Preference('UseRecalls') %]
525 <td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
526 <td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
528 <select name="on_shelf_recalls" id="on_shelf_recalls">
529 <option value="any">If any unavailable</option>
530 <option value="all">If all unavailable</option>
533 <td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
534 <td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6" inputmode="decimal" pattern="^\d+(\.\d{2})?$"></td>
535 <td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
538 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
539 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
540 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
547 <th>Patron category</th>
552 <th>Current checkouts allowed</th>
553 <th>Current on-site checkouts allowed</th>
557 <th>Hard due date</th>
558 <th>Decreased loan period for high holds (day)</th>
560 <th>Fine charging interval</th>
561 <th>Charge when?</th>
562 <th>Fine/suspension grace period</th>
563 <th>Overdue fines cap (amount)</th>
564 <th>Cap fine at replacement price</th>
565 <th>Suspension in days (day)</th>
566 <th>Max. suspension duration (day)</th>
567 <th>Suspension charging interval</th>
568 <th>Renewals allowed (count)</th>
569 [% IF Koha.Preference('UnseenRenewals') %]
570 <th>Unseen renewals allowed (count)</th>
572 <th>Renewal period</th>
573 <th>No renewal before</th>
574 <th>Automatic renewal</th>
575 <th>No automatic renewal after</th>
576 <th>No automatic renewal after (hard limit)</th>
577 <th>Holds allowed (total)</th>
578 <th>Holds allowed (daily)</th>
579 <th>Holds per record (count)</th>
580 <th>On shelf holds allowed</th>
581 <th>OPAC item level holds</th>
582 [% IF Koha.Preference('ArticleRequests') %]
583 <th>Article requests</th>
585 <th>Rental discount (%)</th>
586 [% IF Koha.Preference('UseRecalls') %]
587 <th>Recalls allowed (total)</th>
588 <th>Recalls per record (count)</th>
589 <th>On shelf recalls allowed</th>
590 <th>Recall due date interval (day)</th>
591 <th>Recall overdue fine amount</th>
592 <th>Recall pickup period (day)</th>
599 </div><!-- ./page-section -->
601 <div id="defaults-for-this-library" class="page-section">
602 <h2>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h2>
603 <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>
604 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
605 <input type="hidden" name="op" value="set-branch-defaults" />
606 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
610 <th>Total current checkouts allowed</th>
611 <th>Total current on-site checkouts allowed</th>
612 <th>Maximum total holds allowed (count)</th>
614 <th>Hold pickup library match</th>
615 <th>Return policy</th>
616 <th class="noExport">Actions</th>
618 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
619 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', { want_rule => 1 } ) %]
620 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
621 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
622 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
623 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
624 [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
627 [% IF ( default_checkout_hold_and_return_policy ) %]
636 <input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
639 <input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
642 <input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
645 <select name="holdallowed">
650 [% IF holdallowed.rule_value == 'from_any_library' %]
651 <option value="from_any_library" selected="selected">
653 <option value="from_any_library">
658 [% IF holdallowed.rule_value == 'from_local_hold_group' %]
659 <option value="from_local_hold_group" selected="selected">
661 <option value="from_local_hold_group">
663 From local hold group
666 [% IF holdallowed.rule_value == 'from_home_library' %]
667 <option value="from_home_library" selected="selected">
669 <option value="from_home_library">
674 [% IF holdallowed.rule_value == 'not_allowed' %]
675 <option value="not_allowed" selected="selected">
677 <option value="not_allowed">
684 <select name="hold_fulfillment_policy">
690 [% IF hold_fulfillment_policy.rule_value == 'any' %]
691 <option value="any" selected="selected">
700 [% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
701 <option value="holdgroup" selected="selected">
705 <option value="holdgroup">
710 [% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
711 <option value="patrongroup" selected="selected">
715 <option value="patrongroup">
720 [% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
721 <option value="homebranch" selected="selected">
725 <option value="homebranch">
730 [% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
731 <option value="holdingbranch" selected="selected">
732 item's holding library
735 <option value="holdingbranch">
736 item's holding library
742 <select name="returnbranch">
748 [% IF returnbranch.rule_value == 'homebranch' %]
749 <option value="homebranch" selected="selected">
751 <option value="homebranch">
755 [% IF returnbranch.rule_value == 'holdingbranch' %]
756 <option value="holdingbranch" selected="selected">
758 <option value="holdingbranch">
760 Item returns to issuing library
762 [% IF returnbranch.rule_value == 'noreturn' %]
763 <option value="noreturn" selected="selected">
765 <option value="noreturn">
772 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
773 [% IF ( default_checkout_hold_and_return_policy ) %]
774 <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>
782 [% IF ( show_branch_cat_rule_form ) %]
783 <div id="holds-policy-by-patron-category" class="page-section">
784 <h2>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h2>
785 <p>For this library, you can specify the maximum number of loans that
786 a patron of a given category can make, regardless of the item type.
788 <p>If the total amount loanable for a given patron category is left blank,
789 no limit applies, except possibly for a limit you define for a specific item type.
791 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
792 <input type="hidden" name="op" value="add-branch-cat" />
793 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
796 <th>Patron category</th>
797 <th>Total current checkouts allowed</th>
798 <th>Total current on-site checkouts allowed</th>
799 <th>Total holds allowed</th>
802 [% FOREACH c IN categorycodes %]
804 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
805 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
806 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
808 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
814 [% Categories.GetName(c) | html %]
818 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
819 [% patron_maxissueqty | html %]
821 <span>Unlimited</span>
825 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
826 [% patron_maxonsiteissueqty | html %]
828 <span>Unlimited</span>
832 [% IF max_holds.defined && max_holds != '' %]
833 [% max_holds | html %]
835 <span>Unlimited</span>
840 <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>
847 <select name="categorycode">
848 [% FOREACH patron_category IN patron_categories%]
849 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
853 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
854 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
855 <td><input name="max_holds" size="3" type="text" /></td>
856 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
863 <div id="waiting-hold-cancel-category" class="page-section">
865 <h2>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h2>
867 <h2>Default waiting hold cancellation policy</h2>
869 <p>Specify if waiting holds can be cancelled for a given patron category.</p>
870 <form id="set-waiting-hold-cancellation" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
871 <input type="hidden" name="op" value="set-waiting-hold-cancellation" />
872 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
875 <th>Patron category</th>
877 <th>Cancellation allowed</th>
880 [% FOREACH c IN categorycodes %]
881 [% SET c = '*' UNLESS c.defined AND c != '' %]
882 [% FOREACH i IN itemtypes %]
883 [% SET i = '*' UNLESS i.defined AND i != '' %]
885 [% SET waiting_hold_cancellation = CirculationRules.Search( current_branch, c, i, 'waiting_hold_cancellation' ) %]
887 [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %]
893 [% Categories.GetName(c) | html %]
900 [% ItemTypes.GetDescription(i,1) | html %]
904 [% IF waiting_hold_cancellation %]
911 <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>
919 <select name="waiting_hold_cancellation_category" id="waiting_hold_cancellation_category">
920 <option value="*">All</option>
921 [% FOREACH patron_category IN patron_categories %]
922 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
927 <select name="waiting_hold_cancellation_itemtype" id="waiting_hold_cancellation_itemtype">
928 <option value="*">All</option>
929 [% FOREACH itemtype IN itemtypeloop %]
930 <option value="[% itemtype.itemtype | html %]">[% ItemTypes.GetDescription(itemtype.itemtype) | html %]</option>
935 <select name="waiting_hold_cancellation_policy" id="waiting_hold_cancellation_policy">
936 <option value="0" selected>No</option>
937 <option value="1">Yes</option>
940 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
946 [% IF Koha.Preference('ArticleRequests') %]
947 <div id="open-article-requests-limit-patron-category" class="page-section">
949 <h2>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h2>
951 <h2>Default open article requests limit</h2>
953 <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
954 <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
955 <input type="hidden" name="op" value="add-open-article-requests-limit" />
956 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
959 <th>Patron category</th>
960 <th>Total article requests</th>
963 [% FOREACH c IN categorycodes %]
965 [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %]
967 [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %]
970 [% Categories.GetName(c) | html %]
973 [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %]
974 [% open_article_requests_limit | html %]
976 <span>Unlimited</span>
981 <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>
988 <select name="categorycode">
989 [% FOREACH patron_category IN patron_categories %]
990 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
994 <td><input name="open_article_requests_limit" size="3" type="text" /></td>
995 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1001 <div id="article-request-fee-category" class="page-section">
1002 [% IF humanbranch %]
1003 <h2>Article request fees for [% Branches.GetName( humanbranch ) | html %]</h2>
1005 <h2>Default article request fees</h2>
1007 <p>Specify the article request fee for a given patron category.</p>
1008 <form id="set-article-request-fee" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1009 <input type="hidden" name="op" value="set-article-request-fee" />
1010 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1013 <th>Patron category</th>
1017 [% FOREACH c IN categorycodes %]
1018 [% SET c = '*' UNLESS c.defined AND c != '' %]
1020 [% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %]
1022 [% IF ( article_request_fee.defined && article_request_fee != '' ) %]
1028 [% Categories.GetName(c) | html %]
1032 [% IF article_request_fee.defined && article_request_fee != '' %]
1033 [% article_request_fee | $Price %]
1038 <td class="actions">
1039 <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>
1046 <select name="article_request_fee_category" id="article_request_fee_category">
1047 <option value="*">All</option>
1048 [% FOREACH patron_category IN patron_categories%]
1049 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1053 <td><input name="article_request_fee" size="5" type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" /></td>
1054 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1061 <div id="refund-lost-item-fee-on-return" class="page-section">
1062 [% IF current_branch == '*' %]
1063 <h2>Default lost item fee refund on return policy</h2>
1065 <h2>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h2>
1067 <p>Specify the default policy for lost item fees on return.</p>
1068 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1069 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
1070 <input type="hidden" name="branch" value="[% current_branch | html %]" />
1073 <th>Refund lost item replacement fee</th>
1074 <th>Refund lost item processing fee</th>
1079 <select name="lostreturn">
1080 [%# Default branch %]
1081 [% IF ( current_branch == '*' ) %]
1082 [% IF ( defaultRefundRule == 'refund' ) %]
1083 <option value="refund" selected="selected">Refund lost item charge</option>
1084 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1085 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1086 <option value="restore">Refund lost item charge and restore overdue fine</option>
1087 <option value="0">Leave lost item charge</option>
1088 [% ELSIF ( defaultRefundRule == 'refund_unpaid' ) %]
1089 <option value="refund">Refund lost item charge</option>
1090 <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1091 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1092 <option value="restore">Refund lost item charge and restore overdue fine</option>
1093 <option value="0">Leave lost item charge</option>
1094 [% ELSIF ( defaultRefundRule == 'charge' ) %]
1095 <option value="refund">Refund lost item charge</option>
1096 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1097 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1098 <option value="restore">Refund lost item charge and restore overdue fine</option>
1099 <option value="0">Leave lost item charge</option>
1100 [% ELSIF ( defaultRefundRule == 'restore' ) %]
1101 <option value="refund">Refund lost item charge</option>
1102 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1103 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1104 <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1105 <option value="0">Leave lost item charge</option>
1106 [% ELSIF ( defaultRefundRule == 0 ) %]
1107 <option value="refund">Refund lost item charge</option>
1108 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1109 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1110 <option value="restore">Refund lost item charge and restore overdue fine</option>
1111 <option value="0" selected="selected">Leave lost item charge</option>
1113 <option value="refund">Refund lost item charge</option>
1114 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1115 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1116 <option value="restore">Refund lost item charge and restore overdue fine</option>
1117 <option value="0">Leave lost item charge</option>
1120 [%# Branch-specific %]
1121 [% IF ( not refundLostItemFeeRule ) %]
1122 <option value="*" selected="selected">
1126 [% IF defaultRefundRule == 'refund' %]
1127 <span>Use default (Refund lost item charge)</span>
1128 [% ELSIF defaultRefundRule == 'refund_unpaid' %]
1129 Use default (Refund lost item charge (only if unpaid))
1130 [% ELSIF defaultRefundRule == 'charge' %]
1131 <span>Use default (Refund lost item charge and charge new overdue fine)</span>
1132 [% ELSIF defaultRefundRule == 'restore' %]
1133 <span>Use default (Refund lost item charge and restore overdue fine)</span>
1135 <span>Use default (Leave lost item charge)</span>
1138 [% IF ( not refundLostItemFeeRule ) %]
1139 <option value="refund">Refund lost item charge</option>
1140 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1141 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1142 <option value="restore">Refund lost item charge and restore overdue fine</option>
1143 <option value="0">Leave lost item charge</option>
1145 [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
1146 <option value="refund" selected="selected">Refund lost item charge</option>
1147 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1148 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1149 <option value="restore">Refund lost item charge and restore overdue fine</option>
1150 <option value="0">Leave lost item charge</option>
1151 [% ELSIF ( refundLostItemFeeRule.rule_value == 'refund_unpaid' ) %]
1152 <option value="refund">Refund lost item charge</option>
1153 <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1154 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1155 <option value="restore">Refund lost item charge and restore overdue fine</option>
1156 <option value="0">Leave lost item charge</option>
1157 [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
1158 <option value="refund">Refund lost item charge</option>
1159 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1160 <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1161 <option value="restore">Refund lost item charge and restore overdue fine</option>
1162 <option value="0">Leave lost item charge</option>
1163 [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
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" selected="selected">Refund lost item charge and restore overdue fine</option>
1168 <option value="0">Leave lost item charge</option>
1169 [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
1170 <option value="refund">Refund lost item charge</option>
1171 <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1172 <option value="charge">Refund lost item charge and charge new overdue fine</option>
1173 <option value="restore">Refund lost item charge and restore overdue fine</option>
1174 <option value="0" selected="selected">Leave lost item charge</option>
1181 <select name="processingreturn">
1182 [%# Default branch %]
1183 [% IF ( current_branch == '*' ) %]
1184 [% IF ( defaultProcessingRefundRule == 'refund' ) %]
1185 <option value="refund" selected="selected">Refund lost item processing charge</option>
1186 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1187 <option value="0">Leave lost item processing charge</option>
1188 [% ELSIF ( defaultProcessingRefundRule == 'refund_unpaid' ) %]
1189 <option value="refund">Refund lost item charge</option>
1190 <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1191 <option value="0">Leave lost item processing charge</option>
1192 [% ELSIF ( defaultProcessingRefundRule == 0 ) %]
1193 <option value="refund">Refund lost item processing charge</option>
1194 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1195 <option value="0" selected="selected">Leave lost item processing charge</option>
1197 <option value="refund">Refund lost item processing charge</option>
1198 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1199 <option value="0">Leave lost item processing charge</option>
1202 [%# Branch-specific %]
1203 [% IF ( not refundProcessingFeeRule ) %]
1204 <option value="*" selected="selected">
1208 [% IF defaultProcessingRefundRule == 'refund' %]
1209 <span>Use default (Refund lost item processing charge)</span>
1210 [% ELSIF defaultProcessingRefundRule == 'refund_unpaid' %]
1211 Use default (Refund lost item processing charge (only if unpaid))
1213 <span>Use default (Leave lost item processing charge)</span>
1216 [% IF ( not refundProcessingFeeRule ) %]
1217 <option value="refund">Refund lost item processing charge</option>
1218 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1219 <option value="0">Leave lost item processing charge</option>
1221 [% IF ( refundProcessingFeeRule.rule_value == 'refund' ) %]
1222 <option value="refund" selected="selected">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>
1225 [% ELSIF ( refundProcessingFeeRule.rule_value == 'refund_unpaid' ) %]
1226 <option value="refund">Refund lost item processing charge</option>
1227 <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1228 <option value="0">Leave lost item processing charge</option>
1229 [% ELSIF ( refundProcessingFeeRule.rule_value == 0 ) %]
1230 <option value="refund">Refund lost item processing charge</option>
1231 <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1232 <option value="0" selected="selected">Leave lost item processing charge</option>
1238 <td class="actions">
1239 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
1246 <div id="holds-policy-by-item-type" class="page-section">
1247 <h2>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h2>
1249 For this library, you can edit rules for given itemtypes, regardless of the patron's category.
1252 Currently, this means hold policies. The various policies have the following effects:
1255 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
1256 <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>
1257 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
1258 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
1261 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</p>
1262 <p><strong>Important:</strong></p>
1265 <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>
1266 <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>
1269 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1270 <input type="hidden" name="op" value="add-branch-item" />
1271 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1275 <th>Hold policy</th>
1276 <th>Hold pickup library match</th>
1277 <th>Return policy</th>
1280 [% FOREACH i IN itemtypeloop %]
1281 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1282 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1283 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1285 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1288 [% i.translated_description | html %]
1291 [% IF holdallowed == 'from_any_library' %]
1292 <span>From any library</span>
1293 [% ELSIF holdallowed == 'from_local_hold_group' %]
1294 <span>From local hold group</span>
1295 [% ELSIF holdallowed == 'from_home_library' %]
1296 <span>From home library</span>
1298 <span>No holds allowed</span>
1302 [% IF hold_fulfillment_policy == 'any' %]
1303 <span>any library</span>
1304 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
1305 <span>item's home library</span>
1306 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
1307 <span>item's hold group</span>
1308 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
1309 <span>patron's hold group</span>
1310 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
1311 <span>item's holding library</span>
1315 [% IF returnbranch == 'homebranch' %]
1316 <span>Item returns home</span>
1317 [% ELSIF returnbranch == 'holdingbranch' %]
1318 <span>Item returns to issuing branch</span>
1319 [% ELSIF returnbranch == 'noreturn' %]
1320 <span>Item floats</span>
1323 <td class="actions">
1324 <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>
1331 <select name="itemtype">
1332 [% FOREACH itemtypeloo IN itemtypeloop %]
1333 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
1338 <select name="holdallowed">
1339 <option value="from_any_library">From any library</option>
1340 <option value="from_local_hold_group">From local hold group</option>
1341 <option value="from_home_library">From home library</option>
1342 <option value="not_allowed">No holds allowed</option>
1346 <select name="hold_fulfillment_policy">
1347 <option value="any">
1351 <option value="holdgroup">
1355 <option value="patrongroup">
1359 <option value="homebranch">
1363 <option value="holdingbranch">
1364 item's holding library
1369 <select name="returnbranch">
1370 <option value="homebranch">Item returns home</option>
1371 <option value="holdingbranch">Item returns to issuing library</option>
1372 <option value="noreturn">Item floats</option>
1375 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1381 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1383 <div class="col-sm-2 col-sm-pull-10">
1385 [% INCLUDE 'admin-menu.inc' %]
1387 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1388 </div> <!-- /.row -->
1390 [% MACRO jsinclude BLOCK %]
1391 [% Asset.js("js/admin-menu.js") | $raw %]
1392 [% INCLUDE 'datatables.inc' %]
1393 [% INCLUDE 'calendar.inc' %]
1394 [% INCLUDE 'columns_settings.inc' %]
1395 [% INCLUDE 'format_price.inc' %]
1397 $(document).ready(function() {
1398 KohaTable("default-circulation-rules", {
1400 { "bVisible": false, "aTargets": [ 0,2 ] },
1401 { "bSortable": false, "aTargets": ["_all"] }
1403 "aaSortingFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
1409 function clear_edit(){
1410 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
1411 if ( !cancel ) return;
1412 $('#default-circulation-rules td').removeClass('highlighted-row');
1413 var edit_row = $("#edit_row");
1414 $(edit_row).find("input").each(function(){
1415 var type = $(this).attr("type");
1416 if (type != "button" && type != "submit" ) {
1418 $(this).prop('disabled', false);
1420 if ( type == "checkbox" ) {
1421 $(this).prop('checked', false);
1424 $(edit_row).find("select").prop('disabled', false);
1425 $(edit_row).find("select option:first-child").attr("selected", "selected");
1426 $(edit_row).find("td:last input[name='clear']").remove();
1429 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1431 $(document).ready(function() {
1432 $('[data-toggle="popover"]').popover();
1434 $(".delete").on("click",function(){
1435 return confirmDelete(MSG_CONFIRM_DELETE);
1438 $("#clone_rules").on("click",function(){
1439 var library_dropdown = document.getElementById("branch");
1440 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
1441 var selected_library_text = $("#branch option:selected").text();
1442 var to_library = $("#tobranch option:selected").text();
1443 var MSG_CONFIRM_CLONE;
1444 if (selected_library === "*") {
1445 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);
1446 return confirmClone(MSG_CONFIRM_CLONE);
1448 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);
1449 return confirmClone(MSG_CONFIRM_CLONE);
1453 $('#selectlibrary').find("input:submit").hide();
1454 $('#branch').change(function() {
1455 $('#selectlibrary').submit();
1457 $(".editrule").click(function(){
1458 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
1459 var edit = confirm(_("Are you sure you want to edit another rule?"));
1460 if (!edit) return false;
1462 $('#default-circulation-rules td').removeClass('highlighted-row');
1463 $(this).parent().parent().find("td").each(function (i) {
1464 $(this).addClass('highlighted-row');
1465 itm_code = $(this).data('code');
1466 itm_text = $(this).text();
1467 itm_text = itm_text.replace(/^\s*|\s*$/g,'');
1468 var current_column = $("#edit_row td:eq("+i+")");
1470 // specific processing for the Note column
1471 var note = $(this).find("a[name='viewnote']").data("content");
1472 $(current_column).find("input[type='text']").val(note);
1473 } else if ( i == 9 ) {
1474 // specific processing for the Hard due date column
1475 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1476 var input_value = '';
1477 if (typeof select_value === 'undefined'){
1478 select_value = '-1';
1480 input_value = itm_text.split(' ')[1];
1482 $(current_column).find("input[type='text']").val(input_value);
1483 $(current_column).find("select").val(select_value);
1484 } else if ( i == 16 ) {
1485 // specific processing for cap_fine_to_replacement_price
1486 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1487 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1488 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1490 $(current_column).find("input[type='text']").val(itm_text);
1492 $(current_column).find("input[inputmode='decimal']").each(function() {
1493 $(this).val(itm_text.unformat_price());
1495 // select the corresponding option
1496 $(current_column).find("select option").each(function(){
1497 opt = $(this).attr('value');
1498 if ( opt == itm_code ) {
1499 $(this).attr('selected', 'selected');
1502 if ( i == 0 || i == 1 ) {
1503 // Disable the 2 first columns, we cannot update them.
1504 var val = $(current_column).find("select option:selected").val();
1505 var name = "categorycode";
1509 // Remove potential previous input added
1510 $(current_column).find("input").remove();
1511 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1512 } else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 ) {
1513 // If the value is not an integer for
1514 // - "Current checkouts allowed"
1515 // - "Current on-site checkouts allowed"
1516 // - "Holds allowed (total)"
1517 // - "Holds allowed (daily)"
1518 // - "Holds per record (count)"
1519 // The value is "Unlimited" (or an equivalent translated string)
1520 // an it should be set to an empty string
1521 if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) {
1522 $(current_column).find("input[type='text']").val("");
1527 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1528 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1531 $(".clear_edit").on("click",function(e){
1536 $("#set-article-requests-daily-limit").on("submit", function(){
1537 if (! $("input[name='open_article_requests_limit'").val().length){
1538 alert("Please set a daily limit for this patron's category");
1544 $("#set-article-request-fee").on("submit", function(){
1545 if (! $("input[name='article_request_fee'").val().length){
1546 alert("Please set a valid value for the fee");
1554 [% INCLUDE 'intranet-bottom.inc' %]