Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1369 lines
78 KiB

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE Categories %]
[% USE ItemTypes %]
[% USE CirculationRules %]
[% USE Price %]
[% SET footerjs = 1 %]
[% SET branchcode = humanbranch || undef %]
[% SET categorycodes = [] %]
[% FOREACH pc IN patron_categories %]
[% categorycodes.push( pc.id ) %]
[% END %]
[% categorycodes.push(undef) %]
[% SET itemtypes = [] %]
[% FOREACH i IN itemtypeloop %]
[% itemtypes.push( i.itemtype ) %]
[% END %]
[% itemtypes.push(undef) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Circulation and fine rules &rsaquo; Administration &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_smart-rules" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
</li>
<li>
<a href="#" aria-current="page">
Circulation and fine rules
</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<h1 class="parameters">
[% IF humanbranch %]
Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
[% ELSE %]
Defining circulation and fine rules for all libraries
[% END %]
</h1>
<div class="help">
<p>The rules are applied from most specific to less specific, using the first found in this order:</p>
<ul>
<li>same library, same patron category, same item type</li>
<li>same library, same patron category, all item types</li>
<li>same library, all patron categories, same item type</li>
<li>same library, all patron categories, all item types</li>
<li>default (all libraries), same patron category, same item type</li>
<li>default (all libraries), same patron category, all item types</li>
<li>default (all libraries), all patron categories, same item type</li>
<li>default (all libraries), all patron categories, all item types</li>
</ul>
<p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
or the specific rule's type, whichever is less.</p>
<p>To modify a rule, create a new one with the same patron category and item type.</p>
</div>
<div>
[% UNLESS restricted_to_own_library %]
<form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
Select a library :
<select name="branch" id="branch" style="width:20em;">
<option value="*">Standard rules for all libraries</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
</select>
</form>
[% IF ( definedbranch ) %]
<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
<label for="tobranch"><strong>Clone these rules to:</strong></label>
<input type="hidden" name="frombranch" value="[% current_branch | html %]" />
<select name="tobranch" id="tobranch">
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
</select>
<input type="submit" id="clone_rules" value="Clone" />
</form>
[% END %]
[% END %]
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="add" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table id="default-circulation-rules">
<thead>
<tr>
<th>&nbsp;</th>
<th class="fixed_sort">Patron category</th>
<th>&nbsp;</th>
<th class="fixed_sort">Item type</th>
<th class="noExport">Actions</th>
<th>Note</th>
<th>Current checkouts allowed</th>
<th>Current on-site checkouts allowed</th>
<th>Loan period</th>
<th>Days mode</th>
<th>Unit</th>
<th>Hard due date</th>
<th>Decreased loan period for high holds (day)</th>
<th>Fine amount</th>
<th>Fine charging interval</th>
<th>When to charge</th>
<th>Fine grace period</th>
<th>Overdue fines cap (amount)</th>
<th>Cap fine at replacement price</th>
<th>Suspension in days (day)</th>
<th>Max. suspension duration (day)</th>
<th>Suspension charging interval</th>
<th>Renewals allowed (count)</th>
[% IF Koha.Preference('UnseenRenewals') %]
<th>Unseen renewals allowed (count)</th>
[% END %]
<th>Renewal period</th>
<th>No renewal before</th>
<th>Automatic renewal</th>
<th>No automatic renewal after</th>
<th>No automatic renewal after (hard limit)</th>
<th>Holds allowed (total)</th>
<th>Holds allowed (daily)</th>
<th>Holds per record (count)</th>
<th>On shelf holds allowed</th>
<th>OPAC item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
[% IF Koha.Preference('UseRecalls') %]
<th>Recalls allowed (total)</th>
<th>Recalls per record (count)</th>
<th>On shelf recalls allowed</th>
<th>Recall due date interval (day)</th>
<th>Recall overdue fine amount</th>
<th>Recall pickup period (day)</th>
[% END %]
<th class="noExport">Actions</th>
</tr>
</thead>
<tbody>
[% SET row_count = 0 %]
[% FOREACH c IN categorycodes %]
[% SET c = '' UNLESS c.defined %]
[% FOREACH i IN itemtypes %]
[% SET i = '' UNLESS i.defined %]
[% SET note = all_rules.$c.$i.note %]
[% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
[% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
[% SET issuelength = all_rules.$c.$i.issuelength %]
[% SET daysmode = all_rules.$c.$i.daysmode %]
[% SET lengthunit = all_rules.$c.$i.lengthunit %]
[% SET hardduedate = all_rules.$c.$i.hardduedate %]
[% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
[% SET fine = all_rules.$c.$i.fine %]
[% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
[% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
[% SET firstremind = all_rules.$c.$i.firstremind %]
[% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
[% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
[% SET finedays = all_rules.$c.$i.finedays %]
[% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
[% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
[% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
[% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
[% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
[% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
[% SET auto_renew = all_rules.$c.$i.auto_renew %]
[% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
[% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
[% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
[% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
[% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
[% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
[% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
[% SET article_requests = all_rules.$c.$i.article_requests %]
[% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
[% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
[% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
[% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
[% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
[% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
[% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
[% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
[% 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 %]
[% IF show_rule %]
[% SET row_count = row_count + 1 %]
<tr row_countd="row_[% row_count | html %]">
<td>[% IF ( c == undef ) %]
1
[% ELSE %]
0
[% END %]</td>
<td>
[% IF c == undef %]
<em>All</em>
[% ELSE %]
[% Categories.GetName(c) | html %]
[% END %]
</td>
<td>[% IF ( i == undef ) %]
1
[% ELSE %]
0
[% END %]</td>
<td>
[% IF i == undef %]
<em>All</em>
[% ELSE %]
[% ItemTypes.GetDescription(i,1) | html %]
[% END %]
</td>
<td class="actions">
<a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | html %]&amp;categorycode=[% c || '*' | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
<td>
[% IF note.defined && note != '' %]
<a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
[% ELSE %]<span>&nbsp;</span>[% END %]
</td>
<td>
[% IF maxissueqty.defined && maxissueqty != '' %]
[% maxissueqty | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF maxonsiteissueqty.defined && maxonsiteissueqty != '' %]
[% maxonsiteissueqty | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>[% issuelength | html %]</td>
<td>
[% SWITCH daysmode %]
[% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
[% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
[% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
[% 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>
[% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
[% END %]
</td>
<td>
[% IF ( lengthunit == 'days' ) %]
<span>Days</span>
[% ELSIF ( lengthunit == 'hours') %]
<span>Hours</span>
[% ELSE %]
<span>Undefined</span>
[% END %]
</td>
<td>
[% IF ( hardduedate ) %]
[% IF ( hardduedatecompare == '-1' ) %]
before [% hardduedate | $KohaDates %]
<input type="hidden" name="hardduedatecomparebackup" value="-1" />
[% ELSIF ( hardduedatecompare == '0' ) %]
on [% hardduedate | $KohaDates %]
<input type="hidden" name="hardduedatecomparebackup" value="0" />
[% ELSIF ( hardduedatecompare == '1' ) %]
after [% hardduedate | $KohaDates %]
<input type="hidden" name="hardduedatecomparebackup" value="1" />
[% END %]
[% ELSE %]
<span>None defined</span>
[% END %]
</td>
<td>[% decreaseloanholds | html %]</td>
<td>[% fine | html %]</td>
<td>[% chargeperiod | html %]</td>
<td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
<td>[% firstremind | html %]</td>
<td>[% overduefinescap | $Price %]</td>
<td>
[% IF cap_fine_to_replacement_price %]
<input type="checkbox" checked="checked" disabled="disabled" />
[% ELSE %]
<input type="checkbox" disabled="disabled" />
[% END %]
</td>
<td>[% finedays | html %]</td>
<td>[% maxsuspensiondays | html %]</td>
<td>[% suspension_chargeperiod | html %]</td>
<td>[% renewalsallowed | html %]</td>
[% IF Koha.Preference('UnseenRenewals') %]
<td>[% unseenrenewalsallowed | html %]</td>
[% END %]
<td>[% renewalperiod | html %]</td>
<td>[% norenewalbefore | html %]</td>
<td>
[% IF auto_renew %]
<span>Yes</span>
[% ELSE %]
<span>No</span>
[% END %]
</td>
<td>[% no_auto_renewal_after | html %]</td>
<td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
<td>
[% IF reservesallowed.defined && reservesallowed != '' %]
[% reservesallowed | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF holds_per_day.defined && holds_per_day != '' %]
[% holds_per_day | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF holds_per_record.defined && holds_per_record != '' %]
[% holds_per_record | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF onshelfholds == 1 %]
<span>Yes</span>
[% ELSIF onshelfholds == 2 %]
<span>If all unavailable</span>
[% ELSE %]
<span>If any unavailable</span>
[% END %]
</td>
<td>
[% IF opacitemholds == 'F'%]
<span>Force</span>
[% ELSIF opacitemholds == 'Y'%]
<span>Allow</span>
[% ELSE %]
<span>Don't allow</span>
[% END %]
</td>
<td>
[% IF article_requests == 'no' %]
<span>No</span>
[% ELSIF article_requests == 'yes' %]
<span>Yes</span>
[% ELSIF article_requests == 'bib_only' %]
<span>Record only</span>
[% ELSIF article_requests == 'item_only' %]
<span>Item only</span>
[% END %]
</td>
<td>[% rentaldiscount | html %]</td>
[% IF Koha.Preference('UseRecalls') %]
<td>[% recalls_allowed | html %]</td>
<td>[% recalls_per_record | html %]</td>
<td>
[% IF on_shelf_recalls == 'all' %]
<span>If all unavailable</span>
[% ELSE %]
<span>If any unavailable</span>
[% END %]
</td>
<td>[% recall_due_date_interval | html %]</td>
<td>[% recall_overdue_fine | $Price %]</td>
<td>[% recall_shelf_time | html %]</td>
[% END %]
<td class="actions">
<a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | uri %]&amp;categorycode=[% c || '*' | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
[% END %]
[% END %]
<tr class="noExport" id="edit_row">
<td>2</td>
<td>
<select name="categorycode" id="categorycode">
<option value="*">All</option>
[% FOREACH patron_category IN patron_categories%]
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
[% END %]
</select>
</td>
<td>0</td>
<td>
<select name="itemtype" id="matrixitemtype" style="width:13em;">
<option value="*">All</option>
[% FOREACH itemtypeloo IN itemtypeloop %]
[% NEXT IF itemtypeloo.parent_type %]
[% SET children = itemtypeloo.children_with_localization %]
[% IF children.count %]
<optgroup label="[% itemtypeloo.translated_description | html %]">
<option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
[% FOREACH child IN children %]
<option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
[% END %]
</optgroup>
[% ELSE %]
<option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
[% END %]
[% END %]
</select>
</td>
<td class="actions">
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
<button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
</td>
<td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
<td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
<td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
<td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
<td>
<select name="daysmode" id="daysmode">
<option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
<option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
<option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
<option value="Days" title="Ignore the calendar">Ignore the calendar</option>
<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>
</select>
</td>
<td>
<select name="lengthunit" id="lengthunit">
<option value="days" selected="selected">Days</option>
<option value="hours">Hours</option>
</select>
</td>
<td>
<select name="hardduedatecompare" id="hardduedatecompare">
<option value="-1">Before</option>
<option value="0">Exactly on</option>
<option value="1">After</option>
</select>
<input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
<td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
<td><input type="text" name="fine" id="fine" size="4" /></td>
<td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
<td>
<select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
<option value="0">End of interval</option>
<option value="1">Start of interval</option>
</select>
</td>
<td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
<td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
<td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
<td><input type="text" name="finedays" id="fined" size="3" /> </td>
<td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
<td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
<td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
[% IF Koha.Preference('UnseenRenewals') %]
<td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
[% END %]
<td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
<td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
<td>
<select name="auto_renew" id="auto_renew">
<option value="no" selected>No</option>
<option value="yes">Yes</option>
</select>
</td>
<td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
<td>
<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"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
<td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
<td><input type="text" name="holds_per_day" id="holds_per_day" size="2" /></td>
<td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
<td>
<select name="onshelfholds" id="onshelfholds">
<option value="1">Yes</option>
<option value="0">If any unavailable</option>
<option value="2">If all unavailable</option>
</select>
</td>
<td>
<select id="opacitemholds" name="opacitemholds">
<option value="N">Don't allow</option>
<option value="Y">Allow</option>
<option value="F">Force</option>
</select>
</td>
<td>
<select id="article_requests" name="article_requests">
<option value="no">No</option>
<option value="yes">Yes</option>
<option value="bib_only">Record only</option>
<option value="item_only">Item only</option>
</select>
</td>
<td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
[% IF Koha.Preference('UseRecalls') %]
<td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
<td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
<td>
<select name="on_shelf_recalls" id="on_shelf_recalls">
<option value="any">If any unavailable</option>
<option value="all">If all unavailable</option>
</select>
</td>
<td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
<td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6"></td>
<td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
[% END %]
<td class="actions">
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
<button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
</td>
</tr>
<tfoot>
<tr>
<th>&nbsp;</th>
<th>Patron category</th>
<th>&nbsp;</th>
<th>Item type</th>
<th>&nbsp;</th>
<th>Note</th>
<th>Current checkouts allowed</th>
<th>Current on-site checkouts allowed</th>
<th>Loan period</th>
<th>Days mode</th>
<th>Unit</th>
<th>Hard due date</th>
<th>Decreased loan period for high holds (day)</th>
<th>Fine amount</th>
<th>Fine charging interval</th>
<th>Charge when?</th>
<th>Fine grace period</th>
<th>Overdue fines cap (amount)</th>
<th>Cap fine at replacement price</th>
<th>Suspension in days (day)</th>
<th>Max. suspension duration (day)</th>
<th>Suspension charging interval</th>
<th>Renewals allowed (count)</th>
[% IF Koha.Preference('UnseenRenewals') %]
<th>Unseen renewals allowed (count)</th>
[% END %]
<th>Renewal period</th>
<th>No renewal before</th>
<th>Automatic renewal</th>
<th>No automatic renewal after</th>
<th>No automatic renewal after (hard limit)</th>
<th>Holds allowed (total)</th>
<th>Holds allowed (daily)</th>
<th>Holds per record (count)</th>
<th>On shelf holds allowed</th>
<th>OPAC item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
[% IF Koha.Preference('UseRecalls') %]
<th>Recalls allowed (total)</th>
<th>Recalls per record (count)</th>
<th>On shelf recalls allowed</th>
<th>Recall due date interval (day)</th>
<th>Recall overdue fine amount</th>
<th>Recall pickup period (day)</th>
[% END %]
<th>&nbsp;</th>
</tr>
</tfoot>
</tbody>
</table>
</form>
</div>
<div id="defaults-for-this-library" class="container">
<h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
<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>
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="set-branch-defaults" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table>
<tr>
<th>&nbsp;</th>
<th>Total current checkouts allowed</th>
<th>Total current on-site checkouts allowed</th>
<th>Maximum total holds allowed (count)</th>
<th>Hold policy</th>
<th>Hold pickup library match</th>
<th>Return policy</th>
<th class="noExport">Actions</th>
</tr>
[% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
[% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', { want_rule => 1 } ) %]
[% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
[% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
[% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
[% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
[% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
<tr>
<td>
[% IF ( default_checkout_hold_and_return_policy ) %]
<em>
Defaults
</em>
[% ELSE %]
Not set
[% END %]
</td>
<td>
<input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
</td>
<td>
<input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
</td>
<td>
<input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
</td>
<td>
<select name="holdallowed">
<option value="">
Not set
</option>
[% IF holdallowed.rule_value == 'from_any_library' %]
<option value="from_any_library" selected="selected">
[% ELSE %]
<option value="from_any_library">
[% END %]
From any library
</option>
[% IF holdallowed.rule_value == 'from_local_hold_group' %]
<option value="from_local_hold_group" selected="selected">
[% ELSE %]
<option value="from_local_hold_group">
[% END %]
From local hold group
</option>
[% IF holdallowed.rule_value == 'from_home_library' %]
<option value="from_home_library" selected="selected">
[% ELSE %]
<option value="from_home_library">
[% END %]
From home library
</option>
[% IF holdallowed.rule_value == 'not_allowed' %]
<option value="not_allowed" selected="selected">
[% ELSE %]
<option value="not_allowed">
[% END %]
No holds allowed
</option>
</select>
</td>
<td>
<select name="hold_fulfillment_policy">
<option value="">
Not set
</option>
[% IF hold_fulfillment_policy.rule_value == 'any' %]
<option value="any" selected="selected">
any library
</option>
[% ELSE %]
<option value="any">
any library
</option>
[% END %]
[% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
<option value="holdgroup" selected="selected">
item's hold group
</option>
[% ELSE %]
<option value="holdgroup">
item's hold group
</option>
[% END %]
[% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
<option value="patrongroup" selected="selected">
patron's hold group
</option>
[% ELSE %]
<option value="patrongroup">
patron's hold group
</option>
[% END %]
[% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
<option value="homebranch" selected="selected">
item's home library
</option>
[% ELSE %]
<option value="homebranch">
item's home library
</option>
[% END %]
[% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
<option value="holdingbranch" selected="selected">
item's holding library
</option>
[% ELSE %]
<option value="holdingbranch">
item's holding library
</option>
[% END %]
</select>
</td>
<td>
<select name="returnbranch">
<option value="">
Not set
</option>
[% IF returnbranch.rule_value == 'homebranch' %]
<option value="homebranch" selected="selected">
[% ELSE %]
<option value="homebranch">
[% END %]
Item returns home
</option>
[% IF returnbranch.rule_value == 'holdingbranch' %]
<option value="holdingbranch" selected="selected">
[% ELSE %]
<option value="holdingbranch">
[% END %]
Item returns to issuing library
</option>
[% IF returnbranch.rule_value == 'noreturn' %]
<option value="noreturn" selected="selected">
[% ELSE %]
<option value="noreturn">
[% END %]
Item floats
</option>
</select>
</td>
<td class="actions">
<button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
[% IF ( default_checkout_hold_and_return_policy ) %]
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
[% END %]
</td>
</tr>
</table>
</form>
</div>
[% IF ( show_branch_cat_rule_form ) %]
<div id="holds-policy-by-patron-category" class="container">
<h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
<p>For this library, you can specify the maximum number of loans that
a patron of a given category can make, regardless of the item type.
</p>
<p>If the total amount loanable for a given patron category is left blank,
no limit applies, except possibly for a limit you define for a specific item type.
</p>
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="add-branch-cat" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table>
<tr>
<th>Patron category</th>
<th>Total current checkouts allowed</th>
<th>Total current on-site checkouts allowed</th>
<th>Total holds allowed</th>
<th>&nbsp;</th>
</tr>
[% FOREACH c IN categorycodes %]
[% NEXT UNLESS c %]
[% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
[% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
[% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
[% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
<tr>
<td>
[% IF c == undef %]
<em>Default</em>
[% ELSE %]
[% Categories.GetName(c) | html %]
[% END %]
</td>
<td>
[% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
[% patron_maxissueqty | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
[% patron_maxonsiteissueqty | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF max_holds.defined && max_holds != '' %]
[% max_holds | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
[% END %]
<tr>
<td>
<select name="categorycode">
[% FOREACH patron_category IN patron_categories%]
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
[% END %]
</select>
</td>
<td><input name="patron_maxissueqty" size="3" type="text" /></td>
<td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
<td><input name="max_holds" size="3" type="text" /></td>
<td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
</tr>
</table>
</form>
</div>
[% END %]
[% IF Koha.Preference('ArticleRequests') %]
<div id="open-article-requests-limit-patron-category" class="container">
[% IF humanbranch %]
<h3>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h3>
[% ELSE %]
<h3>Default open article requests limit</h3>
[% END %]
<p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
<form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="add-open-article-requests-limit" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table>
<tr>
<th>Patron category</th>
<th>Total article requests</th>
<th>&nbsp;</th>
</tr>
[% FOREACH c IN categorycodes %]
[% NEXT UNLESS c %]
[% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %]
[% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %]
<tr>
<td>
[% Categories.GetName(c) | html %]
</td>
<td>
[% IF open_article_requests_limit.defined && open_article_requests_limit != '' %]
[% open_article_requests_limit | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-open-article-requests-limit&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
[% END %]
<tr>
<td>
<select name="categorycode">
[% FOREACH patron_category IN patron_categories %]
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
[% END %]
</select>
</td>
<td><input name="open_article_requests_limit" size="3" type="text" /></td>
<td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
</tr>
</table>
</form>
</div>
<div id="article-request-fee-category" class="container">
[% IF humanbranch %]
<h3>Article request fees for [% Branches.GetName( humanbranch ) | html %]</h3>
[% ELSE %]
<h3>Default article request fees</h3>
[% END %]
<p>Specify the article request fee for a given patron category.</p>
<form id="set-article-request-fee" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="set-article-request-fee" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table>
<tr>
<th>Patron category</th>
<th>Fee</th>
<th>&nbsp;</th>
</tr>
[% FOREACH c IN categorycodes %]
[% SET c = '*' UNLESS c.defined AND c != '' %]
[% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %]
[% IF ( article_request_fee.defined && article_request_fee != '' ) %]
<tr>
<td>
[% IF c == '*' %]
<em>All</em>
[% ELSE %]
[% Categories.GetName(c) | html %]
[% END %]
</td>
<td>
[% IF article_request_fee.defined && article_request_fee != '' %]
[% article_request_fee | html %]
[% ELSE %]
<span>0</span>
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-article-request-fee&amp;article_request_fee_category=[% c | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
[% END %]
<tr>
<td>
<select name="article_request_fee_category" id="article_request_fee_category">
<option value="*">All</option>
[% FOREACH patron_category IN patron_categories%]
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
[% END %]
</select>
</td>
<td><input name="article_request_fee" size="3" type="text" /></td>
<td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
</tr>
</table>
</form>
</div>
[% END %]
<div id="refund-lost-item-fee-on-return" class="container">
[% IF current_branch == '*' %]
<h3>Default lost item fee refund on return policy</h3>
[% ELSE %]
<h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
[% END %]
<p>Specify the default policy for lost item fees on return.
</p>
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
<input type="hidden" name="branch" value="[% current_branch | html %]" />
<table>
<tr>
<th>Refund lost item fee</th>
<th>&nbsp;</th>
</tr>
<tr>
<td>
<select name="lostreturn">
[%# Default branch %]
[% IF ( current_branch == '*' ) %]
[% IF ( defaultRefundRule == 'refund' ) %]
<option value="refund" selected="selected">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( defaultRefundRule == 'charge' ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( defaultRefundRule == 'restore' ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( defaultRefundRule == 0 ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0" selected="selected">Leave lost item charge</option>
[% ELSE %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% END %]
[% ELSE %]
[%# Branch-specific %]
[% IF ( not refundLostItemFeeRule ) %]
<option value="*" selected="selected">
[% ELSE %]
<option value="*">
[% END %]
[% IF defaultRefundRule == 'refund' %]
<span>Use default (Refund lost item charge)</span>
[% ELSIF defaultRefundRule == 'charge' %]
<span>Use default (Refund lost item charge and restore overdue fine)</span>
[% ELSIF defaultRefundRule == 'restore' %]
<span>Use default (Refund lost item charge and charge new overdue fine)</span>
[% ELSE %]
<span>Use default (Leave lost item charge)</span>
[% END %]
</option>
[% IF ( not refundLostItemFeeRule ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSE %]
[% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
<option value="refund" selected="selected">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
<option value="0">Leave lost item charge</option>
[% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
<option value="refund">Refund lost item charge</option>
<option value="charge">Refund lost item charge and charge new overdue fine</option>
<option value="restore">Refund lost item charge and restore overdue fine</option>
<option value="0" selected="selected">Leave lost item charge</option>
[% END %]
[% END %]
[% END %]
</select>
</td>
<td class="actions">
<button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
</td>
</td>
</tr>
</table>
</form>
</div>
<div id="holds-policy-by-item-type" class="container">
<h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
<p>
For this library, you can edit rules for given itemtypes, regardless
of the patron's category.
</p>
<p>
Currently, this means hold policies.
The various policies have the following effects:
</p>
<ul>
<li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
<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>
<li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
<li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
</ul>
<p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
<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>.
</p>
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
<input type="hidden" name="op" value="add-branch-item" />
<input type="hidden" name="branch" value="[% current_branch | html %]"/>
<table>
<tr>
<th>Item type</th>
<th>Hold policy</th>
<th>Hold pickup library match</th>
<th>Return policy</th>
<th>&nbsp;</th>
</tr>
[% FOREACH i IN itemtypeloop %]
[% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
[% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
[% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
[% IF holdallowed || hold_fulfillment_policy || returnbranch %]
<tr>
<td>
[% i.translated_description | html %]
</td>
<td>
[% IF holdallowed == 'from_any_library' %]
<span>From any library</span>
[% ELSIF holdallowed == 'from_local_hold_group' %]
<span>From local hold group</span>
[% ELSIF holdallowed == 'from_home_library' %]
<span>From home library</span>
[% ELSE %]
<span>No holds allowed</span>
[% END %]
</td>
<td>
[% IF hold_fulfillment_policy == 'any' %]
<span>any library</span>
[% ELSIF hold_fulfillment_policy == 'homebranch' %]
<span>item's home library</span>
[% ELSIF hold_fulfillment_policy == 'holdgroup' %]
<span>item's hold group</span>
[% ELSIF hold_fulfillment_policy == 'patrongroup' %]
<span>patron's hold group</span>
[% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
<span>item's holding library</span>
[% END %]
</td>
<td>
[% IF returnbranch == 'homebranch' %]
<span>Item returns home</span>
[% ELSIF returnbranch == 'holdingbranch' %]
<span>Item returns to issuing branch</span>
[% ELSIF returnbranch == 'noreturn' %]
<span>Item floats</span>
[% END %]
</td>
<td class="actions">
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=[% i.itemtype | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
[% END %]
<tr>
<td>
<select name="itemtype">
[% FOREACH itemtypeloo IN itemtypeloop %]
<option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
[% END %]
</select>
</td>
<td>
<select name="holdallowed">
<option value="from_any_library">From any library</option>
<option value="from_local_hold_group">From local hold group</option>
<option value="from_home_library">From home library</option>
<option value="not_allowed">No holds allowed</option>
</select>
</td>
<td>
<select name="hold_fulfillment_policy">
<option value="any">
any library
</option>
<option value="holdgroup">
item's hold group
</option>
<option value="patrongroup">
patron's hold group
</option>
<option value="homebranch">
item's home library
</option>
<option value="holdingbranch">
item's holding library
</option>
</select>
</td>
<td>
<select name="returnbranch">
<option value="homebranch">Item returns home</option>
<option value="holdingbranch">Item returns to issuing library</option>
<option value="noreturn">Item floats</option>
</select>
</td>
<td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
</tr>
</table>
</form>
</div>
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
KohaTable("default-circulation-rules", {
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0,2 ] },
{ "bSortable": false, "aTargets": ["_all"] }
],
"aaSortingFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
"bPaginate": false,
"bAutoWidth": false
});
});
function clear_edit(){
var cancel = confirm(_("Are you sure you want to cancel your changes?"));
if ( !cancel ) return;
$('#default-circulation-rules td').removeClass('highlighted-row');
var edit_row = $("#edit_row");
$(edit_row).find("input").each(function(){
var type = $(this).attr("type");
if (type != "button" && type != "submit" ) {
$(this).val("");
$(this).prop('disabled', false);
}
if ( type == "checkbox" ) {
$(this).prop('checked', false);
}
});
$(edit_row).find("select").prop('disabled', false);
$(edit_row).find("select option:first-child").attr("selected", "selected");
$(edit_row).find("td:last input[name='clear']").remove();
}
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
$(".delete").on("click",function(){
return confirmDelete(MSG_CONFIRM_DELETE);
});
$("#clone_rules").on("click",function(){
var library_dropdown = document.getElementById("branch");
var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
var selected_library_text = $("#branch option:selected").text();
var to_library = $("#tobranch option:selected").text();
var MSG_CONFIRM_CLONE;
if (selected_library === "*") {
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);
return confirmClone(MSG_CONFIRM_CLONE);
} else {
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);
return confirmClone(MSG_CONFIRM_CLONE);
}
});
$('#selectlibrary').find("input:submit").hide();
$('#branch').change(function() {
$('#selectlibrary').submit();
});
$(".editrule").click(function(){
if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
var edit = confirm(_("Are you sure you want to edit another rule?"));
if (!edit) return false;
}
$('#default-circulation-rules td').removeClass('highlighted-row');
$(this).parent().parent().find("td").each(function (i) {
$(this).addClass('highlighted-row');
itm = $(this).text();
itm = itm.replace(/^\s*|\s*$/g,'');
var current_column = $("#edit_row td:eq("+i+")");
if ( i == 3 ) {
// specific processing for the Note column
var note = $(this).find("a[name='viewnote']").data("content");
$(current_column).find("input[type='text']").val(note);
} else if ( i == 9 ) {
// specific processing for the Hard due date column
var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
var input_value = '';
if (typeof select_value === 'undefined'){
select_value = '-1';
}else {
input_value = itm.split(' ')[1];
}
$(current_column).find("input[type='text']").val(input_value);
$(current_column).find("select").val(select_value);
} else if ( i == 16 ) {
// specific processing for cap_fine_to_replacement_price
var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
$('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
$('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
} else {
$(current_column).find("input[type='text']").val(itm);
// select the corresponding option
$(current_column).find("select option").each(function(){
opt = $(this).text().toLowerCase();
opt = opt.replace(/ \(all\)$/,""); //If option is a parent, compare without (All)
itm = itm.replace(/.*->(.*)/,"$1"); //If item type is part of a group we need to clear the parent description
opt = opt.replace(/^\s*|\s*$/g,'');
if ( opt == itm.toLowerCase() ) {
$(this).attr('selected', 'selected');
}
});
if ( i == 0 || i == 1 ) {
// Disable the 2 first columns, we cannot update them.
var val = $(current_column).find("select option:selected").val();
var name = "categorycode";
if ( i == 1 ) {
name="itemtype";
}
// Remove potential previous input added
$(current_column).find("input").remove();
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
} else if ( i == 5 || i == 6 || i == 26 || i == 27 || i == 28 ) {
// If the value is not an integer for
// - "Current checkouts allowed"
// - "Current on-site checkouts allowed"
// - "Holds allowed (total)"
// - "Holds allowed (daily)"
// - "Holds per record (count)"
// The value is "Unlimited" (or an equivalent translated string)
// an it should be set to an empty string
if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
$(current_column).find("input[type='text']").val("");
}
}
}
});
$("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
$("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
return false;
});
$(".clear_edit").on("click",function(e){
e.preventDefault();
clear_edit();
});
$("#set-article-requests-daily-limit").on("submit", function(){
if (! $("input[name='open_article_requests_limit'").val().length){
alert("Please set a daily limit for this patron's category");
return false;
}
return true;
});
$("#set-article-request-fee").on("submit", function(){
if (! $("input[name='article_request_fee'").val().length){
alert("Please set a valid value for the fee");
return false;
}
return true;
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]