4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Administration › Circulation and fine rules</title>
6 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="admin_smart-rules" class="admin">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'prefs-admin-search.inc' %]
13 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Circulation and fine rules</div>
15 <div id="doc3" class="yui-t1">
20 <h1 class="parameters">
22 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
24 Defining circulation and fine rules for all libraries
28 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
30 <li>same library, same patron category, same item type</li>
31 <li>same library, same patron category, all item types</li>
32 <li>same library, all patron categories, same item type</li>
33 <li>same library, all patron categories, all item types</li>
34 <li>default (all libraries), same patron category, same item type</li>
35 <li>default (all libraries), same patron category, all item types</li>
36 <li>default (all libraries), all patron categories, same item type</li>
37 <li>default (all libraries), all patron categories, all item types</li>
39 <p>To modify a rule, create a new one with the same patron category and item type.</p>
42 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
44 <select name="branch" id="branch" style="width:20em;">
45 <option value="*">Standard rules for all libraries</option>
46 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
49 [% IF ( definedbranch ) %]
50 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
51 <label for="tobranch"><strong>Clone these rules to:</strong></label>
52 <input type="hidden" name="frombranch" value="[% current_branch %]" />
53 <select name="tobranch" id="tobranch">
54 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
56 <input type="submit" id="clone_rules" value="Clone" />
60 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
61 <input type="hidden" name="op" value="add" />
62 <input type="hidden" name="branch" value="[% current_branch %]"/>
63 <table id="default-circulation-rules">
66 <th>Patron category</th>
69 <th>Current checkouts allowed</th>
70 <th>Current on-site checkouts allowed</th>
73 <th>Hard due date</th>
75 <th>Fine charging interval</th>
76 <th>When to charge</th>
77 <th>Fine grace period</th>
78 <th>Overdue fines cap (amount)</th>
79 <th>Cap fine at replacement price</th>
80 <th>Suspension in days (day)</th>
81 <th>Max. suspension duration (day)</th>
82 <th>Suspension charging interval</th>
83 <th>Renewals allowed (count)</th>
84 <th>Renewal period</th>
85 <th>No renewal before</th>
86 <th>Automatic renewal</th>
87 <th>No automatic renewal after</th>
88 <th>No automatic renewal after (hard limit)</th>
89 <th>Holds allowed (count)</th>
90 <th>Holds per record (count)</th>
91 <th>On shelf holds allowed</th>
92 <th>Item level holds</th>
93 <th>Article requests</th>
94 <th>Rental discount (%)</th>
99 [% FOREACH rule IN rules %]
100 <tr id="row_[% loop.count %]">
101 <td>[% IF ( rule.default_humancategorycode ) %]
104 [% rule.humancategorycode %]
107 <td>[% IF rule.default_translated_description %]
110 [% rule.translated_description %]
114 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
115 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
118 <td>[% IF ( rule.unlimited_maxissueqty ) %]
119 <span>Unlimited</span>
121 [% rule.maxissueqty %]
124 <td>[% IF rule.unlimited_maxonsiteissueqty %]
125 <span>Unlimited</span>
127 [% rule.maxonsiteissueqty %]
130 <td>[% rule.issuelength %]</td>
132 [% rule.lengthunit %]
135 [% IF ( rule.hardduedate ) %]
136 [% IF ( rule.hardduedatebefore ) %]
137 before [% rule.hardduedate %]
138 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
139 [% ELSIF ( rule.hardduedateexact ) %]
140 on [% rule.hardduedate %]
141 <input type="hidden" name="hardduedatecomparebackup" value="0" />
142 [% ELSIF ( rule.hardduedateafter ) %]
143 after [% rule.hardduedate %]
144 <input type="hidden" name="hardduedatecomparebackup" value="1" />
147 <span>None defined</span>
150 <td>[% rule.fine %]</td>
151 <td>[% rule.chargeperiod %]</td>
153 [% IF rule.chargeperiod_charge_at %]
154 <span>Start of interval</span>
156 <span>End of interval</span>
159 <td>[% rule.firstremind %]</td>
160 <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
162 [% IF rule.cap_fine_to_replacement_price %]
163 <input type="checkbox" checked="checked" disabled="disabled" />
165 <input type="checkbox" disabled="disabled" />
168 <td>[% rule.finedays %]</td>
169 <td>[% rule.maxsuspensiondays %]</td>
170 <td>[% rule.suspension_chargeperiod %]</td>
171 <td>[% rule.renewalsallowed %]</td>
172 <td>[% rule.renewalperiod %]</td>
173 <td>[% rule.norenewalbefore %]</td>
175 [% IF ( rule.auto_renew ) %]
181 <td>[% rule.no_auto_renewal_after %]</td>
182 <td>[% rule.no_auto_renewal_after_hard_limit %]</td>
183 <td>[% rule.reservesallowed %]</td>
184 <td>[% rule.holds_per_record %]</td>
186 [% IF rule.onshelfholds == 1 %]
188 [% ELSIF rule.onshelfholds == 2 %]
189 <span>If all unavailable</span>
191 <span>If any unavailable</span>
195 [% IF rule.opacitemholds == 'F'%]
197 [% ELSIF rule.opacitemholds == 'Y'%]
200 <span>Don't allow</span>
204 [% IF rule.article_requests == 'no' %]
206 [% ELSIF rule.article_requests == 'yes' %]
208 [% ELSIF rule.article_requests == 'bib_only' %]
209 <span>Record only</span>
210 [% ELSIF rule.article_requests == 'item_only' %]
211 <span>Item only</span>
214 <td>[% rule.rentaldiscount %]</td>
216 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
217 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
224 <select name="categorycode" id="categorycode">
225 <option value="*">All</option>
226 [% FOREACH patron_category IN patron_categories%]
227 <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
232 <select name="itemtype" id="matrixitemtype" style="width:13em;">
233 <option value="*">All</option>
234 [% FOREACH itemtypeloo IN itemtypeloop %]
235 <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
240 <input type="hidden" name="branch" value="[% current_branch %]"/>
241 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
242 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
244 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
245 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
246 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
248 <select name="lengthunit" id="lengthunit">
249 <option value="days" selected="selected">Days</option>
250 <option value="hours">Hours</option>
254 <select name="hardduedatecompare" id="hardduedatecompare">
255 <option value="-1">Before</option>
256 <option value="0">Exactly on</option>
257 <option value="1">After</option>
259 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" class="datepicker" />
260 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
262 <td><input type="text" name="fine" id="fine" size="4" /></td>
263 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
265 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
266 <option value="0">End of interval</option>
267 <option value="1">Start of interval</option>
270 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
271 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
272 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
273 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
274 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
275 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
276 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
277 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
278 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
280 <select name="auto_renew" id="auto_renew">
281 <option value="no" selected>No</option>
282 <option value="yes">Yes</option>
285 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
287 <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 %]" class="datepicker"/>
288 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
290 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
291 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
293 <select name="onshelfholds" id="onshelfholds">
294 <option value="1">Yes</option>
295 <option value="0">If any unavailable</option>
296 <option value="2">If all unavailable</option>
300 <select id="opacitemholds" name="opacitemholds">
301 <option value="N">Don't allow</option>
302 <option value="Y">Allow</option>
303 <option value="F">Force</option>
307 <select id="article_requests" name="article_requests">
308 <option value="no">No</option>
309 <option value="yes">Yes</option>
310 <option value="bib_only">Record only</option>
311 <option value="item_only">Item only</option>
314 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
316 <input type="hidden" name="branch" value="[% current_branch %]"/>
317 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
318 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
323 <th>Patron category</th>
326 <th>Current checkouts allowed</th>
327 <th>Current on-site checkouts allowed</th>
330 <th>Hard due date</th>
332 <th>Fine charging interval</th>
333 <th>Charge when?</th>
334 <th>Fine grace period</th>
335 <th>Overdue fines cap (amount)</th>
336 <th>Cap fine at replacement price</th>
337 <th>Suspension in days (day)</th>
338 <th>Max. suspension duration (day)</th>
339 <th>Suspension charging interval</th>
340 <th>Renewals allowed (count)</th>
341 <th>Renewal period</th>
342 <th>No renewal before</th>
343 <th>Automatic renewal</th>
344 <th>No automatic renewal after</th>
345 <th>No automatic renewal after (hard limit)</th>
346 <th>Holds allowed (count)</th>
347 <th>Holds per record (count)</th>
348 <th>On shelf holds allowed</th>
349 <th>Item level holds</th>
350 <th>Article requests</th>
351 <th>Rental discount (%)</th>
359 <div id="defaults-for-this-library" class="container">
360 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
361 <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>
362 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
363 <input type="hidden" name="op" value="set-branch-defaults" />
364 <input type="hidden" name="branch" value="[% current_branch %]"/>
368 <th>Total current checkouts allowed</th>
369 <th>Total current on-site checkouts allowed</th>
371 <th>Hold pickup library match</th>
372 <th>Return policy</th>
376 <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
377 <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
378 <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
380 <select name="holdallowed">
381 [% IF ( default_holdallowed_any ) %]
382 <option value="2" selected="selected">
388 [% IF ( default_holdallowed_same ) %]
389 <option value="1" selected="selected">
395 [% IF ( default_holdallowed_none ) %]
396 <option value="0" selected="selected">
405 <select name="hold_fulfillment_policy">
406 [% IF default_hold_fulfillment_policy == 'any' %]
407 <option value="any" selected="selected">
416 [% IF default_hold_fulfillment_policy == 'homebranch' %]
417 <option value="homebranch" selected="selected">
421 <option value="homebranch">
426 [% IF default_hold_fulfillment_policy == 'holdingbranch' %]
427 <option value="holdingbranch" selected="selected">
428 item's holding library
431 <option value="holdingbranch">
432 item's holding library
438 <select name="returnbranch">
439 [% IF ( default_returnbranch == 'homebranch' ) %]
440 <option value="homebranch" selected="selected">
442 <option value="homebranch">
446 [% IF ( default_returnbranch == 'holdingbranch' ) %]
447 <option value="holdingbranch" selected="selected">
449 <option value="holdingbranch">
451 Item returns to issuing library
453 [% IF ( default_returnbranch == 'noreturn' ) %]
454 <option value="noreturn" selected="selected">
456 <option value="noreturn">
463 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
464 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=*&branch=[% current_branch %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
470 [% IF ( show_branch_cat_rule_form ) %]
471 <div id="holds-policy-by-patron-category" class="container">
472 <h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit by patron category[% END %]</h3>
473 <p>For this library, you can specify the maximum number of loans that
474 a patron of a given category can make, regardless of the item type.
476 <p>If the total amount loanable for a given patron category is left blank,
477 no limit applies, except possibly for a limit you define for a specific item type.
479 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
480 <input type="hidden" name="op" value="add-branch-cat" />
481 <input type="hidden" name="branch" value="[% current_branch %]"/>
484 <th>Patron category</th>
485 <th>Total current checkouts allowed</th>
486 <th>Total current on-site checkouts allowed</th>
489 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
490 [% UNLESS ( loop.odd ) %]
491 <tr class="highlight">
495 <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
498 [% branch_cat_rule_loo.humancategorycode %]
501 <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
502 <span>Unlimited</span>
504 [% branch_cat_rule_loo.maxissueqty %]
507 <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
508 <span>Unlimited</span>
510 [% branch_cat_rule_loo.maxonsiteissueqty %]
515 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% branch_cat_rule_loo.categorycode %]&branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
521 <select name="categorycode">
522 [% FOREACH patron_category IN patron_categories%]
523 <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
527 <td><input name="maxissueqty" size="3" /></td>
528 <td><input name="maxonsiteissueqty" size="3" /></td>
529 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
536 <div id="refund-lost-item-fee-on-return" class="container">
537 [% IF current_branch == '*' %]
538 <h3>Default lost item fee refund on return policy</h3>
540 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) %]</h3>
542 <p>Specify the default policy for lost item fees on return.
544 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
545 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
546 <input type="hidden" name="branch" value="[% current_branch %]" />
549 <th>Refund lost item fee</th>
554 <select name="refund">
555 [#% Default branch %#]
556 [% IF ( current_branch == '*' ) %]
557 [% IF ( refundLostItemFeeRule.refund ) %]
558 <option value="1" selected="selected">
564 [% IF ( not refundLostItemFeeRule.refund ) %]
565 <option value="0" selected="selected">
572 [#% Branch-specific %#]
573 [% IF ( not refundLostItemFeeRule ) %]
574 <option value="*" selected="selected">
578 [% IF defaultRefundRule %]
584 [% IF ( not refundLostItemFeeRule ) %]
585 <option value="1">Yes</option>
586 <option value="0">No</option>
588 [% IF ( refundLostItemFeeRule.refund ) %]
589 <option value="1" selected="selected">
595 [% IF ( not refundLostItemFeeRule.refund ) %]
596 <option value="0" selected="selected">
607 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
615 <div id="holds-policy-by-item-type" class="container">
616 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) %][% ELSE %]Default holds policy by item type[% END %]</h3>
618 For this library, you can edit rules for given itemtypes, regardless
619 of the patron's category.
622 Currently, this means hold policies.
623 The various policies have the following effects:
626 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
627 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
628 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
630 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
631 <strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
634 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
635 <input type="hidden" name="op" value="add-branch-item" />
636 <input type="hidden" name="branch" value="[% current_branch %]"/>
641 <th>Hold pickup library match</th>
642 <th>Return policy</th>
645 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
646 [% UNLESS ( loop.odd ) %]
647 <tr class="highlight">
651 <td>[% IF ( branch_item_rule_loo.default_translated_description ) %]
654 [% branch_item_rule_loo.translated_description %]
657 <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
658 <span>From any library</span>
659 [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
660 <span>From home library</span>
662 <span>No holds allowed</span>
665 <td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
666 <span>any library</span>
667 [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
668 <span>item's home library</span>
669 [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
670 <span>item's holding library</span>
673 <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
674 <span>Item returns home</span>
675 [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
676 <span>Item returns to issuing branch</span>
677 [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
678 <span>Item floats</span>
680 <span>Error - unknown option</span>
684 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&itemtype=[% branch_item_rule_loo.itemtype %]&branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
690 <select name="itemtype">
691 [% FOREACH itemtypeloo IN itemtypeloop %]
692 <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
697 <select name="holdallowed">
698 <option value="2">From any library</option>
699 <option value="1">From home library</option>
700 <option value="0">No holds allowed</option>
704 <select name="hold_fulfillment_policy">
709 <option value="homebranch">
713 <option value="holdingbranch">
714 item's holding library
719 <select name="returnbranch">
720 <option value="homebranch">Item returns home</option>
721 <option value="holdingbranch">Item returns to issuing library</option>
722 <option value="noreturn">Item floats</option>
725 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
734 [% INCLUDE 'admin-menu.inc' %]
738 [% MACRO jsinclude BLOCK %]
739 [% Asset.js("js/admin-menu.js") %]
740 [% INCLUDE 'calendar.inc' %]
741 <script type="text/javascript">
743 function clear_edit(){
744 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
745 if ( !cancel ) return;
746 $('#default-circulation-rules td').removeClass('highlighted-row');
747 var edit_row = $("#edit_row");
748 $(edit_row).find("input").each(function(){
749 var type = $(this).attr("type");
750 if (type != "button" && type != "submit" ) {
752 $(this).prop('disabled', false);
754 if ( type == "checkbox" ) {
755 $(this).prop('checked', false);
758 $(edit_row).find("select").prop('disabled', false);
759 $(edit_row).find("select option:first").attr("selected", "selected");
760 $(edit_row).find("td:last input[name='clear']").remove();
763 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
765 $(document).ready(function() {
766 $(".delete").on("click",function(){
767 return confirmDelete(MSG_CONFIRM_DELETE);
770 $("#clone_rules").on("click",function(){
771 var library_dropdown = document.getElementById("branch");
772 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
773 var selected_library_text = $("#branch option:selected").text();
774 var to_library = $("#tobranch option:selected").text();
775 var MSG_CONFIRM_CLONE;
776 if (selected_library === "*") {
777 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);
778 return confirmClone(MSG_CONFIRM_CLONE);
780 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);
781 return confirmClone(MSG_CONFIRM_CLONE);
785 $('#cap_fine_to_replacement_price').on('change', function(){
786 $('#overduefinescap').prop('disabled', $(this).is(':checked') );
788 $('#selectlibrary').find("input:submit").hide();
789 $('#branch').change(function() {
790 $('#selectlibrary').submit();
792 $(".editrule").click(function(){
793 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
794 var edit = confirm(_("Are you sure you want to edit another rule?"));
795 if (!edit) return false;
797 $('#default-circulation-rules td').removeClass('highlighted-row');
798 $(this).parent().parent().find("td").each(function (i) {
799 $(this).addClass('highlighted-row');
800 itm = $(this).text();
801 itm = itm.replace(/^\s*|\s*$/g,'');
802 var current_column = $("#edit_row td:eq("+i+")");
804 // specific processing for the Hard due date column
805 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
806 var input_value = '';
807 if (typeof select_value === 'undefined'){
810 input_value = itm.split(' ')[1];
812 $(current_column).find("input[type='text']").val(input_value);
813 $(current_column).find("select").val(select_value);
814 } else if ( i == 13 ) {
815 // specific processing for cap_fine_to_replacement_price
816 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
817 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
818 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
820 $(current_column).find("input[type='text']").val(itm);
821 // select the corresponding option
822 $(current_column).find("select option").each(function(){
823 opt = $(this).text().toLowerCase();
824 opt = opt.replace(/^\s*|\s*$/g,'');
825 if ( opt == itm.toLowerCase() ) {
826 $(this).attr('selected', 'selected');
829 if ( i == 0 || i == 1 ) {
830 // Disable the 2 first columns, we cannot update them.
831 var val = $(current_column).find("select option:selected").val();
832 var name = "categorycode";
836 // Remove potential previous input added
837 $(current_column).find("input").remove();
838 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
839 } else if ( i == 3 || i == 4 ) {
840 // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
841 // The value is "Unlimited" (or an equivalent translated string)
842 // an it should be set to an empty string
843 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
844 $(current_column).find("input[type='text']").val("");
849 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
850 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
853 $(".clear_edit").on("click",function(e){
860 [% INCLUDE 'intranet-bottom.inc' %]