6 [% USE CirculationRules %]
9 [% SET branchcode = humanbranch %]
11 [% SET categorycodes = ['*'] %]
12 [% FOREACH pc IN patron_categories %]
13 [% categorycodes.push( pc.id ) %]
16 [% INCLUDE 'doc-head-open.inc' %]
17 <title>Koha › Administration › Circulation and fine rules</title>
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="admin_smart-rules" class="admin">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
25 <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>
27 <div class="main container-fluid">
29 <div class="col-sm-10 col-sm-push-2">
32 <h1 class="parameters">
34 Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
36 Defining circulation and fine rules for all libraries
40 <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
42 <li>same library, same patron category, same item type</li>
43 <li>same library, same patron category, all item types</li>
44 <li>same library, all patron categories, same item type</li>
45 <li>same library, all patron categories, all item types</li>
46 <li>default (all libraries), same patron category, same item type</li>
47 <li>default (all libraries), same patron category, all item types</li>
48 <li>default (all libraries), all patron categories, same item type</li>
49 <li>default (all libraries), all patron categories, all item types</li>
51 <p>To modify a rule, create a new one with the same patron category and item type.</p>
54 [% UNLESS restricted_to_own_library %]
55 <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
57 <select name="branch" id="branch" style="width:20em;">
58 <option value="*">Standard rules for all libraries</option>
59 [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
62 [% IF ( definedbranch ) %]
63 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
64 <label for="tobranch"><strong>Clone these rules to:</strong></label>
65 <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
66 <select name="tobranch" id="tobranch">
67 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
69 <input type="submit" id="clone_rules" value="Clone" />
74 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
75 <input type="hidden" name="op" value="add" />
76 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
77 <table id="default-circulation-rules">
80 <th>Patron category</th>
84 <th>Current checkouts allowed</th>
85 <th>Current on-site checkouts allowed</th>
88 <th>Hard due date</th>
90 <th>Fine charging interval</th>
91 <th>When to charge</th>
92 <th>Fine grace period</th>
93 <th>Overdue fines cap (amount)</th>
94 <th>Cap fine at replacement price</th>
95 <th>Suspension in days (day)</th>
96 <th>Max. suspension duration (day)</th>
97 <th>Suspension charging interval</th>
98 <th>Renewals allowed (count)</th>
99 <th>Renewal period</th>
100 <th>No renewal before</th>
101 <th>Automatic renewal</th>
102 <th>No automatic renewal after</th>
103 <th>No automatic renewal after (hard limit)</th>
104 <th>Holds allowed (total)</th>
105 <th>Holds allowed (daily)</th>
106 <th>Holds per record (count)</th>
107 <th>On shelf holds allowed</th>
108 <th>Item level holds</th>
109 <th>Article requests</th>
110 <th>Rental discount (%)</th>
115 [% FOREACH rule IN rules %]
116 <tr id="row_[% loop.count | html %]">
117 <td>[% IF ( rule.default_humancategorycode ) %]
120 [% rule.humancategorycode | html %]
123 <td>[% IF rule.default_translated_description %]
126 [% rule.translated_description | html %]
130 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
131 <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>
136 <a name="viewnote" data-toggle="popover" title="Note" data-content="[% rule.note | html %]" data-placement="top" data-trigger="hover">View note</a>
137 [% ELSE %] [% END %]
140 [% SET rule_value = CirculationRules.Get( rule.branchcode, rule.categorycode, rule.itemtype, 'maxissueqty' ) %]
141 [% IF rule_value || rule_value == "0" %]
142 [% rule_value | html %]
144 <span>Unlimited</span>
148 [% SET rule_value = CirculationRules.Get( rule.branchcode, rule.categorycode, rule.itemtype, 'maxonsiteissueqty' ) %]
149 [% IF rule_value || rule_value == "0" %]
150 [% rule_value | html %]
152 <span>Unlimited</span>
155 <td>[% rule.issuelength | html %]</td>
157 [% IF ( rule.lengthunit == 'days' ) %]
159 [% ELSIF ( rule.lengthunit == 'hours') %]
166 [% IF ( rule.hardduedate ) %]
167 [% IF ( rule.hardduedatebefore ) %]
168 before [% rule.hardduedate | html %]
169 <input type="hidden" name="hardduedatecomparebackup" value="-1" />
170 [% ELSIF ( rule.hardduedateexact ) %]
171 on [% rule.hardduedate | html %]
172 <input type="hidden" name="hardduedatecomparebackup" value="0" />
173 [% ELSIF ( rule.hardduedateafter ) %]
174 after [% rule.hardduedate | html %]
175 <input type="hidden" name="hardduedatecomparebackup" value="1" />
178 <span>None defined</span>
181 <td>[% rule.fine | html %]</td>
182 <td>[% rule.chargeperiod | html %]</td>
184 [% IF rule.chargeperiod_charge_at %]
185 <span>Start of interval</span>
187 <span>End of interval</span>
190 <td>[% rule.firstremind | html %]</td>
191 <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
193 [% IF rule.cap_fine_to_replacement_price %]
194 <input type="checkbox" checked="checked" disabled="disabled" />
196 <input type="checkbox" disabled="disabled" />
199 <td>[% rule.finedays | html %]</td>
200 <td>[% rule.maxsuspensiondays | html %]</td>
201 <td>[% rule.suspension_chargeperiod | html %]</td>
202 <td>[% rule.renewalsallowed | html %]</td>
203 <td>[% rule.renewalperiod | html %]</td>
204 <td>[% rule.norenewalbefore | html %]</td>
206 [% IF ( rule.auto_renew ) %]
212 <td>[% rule.no_auto_renewal_after | html %]</td>
213 <td>[% rule.no_auto_renewal_after_hard_limit | html %]</td>
214 <td>[% rule.reservesallowed | html %]</td>
215 <td>[% IF rule.unlimited_holds_per_day %]
216 <span>Unlimited</span>
218 [% rule.holds_per_day | html %]
221 <td>[% rule.holds_per_record | html %]</td>
223 [% IF rule.onshelfholds == 1 %]
225 [% ELSIF rule.onshelfholds == 2 %]
226 <span>If all unavailable</span>
228 <span>If any unavailable</span>
232 [% IF rule.opacitemholds == 'F'%]
234 [% ELSIF rule.opacitemholds == 'Y'%]
237 <span>Don't allow</span>
241 [% IF rule.article_requests == 'no' %]
243 [% ELSIF rule.article_requests == 'yes' %]
245 [% ELSIF rule.article_requests == 'bib_only' %]
246 <span>Record only</span>
247 [% ELSIF rule.article_requests == 'item_only' %]
248 <span>Item only</span>
251 <td>[% rule.rentaldiscount | html %]</td>
253 <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
254 <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>
261 <select name="categorycode" id="categorycode">
262 <option value="*">All</option>
263 [% FOREACH patron_category IN patron_categories%]
264 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
269 <select name="itemtype" id="matrixitemtype" style="width:13em;">
270 <option value="*">All</option>
271 [% FOREACH itemtypeloo IN itemtypeloop %]
272 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
277 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
278 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
279 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
281 <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
282 <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
283 <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
284 <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
286 <select name="lengthunit" id="lengthunit">
287 <option value="days" selected="selected">Days</option>
288 <option value="hours">Hours</option>
292 <select name="hardduedatecompare" id="hardduedatecompare">
293 <option value="-1">Before</option>
294 <option value="0">Exactly on</option>
295 <option value="1">After</option>
297 <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
298 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
300 <td><input type="text" name="fine" id="fine" size="4" /></td>
301 <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
303 <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
304 <option value="0">End of interval</option>
305 <option value="1">Start of interval</option>
308 <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
309 <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
310 <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
311 <td><input type="text" name="finedays" id="fined" size="3" /> </td>
312 <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
313 <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
314 <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
315 <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
316 <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
318 <select name="auto_renew" id="auto_renew">
319 <option value="no" selected>No</option>
320 <option value="yes">Yes</option>
323 <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
325 <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"/>
326 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
328 <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
329 <td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
330 <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
332 <select name="onshelfholds" id="onshelfholds">
333 <option value="1">Yes</option>
334 <option value="0">If any unavailable</option>
335 <option value="2">If all unavailable</option>
339 <select id="opacitemholds" name="opacitemholds">
340 <option value="N">Don't allow</option>
341 <option value="Y">Allow</option>
342 <option value="F">Force</option>
346 <select id="article_requests" name="article_requests">
347 <option value="no">No</option>
348 <option value="yes">Yes</option>
349 <option value="bib_only">Record only</option>
350 <option value="item_only">Item only</option>
353 <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
355 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
356 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
357 <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
362 <th>Patron category</th>
366 <th>Current checkouts allowed</th>
367 <th>Current on-site checkouts allowed</th>
370 <th>Hard due date</th>
372 <th>Fine charging interval</th>
373 <th>Charge when?</th>
374 <th>Fine grace period</th>
375 <th>Overdue fines cap (amount)</th>
376 <th>Cap fine at replacement price</th>
377 <th>Suspension in days (day)</th>
378 <th>Max. suspension duration (day)</th>
379 <th>Suspension charging interval</th>
380 <th>Renewals allowed (count)</th>
381 <th>Renewal period</th>
382 <th>No renewal before</th>
383 <th>Automatic renewal</th>
384 <th>No automatic renewal after</th>
385 <th>No automatic renewal after (hard limit)</th>
386 <th>Holds allowed (total)</th>
387 <th>Holds allowed (daily)</th>
388 <th>Holds per record (count)</th>
389 <th>On shelf holds allowed</th>
390 <th>Item level holds</th>
391 <th>Article requests</th>
392 <th>Rental discount (%)</th>
400 <div id="defaults-for-this-library" class="container">
401 <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
402 <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>
403 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
404 <input type="hidden" name="op" value="set-branch-defaults" />
405 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
409 <th>Total current checkouts allowed</th>
410 <th>Total current on-site checkouts allowed</th>
411 <th>Maximum total holds allowed (count)</th>
413 <th>Hold pickup library match</th>
414 <th>Return policy</th>
418 <td><em>Defaults</em></td>
420 [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
421 <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
424 [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
425 <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
428 [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
429 <input name="max_holds" size="3" value="[% rule_value | html %]" />
432 <select name="holdallowed">
433 [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
438 [% IF holdallowed == 2 %]
439 <option value="2" selected="selected">
446 [% IF holdallowed == 1 %]
447 <option value="1" selected="selected">
454 [% IF holdallowed == 0 %]
455 <option value="0" selected="selected">
464 <select name="hold_fulfillment_policy">
465 [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
471 [% IF hold_fulfillment_policy == 'any' %]
472 <option value="any" selected="selected">
481 [% IF hold_fulfillment_policy == 'homebranch' %]
482 <option value="homebranch" selected="selected">
486 <option value="homebranch">
491 [% IF hold_fulfillment_policy == 'holdingbranch' %]
492 <option value="holdingbranch" selected="selected">
493 item's holding library
496 <option value="holdingbranch">
497 item's holding library
503 <select name="returnbranch">
504 [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
510 [% IF returnbranch == 'homebranch' %]
511 <option value="homebranch" selected="selected">
513 <option value="homebranch">
517 [% IF returnbranch == 'holdingbranch' %]
518 <option value="holdingbranch" selected="selected">
520 <option value="holdingbranch">
522 Item returns to issuing library
524 [% IF returnbranch == 'noreturn' %]
525 <option value="noreturn" selected="selected">
527 <option value="noreturn">
534 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
535 <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>
541 [% IF ( show_branch_cat_rule_form ) %]
542 <div id="holds-policy-by-patron-category" class="container">
543 <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
544 <p>For this library, you can specify the maximum number of loans that
545 a patron of a given category can make, regardless of the item type.
547 <p>If the total amount loanable for a given patron category is left blank,
548 no limit applies, except possibly for a limit you define for a specific item type.
550 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
551 <input type="hidden" name="op" value="add-branch-cat" />
552 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
555 <th>Patron category</th>
556 <th>Total current checkouts allowed</th>
557 <th>Total current on-site checkouts allowed</th>
558 <th>Total holds allowed</th>
561 [% FOREACH c IN categorycodes %]
562 [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
563 [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
564 [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
566 [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
572 [% Categories.GetName(c) | html %]
576 [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
577 [% patron_maxissueqty | html %]
579 <span>Unlimited</span>
583 [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
584 [% patron_maxonsiteissueqty | html %]
586 <span>Unlimited</span>
590 [% IF max_holds.defined && max_holds != '' %]
591 [% max_holds | html %]
593 <span>Unlimited</span>
598 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=[% c | html %]&branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
605 <select name="categorycode">
606 [% FOREACH patron_category IN patron_categories%]
607 <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
611 <td><input name="patron_maxissueqty" size="3" type="text" /></td>
612 <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
613 <td><input name="max_holds" size="3" type="text" /></td>
614 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
621 <div id="refund-lost-item-fee-on-return" class="container">
622 [% IF current_branch == '*' %]
623 <h3>Default lost item fee refund on return policy</h3>
625 <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
627 <p>Specify the default policy for lost item fees on return.
629 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
630 <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
631 <input type="hidden" name="branch" value="[% current_branch | html %]" />
634 <th>Refund lost item fee</th>
639 <select name="refund">
640 [#% Default branch %#]
641 [% IF ( current_branch == '*' ) %]
642 [% IF ( defaultRefundRule ) %]
643 <option value="1" selected="selected">
649 [% IF ( not defaultRefundRule ) %]
650 <option value="0" selected="selected">
657 [#% Branch-specific %#]
658 [% IF ( not refundLostItemFeeRule ) %]
659 <option value="*" selected="selected">
663 [% IF defaultRefundRule %]
669 [% IF ( not refundLostItemFeeRule ) %]
670 <option value="1">Yes</option>
671 <option value="0">No</option>
673 [% IF ( refundLostItemFeeRule.rule_value ) %]
674 <option value="1" selected="selected">
680 [% IF ( not refundLostItemFeeRule.rule_value ) %]
681 <option value="0" selected="selected">
692 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
700 <div id="holds-policy-by-item-type" class="container">
701 <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
703 For this library, you can edit rules for given itemtypes, regardless
704 of the patron's category.
707 Currently, this means hold policies.
708 The various policies have the following effects:
711 <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
712 <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
713 <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
715 <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
716 <strong>Important: </strong>The policies are applied based on the ReservesControlBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesControlBranch">[% Koha.Preference('ReservesControlBranch') | html %]</a>.
719 <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
720 <input type="hidden" name="op" value="add-branch-item" />
721 <input type="hidden" name="branch" value="[% current_branch | html %]"/>
726 <th>Hold pickup library match</th>
727 <th>Return policy</th>
730 [% FOREACH i IN itemtypeloop %]
731 [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
732 [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
733 [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
735 [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
738 [% i.translated_description | html %]
741 [% IF holdallowed == 2 %]
742 <span>From any library</span>
743 [% ELSIF holdallowed == 1 %]
744 <span>From home library</span>
746 <span>No holds allowed</span>
750 [% IF hold_fulfillment_policy == 'any' %]
751 <span>any library</span>
752 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
753 <span>item's home library</span>
754 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
755 <span>item's holding library</span>
759 [% IF returnbranch == 'homebranch' %]
760 <span>Item returns home</span>
761 [% ELSIF returnbranch == 'holdingbranch' %]
762 <span>Item returns to issuing branch</span>
763 [% ELSIF returnbranch == 'noreturn' %]
764 <span>Item floats</span>
768 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&itemtype=[% i.itemtype | uri %]&branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
775 <select name="itemtype">
776 [% FOREACH itemtypeloo IN itemtypeloop %]
777 <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
782 <select name="holdallowed">
783 <option value="2">From any library</option>
784 <option value="1">From home library</option>
785 <option value="0">No holds allowed</option>
789 <select name="hold_fulfillment_policy">
794 <option value="homebranch">
798 <option value="holdingbranch">
799 item's holding library
804 <select name="returnbranch">
805 <option value="homebranch">Item returns home</option>
806 <option value="holdingbranch">Item returns to issuing library</option>
807 <option value="noreturn">Item floats</option>
810 <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
816 </div> <!-- /.col-sm-10.col-sm-push-2 -->
818 <div class="col-sm-2 col-sm-pull-10">
820 [% INCLUDE 'admin-menu.inc' %]
822 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
823 </div> <!-- /.row -->
825 [% MACRO jsinclude BLOCK %]
826 [% Asset.js("js/admin-menu.js") | $raw %]
827 [% INCLUDE 'calendar.inc' %]
830 function clear_edit(){
831 var cancel = confirm(_("Are you sure you want to cancel your changes?"));
832 if ( !cancel ) return;
833 $('#default-circulation-rules td').removeClass('highlighted-row');
834 var edit_row = $("#edit_row");
835 $(edit_row).find("input").each(function(){
836 var type = $(this).attr("type");
837 if (type != "button" && type != "submit" ) {
839 $(this).prop('disabled', false);
841 if ( type == "checkbox" ) {
842 $(this).prop('checked', false);
845 $(edit_row).find("select").prop('disabled', false);
846 $(edit_row).find("select option:first").attr("selected", "selected");
847 $(edit_row).find("td:last input[name='clear']").remove();
850 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
852 $(document).ready(function() {
853 $('[data-toggle="popover"]').popover();
855 $(".delete").on("click",function(){
856 return confirmDelete(MSG_CONFIRM_DELETE);
859 $("#clone_rules").on("click",function(){
860 var library_dropdown = document.getElementById("branch");
861 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
862 var selected_library_text = $("#branch option:selected").text();
863 var to_library = $("#tobranch option:selected").text();
864 var MSG_CONFIRM_CLONE;
865 if (selected_library === "*") {
866 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);
867 return confirmClone(MSG_CONFIRM_CLONE);
869 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);
870 return confirmClone(MSG_CONFIRM_CLONE);
874 $('#selectlibrary').find("input:submit").hide();
875 $('#branch').change(function() {
876 $('#selectlibrary').submit();
878 $(".editrule").click(function(){
879 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
880 var edit = confirm(_("Are you sure you want to edit another rule?"));
881 if (!edit) return false;
883 $('#default-circulation-rules td').removeClass('highlighted-row');
884 $(this).parent().parent().find("td").each(function (i) {
885 $(this).addClass('highlighted-row');
886 itm = $(this).text();
887 itm = itm.replace(/^\s*|\s*$/g,'');
888 var current_column = $("#edit_row td:eq("+i+")");
890 // specific processing for the Note column
891 var note = $(this).find("a[name='viewnote']").data("content");
892 $(current_column).find("input[type='text']").val(note);
893 } else if ( i == 8 ) {
894 // specific processing for the Hard due date column
895 var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
896 var input_value = '';
897 if (typeof select_value === 'undefined'){
900 input_value = itm.split(' ')[1];
902 $(current_column).find("input[type='text']").val(input_value);
903 $(current_column).find("select").val(select_value);
904 } else if ( i == 14 ) {
905 // specific processing for cap_fine_to_replacement_price
906 var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
907 $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
908 $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
910 $(current_column).find("input[type='text']").val(itm);
911 // select the corresponding option
912 $(current_column).find("select option").each(function(){
913 opt = $(this).text().toLowerCase();
914 opt = opt.replace(/^\s*|\s*$/g,'');
915 if ( opt == itm.toLowerCase() ) {
916 $(this).attr('selected', 'selected');
919 if ( i == 0 || i == 1 ) {
920 // Disable the 2 first columns, we cannot update them.
921 var val = $(current_column).find("select option:selected").val();
922 var name = "categorycode";
926 // Remove potential previous input added
927 $(current_column).find("input").remove();
928 $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
929 } else if ( i == 4 || i == 5 || i == 25 ) {
930 // If the value is not an integer for
931 // - "Current checkouts allowed"
932 // - "Current on-site checkouts allowed"
933 // - "Holds allowed (daily)"
934 // The value is "Unlimited" (or an equivalent translated string)
935 // an it should be set to an empty string
936 if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
937 $(current_column).find("input[type='text']").val("");
942 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
943 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
946 $(".clear_edit").on("click",function(e){
953 [% INCLUDE 'intranet-bottom.inc' %]