4 [% USE CirculationRules %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Administration › Circulation and fine rules</title>
8 [% INCLUDE 'doc-head-close.inc' %]
11 <body id="admin_smart-rules" class="admin">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'prefs-admin-search.inc' %]
15 <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>
17 <div class="main container-fluid">
19 <div class="col-sm-10 col-sm-push-2">
22 <h1 class="parameters">
24 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
26 Defining circulation and fine rules for all libraries
30 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
32 <li>same library, same patron category, same item type</li>
33 <li>same library, same patron category, all item types</li>
34 <li>same library, all patron categories, same item type</li>
35 <li>same library, all patron categories, all item types</li>
36 <li>default (all libraries), same patron category, same item type</li>
37 <li>default (all libraries), same patron category, all item types</li>
38 <li>default (all libraries), all patron categories, same item type</li>
39 <li>default (all libraries), all patron categories, all item types</li>
41 <p>To modify a rule, create a new one with the same patron category and item type.</p>
44 [% UNLESS restricted_to_own_library %]
45 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
47 <select name="branch" id="branch" style="width:20em;">
48 <option value="*">Standard rules for all libraries</option>
49 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
52 [% IF ( definedbranch ) %]
53 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
54 <label for="tobranch"><strong>Clone these rules to:</strong></label>
55 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
56 <select name="tobranch" id="tobranch">
57 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
59 <input type="submit" id="clone_rules" value="Clone" />
64 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
65 <input type="hidden" name="op" value="add" />
66 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
67 <table id="default-circulation-rules">
70 <th>Patron category</th>
73 <th>Current checkouts allowed</th>
74 <th>Current on-site checkouts allowed</th>
77 <th>Hard due date</th>
79 <th>Fine charging interval</th>
80 <th>When to charge</th>
81 <th>Fine grace period</th>
82 <th>Overdue fines cap (amount)</th>
83 <th>Cap fine at replacement price</th>
84 <th>Suspension in days (day)</th>
85 <th>Max. suspension duration (day)</th>
86 <th>Suspension charging interval</th>
87 <th>Renewals allowed (count)</th>
88 <th>Renewal period</th>
89 <th>No renewal before</th>
90 <th>Automatic renewal</th>
91 <th>No automatic renewal after</th>
92 <th>No automatic renewal after (hard limit)</th>
93 <th>Holds allowed (count)</th>
94 <th>Holds per record (count)</th>
95 <th>On shelf holds allowed</th>
96 <th>Item level holds</th>
97 <th>Article requests</th>
98 <th>Rental discount (%)</th>
103 [% FOREACH rule IN rules %]
104 <tr id="row_[% loop.count | html %]">
105 <td>[% IF ( rule.default_humancategorycode ) %]
108 [% rule.humancategorycode | html %]
111 <td>[% IF rule.default_translated_description %]
114 [% rule.translated_description | html %]
118 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
119 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype | html %]&categorycode=[% rule.categorycode | html %]&branch=[% rule.current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
122 <td>[% IF ( rule.unlimited_maxissueqty ) %]
123 <span>Unlimited</span>
125 [% rule.maxissueqty | html %]
128 <td>[% IF rule.unlimited_maxonsiteissueqty %]
129 <span>Unlimited</span>
131 [% rule.maxonsiteissueqty | html %]
134 <td>[% rule.issuelength | html %]</td>
136 [% rule.lengthunit | html %]
139 [% IF ( rule.hardduedate ) %]
140 [% IF ( rule.hardduedatebefore ) %]
141 before [% rule.hardduedate | html %]
142 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
143 [% ELSIF ( rule.hardduedateexact ) %]
144 on [% rule.hardduedate | html %]
145 <input type="hidden" name="hardduedatecomparebackup" value="0" />
146 [% ELSIF ( rule.hardduedateafter ) %]
147 after [% rule.hardduedate | html %]
148 <input type="hidden" name="hardduedatecomparebackup" value="1" />
151 <span>None defined</span>
154 <td>[% rule.fine | html %]</td>
155 <td>[% rule.chargeperiod | html %]</td>
157 [% IF rule.chargeperiod_charge_at %]
158 <span>Start of interval</span>
160 <span>End of interval</span>
163 <td>[% rule.firstremind | html %]</td>
164 <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
166 [% IF rule.cap_fine_to_replacement_price %]
167 <input type="checkbox" checked="checked" disabled="disabled" />
169 <input type="checkbox" disabled="disabled" />
172 <td>[% rule.finedays | html %]</td>
173 <td>[% rule.maxsuspensiondays | html %]</td>
174 <td>[% rule.suspension_chargeperiod | html %]</td>
175 <td>[% rule.renewalsallowed | html %]</td>
176 <td>[% rule.renewalperiod | html %]</td>
177 <td>[% rule.norenewalbefore | html %]</td>
179 [% IF ( rule.auto_renew ) %]
185 <td>[% rule.no_auto_renewal_after | html %]</td>
186 <td>[% rule.no_auto_renewal_after_hard_limit | html %]</td>
187 <td>[% rule.reservesallowed | html %]</td>
188 <td>[% rule.holds_per_record | html %]</td>
190 [% IF rule.onshelfholds == 1 %]
192 [% ELSIF rule.onshelfholds == 2 %]
193 <span>If all unavailable</span>
195 <span>If any unavailable</span>
199 [% IF rule.opacitemholds == 'F'%]
201 [% ELSIF rule.opacitemholds == 'Y'%]
204 <span>Don't allow</span>
208 [% IF rule.article_requests == 'no' %]
210 [% ELSIF rule.article_requests == 'yes' %]
212 [% ELSIF rule.article_requests == 'bib_only' %]
213 <span>Record only</span>
214 [% ELSIF rule.article_requests == 'item_only' %]
215 <span>Item only</span>
218 <td>[% rule.rentaldiscount | html %]</td>
220 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
221 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype | html %]&categorycode=[% rule.categorycode | html %]&branch=[% rule.current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
228 <select name="categorycode" id="categorycode">
229 <option value="*">All</option>
230 [% FOREACH patron_category IN patron_categories%]
231 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
236 <select name="itemtype" id="matrixitemtype" style="width:13em;">
237 <option value="*">All</option>
238 [% FOREACH itemtypeloo IN itemtypeloop %]
239 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
244 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
245 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
246 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
248 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
249 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
250 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
252 <select name="lengthunit" id="lengthunit">
253 <option value="days" selected="selected">Days</option>
254 <option value="hours">Hours</option>
258 <select name="hardduedatecompare" id="hardduedatecompare">
259 <option value="-1">Before</option>
260 <option value="0">Exactly on</option>
261 <option value="1">After</option>
263 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
264 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
266 <td><input type="text" name="fine" id="fine" size="4" /></td>
267 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
269 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
270 <option value="0">End of interval</option>
271 <option value="1">Start of interval</option>
274 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
275 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
276 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
277 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
278 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
279 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
280 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
281 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
282 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
284 <select name="auto_renew" id="auto_renew">
285 <option value="no" selected>No</option>
286 <option value="yes">Yes</option>
289 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
291 <input type="text" size="10" name="no_auto_renewal_after_hard_limit" id="no_auto_renewal_after_hard_limit" value="[% no_auto_renewal_after_hard_limit | html %]" class="datepicker"/>
292 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
294 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
295 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
297 <select name="onshelfholds" id="onshelfholds">
298 <option value="1">Yes</option>
299 <option value="0">If any unavailable</option>
300 <option value="2">If all unavailable</option>
304 <select id="opacitemholds" name="opacitemholds">
305 <option value="N">Don't allow</option>
306 <option value="Y">Allow</option>
307 <option value="F">Force</option>
311 <select id="article_requests" name="article_requests">
312 <option value="no">No</option>
313 <option value="yes">Yes</option>
314 <option value="bib_only">Record only</option>
315 <option value="item_only">Item only</option>
318 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
320 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
321 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
322 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
327 <th>Patron category</th>
330 <th>Current checkouts allowed</th>
331 <th>Current on-site checkouts allowed</th>
334 <th>Hard due date</th>
336 <th>Fine charging interval</th>
337 <th>Charge when?</th>
338 <th>Fine grace period</th>
339 <th>Overdue fines cap (amount)</th>
340 <th>Cap fine at replacement price</th>
341 <th>Suspension in days (day)</th>
342 <th>Max. suspension duration (day)</th>
343 <th>Suspension charging interval</th>
344 <th>Renewals allowed (count)</th>
345 <th>Renewal period</th>
346 <th>No renewal before</th>
347 <th>Automatic renewal</th>
348 <th>No automatic renewal after</th>
349 <th>No automatic renewal after (hard limit)</th>
350 <th>Holds allowed (count)</th>
351 <th>Holds per record (count)</th>
352 <th>On shelf holds allowed</th>
353 <th>Item level holds</th>
354 <th>Article requests</th>
355 <th>Rental discount (%)</th>
363 <div id="defaults-for-this-library" class="container">
364 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
365 <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>
366 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
367 <input type="hidden" name="op" value="set-branch-defaults" />
368 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
372 <th>Total current checkouts allowed</th>
373 <th>Total current on-site checkouts allowed</th>
374 <th>Maximum total holds allowed (count)</th>
376 <th>Hold pickup library match</th>
377 <th>Return policy</th>
381 <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
382 <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty | html %]"/></td>
383 <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty | html %]"/></td>
385 [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
386 <input name="max_holds" size="3" value="[% rule_value | html %]" />
389 <select name="holdallowed">
390 [% IF ( default_holdallowed_any ) %]
391 <option value="2" selected="selected">
397 [% IF ( default_holdallowed_same ) %]
398 <option value="1" selected="selected">
404 [% IF ( default_holdallowed_none ) %]
405 <option value="0" selected="selected">
414 <select name="hold_fulfillment_policy">
415 [% IF default_hold_fulfillment_policy == 'any' %]
416 <option value="any" selected="selected">
425 [% IF default_hold_fulfillment_policy == 'homebranch' %]
426 <option value="homebranch" selected="selected">
430 <option value="homebranch">
435 [% IF default_hold_fulfillment_policy == 'holdingbranch' %]
436 <option value="holdingbranch" selected="selected">
437 item's holding library
440 <option value="holdingbranch">
441 item's holding library
447 <select name="returnbranch">
448 [% IF ( default_returnbranch == 'homebranch' ) %]
449 <option value="homebranch" selected="selected">
451 <option value="homebranch">
455 [% IF ( default_returnbranch == 'holdingbranch' ) %]
456 <option value="holdingbranch" selected="selected">
458 <option value="holdingbranch">
460 Item returns to issuing library
462 [% IF ( default_returnbranch == 'noreturn' ) %]
463 <option value="noreturn" selected="selected">
465 <option value="noreturn">
472 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
473 <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>
479 [% IF ( show_branch_cat_rule_form ) %]
480 <div id="holds-policy-by-patron-category" class="container">
481 <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
482 <p>For this library, you can specify the maximum number of loans that
483 a patron of a given category can make, regardless of the item type.
485 <p>If the total amount loanable for a given patron category is left blank,
486 no limit applies, except possibly for a limit you define for a specific item type.
488 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
489 <input type="hidden" name="op" value="add-branch-cat" />
490 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
493 <th>Patron category</th>
494 <th>Total current checkouts allowed</th>
495 <th>Total current on-site checkouts allowed</th>
496 <th>Total holds allowed</th>
499 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
500 [% UNLESS ( loop.odd ) %]
501 <tr class="highlight">
505 <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
508 [% branch_cat_rule_loo.humancategorycode | html %]
511 <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
512 <span>Unlimited</span>
514 [% branch_cat_rule_loo.maxissueqty | html %]
517 <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
518 <span>Unlimited</span>
520 [% branch_cat_rule_loo.maxonsiteissueqty | html %]
524 [% SET rule_value = CirculationRules.Get( branch_cat_rule_loo.branchcode || '*', branch_cat_rule_loo.categorycode, branch_cat_rule_loo.itemtype, 'max_holds' ) %]
525 [% IF rule_value.defined && rule_value != '' %]
526 [% rule_value | html %]
533 <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 | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
539 <select name="categorycode">
540 [% FOREACH patron_category IN patron_categories%]
541 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
545 <td><input name="maxissueqty" size="3" type="text" /></td>
546 <td><input name="maxonsiteissueqty" size="3" type="text" /></td>
547 <td><input name="max_holds" size="3" type="text" /></td>
548 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
555 <div id="refund-lost-item-fee-on-return" class="container">
556 [% IF current_branch == '*' %]
557 <h3>Default lost item fee refund on return policy</h3>
559 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
561 <p>Specify the default policy for lost item fees on return.
563 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
564 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
565 <input type="hidden" name="branch" value="[% current_branch | html %]" />
568 <th>Refund lost item fee</th>
573 <select name="refund">
574 [#% Default branch %#]
575 [% IF ( current_branch == '*' ) %]
576 [% IF ( refundLostItemFeeRule.refund ) %]
577 <option value="1" selected="selected">
583 [% IF ( not refundLostItemFeeRule.refund ) %]
584 <option value="0" selected="selected">
591 [#% Branch-specific %#]
592 [% IF ( not refundLostItemFeeRule ) %]
593 <option value="*" selected="selected">
597 [% IF defaultRefundRule %]
603 [% IF ( not refundLostItemFeeRule ) %]
604 <option value="1">Yes</option>
605 <option value="0">No</option>
607 [% IF ( refundLostItemFeeRule.refund ) %]
608 <option value="1" selected="selected">
614 [% IF ( not refundLostItemFeeRule.refund ) %]
615 <option value="0" selected="selected">
626 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
634 <div id="holds-policy-by-item-type" class="container">
635 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
637 For this library, you can edit rules for given itemtypes, regardless
638 of the patron's category.
641 Currently, this means hold policies.
642 The various policies have the following effects:
645 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
646 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
647 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
649 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
650 <strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
653 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
654 <input type="hidden" name="op" value="add-branch-item" />
655 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
660 <th>Hold pickup library match</th>
661 <th>Return policy</th>
664 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
665 [% UNLESS ( loop.odd ) %]
666 <tr class="highlight">
670 <td>[% IF ( branch_item_rule_loo.default_translated_description ) %]
673 [% branch_item_rule_loo.translated_description | html %]
676 <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
677 <span>From any library</span>
678 [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
679 <span>From home library</span>
681 <span>No holds allowed</span>
684 <td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
685 <span>any library</span>
686 [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
687 <span>item's home library</span>
688 [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
689 <span>item's holding library</span>
692 <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
693 <span>Item returns home</span>
694 [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
695 <span>Item returns to issuing branch</span>
696 [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
697 <span>Item floats</span>
699 <span>Error - unknown option</span>
703 <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 | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
709 <select name="itemtype">
710 [% FOREACH itemtypeloo IN itemtypeloop %]
711 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
716 <select name="holdallowed">
717 <option value="2">From any library</option>
718 <option value="1">From home library</option>
719 <option value="0">No holds allowed</option>
723 <select name="hold_fulfillment_policy">
728 <option value="homebranch">
732 <option value="holdingbranch">
733 item's holding library
738 <select name="returnbranch">
739 <option value="homebranch">Item returns home</option>
740 <option value="holdingbranch">Item returns to issuing library</option>
741 <option value="noreturn">Item floats</option>
744 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
750 </div> <!-- /.col-sm-10.col-sm-push-2 -->
752 <div class="col-sm-2 col-sm-pull-10">
754 [% INCLUDE 'admin-menu.inc' %]
756 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
757 </div> <!-- /.row -->
759 [% MACRO jsinclude BLOCK %]
760 [% Asset.js("js/admin-menu.js") | $raw %]
761 [% INCLUDE 'calendar.inc' %]
764 function clear_edit(){
765 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
766 if ( !cancel ) return;
767 $('#default-circulation-rules td').removeClass('highlighted-row');
768 var edit_row = $("#edit_row");
769 $(edit_row).find("input").each(function(){
770 var type = $(this).attr("type");
771 if (type != "button" && type != "submit" ) {
773 $(this).prop('disabled', false);
775 if ( type == "checkbox" ) {
776 $(this).prop('checked', false);
779 $(edit_row).find("select").prop('disabled', false);
780 $(edit_row).find("select option:first").attr("selected", "selected");
781 $(edit_row).find("td:last input[name='clear']").remove();
784 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
786 $(document).ready(function() {
787 $(".delete").on("click",function(){
788 return confirmDelete(MSG_CONFIRM_DELETE);
791 $("#clone_rules").on("click",function(){
792 var library_dropdown = document.getElementById("branch");
793 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
794 var selected_library_text = $("#branch option:selected").text();
795 var to_library = $("#tobranch option:selected").text();
796 var MSG_CONFIRM_CLONE;
797 if (selected_library === "*") {
798 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);
799 return confirmClone(MSG_CONFIRM_CLONE);
801 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);
802 return confirmClone(MSG_CONFIRM_CLONE);
806 $('#cap_fine_to_replacement_price').on('change', function(){
807 $('#overduefinescap').prop('disabled', $(this).is(':checked') );
809 $('#selectlibrary').find("input:submit").hide();
810 $('#branch').change(function() {
811 $('#selectlibrary').submit();
813 $(".editrule").click(function(){
814 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
815 var edit = confirm(_("Are you sure you want to edit another rule?"));
816 if (!edit) return false;
818 $('#default-circulation-rules td').removeClass('highlighted-row');
819 $(this).parent().parent().find("td").each(function (i) {
820 $(this).addClass('highlighted-row');
821 itm = $(this).text();
822 itm = itm.replace(/^\s*|\s*$/g,'');
823 var current_column = $("#edit_row td:eq("+i+")");
825 // specific processing for the Hard due date column
826 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
827 var input_value = '';
828 if (typeof select_value === 'undefined'){
831 input_value = itm.split(' ')[1];
833 $(current_column).find("input[type='text']").val(input_value);
834 $(current_column).find("select").val(select_value);
835 } else if ( i == 13 ) {
836 // specific processing for cap_fine_to_replacement_price
837 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
838 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
839 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
841 $(current_column).find("input[type='text']").val(itm);
842 // select the corresponding option
843 $(current_column).find("select option").each(function(){
844 opt = $(this).text().toLowerCase();
845 opt = opt.replace(/^\s*|\s*$/g,'');
846 if ( opt == itm.toLowerCase() ) {
847 $(this).attr('selected', 'selected');
850 if ( i == 0 || i == 1 ) {
851 // Disable the 2 first columns, we cannot update them.
852 var val = $(current_column).find("select option:selected").val();
853 var name = "categorycode";
857 // Remove potential previous input added
858 $(current_column).find("input").remove();
859 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
860 } else if ( i == 3 || i == 4 ) {
861 // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
862 // The value is "Unlimited" (or an equivalent translated string)
863 // an it should be set to an empty string
864 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
865 $(current_column).find("input[type='text']").val("");
870 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
871 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
874 $(".clear_edit").on("click",function(e){
881 [% INCLUDE 'intranet-bottom.inc' %]