Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
Jonathan Druart 53dfa99727 Bug 15581: Add a circ rule to limit the auto renewals given a delay
This patch adds a new circulation rule (no_auto_renewal_after) to block/allow
auto renewals after a given delay.
For instance, if the issue date is 10 days before today, and
no_auto_renewal_after is set to 10, tomorrow the issue won't be auto
renewed.

Test plan:
0/ Execute the update DB entry
Note: You will have to manually change data in your DB, make sure you
have access to the sql cli.
1/ Define a rule with no_auto_renewal_after (10 for instance) and
norenewalbefore (5 for instance).
(This new rule will behave the same as norenewalbefore: the unit depends
on the lengthunit value).
The automatic renewals will be done from 5 to 10 days ahead.
2/ Modify the issues.issuedate, to simulate a checkout in the past:
    UPDATE issues
    SET issuedate = "yyyy-mm-dd hh:mm:ss"
    WHERE itemnumber = YOUR_ITEMNUMBER;
with issuedate = 2 days before for instance
3/ Execute the automatic renewals cronjob script (misc/cronjobs/automatic_renewals.pl)
Confirm that the issue has not been renewed (too soon)
4/ Repeat step 2 with a due date set as 11 days before
5/ Execute the automatic renewals cronjob script (misc/cronjobs/automatic_renewals.pl)
Confirm that the issue has not been renewed (too late)
6/ Repeat step 2 with a due date set as 7 days before
7/ Execute the automatic renewals cronjob script (misc/cronjobs/automatic_renewals.pl)
Confirm that the issue has been renewed (issues.renewals has been
incremented and date_due has been updated according your circ rules).

Sponsored-by: University of the Arts London
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-11-02 10:28:57 +00:00

801 lines
40 KiB
Text

[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
//<![CDATA[
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").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() {
$(".delete").on("click",function(){
return confirmDelete(MSG_CONFIRM_DELETE);
});
$('#cap_fine_to_replacement_price').on('change', function(){
$('#overduefinescap').prop('disabled', $(this).is(':checked') );
});
$('#selectlibrary').find("input:submit").hide();
$('#branch').change(function() {
$('#selectlibrary').submit();
});
$(".editrule").click(function(){
if ( $(edit_row).find("input[type='text'][value!='']").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 == 6 ) {
// 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 == 12 ) {
// 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(/^\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 == 2 || i == 3 ) {
// If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
// 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();
});
});
//]]>
</script>
</head>
<body id="admin_smart-rules" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Circulation and fine rules</div>
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1 class="parameters">
[% IF humanbranch %]
Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) %]"
[% 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 type, same item type</li>
<li>same library, same patron type, all item types</li>
<li>same library, all patron types, same item type</li>
<li>same library, all patron types, all item types</li>
<li>default (all libraries), same patron type, same item type</li>
<li>default (all libraries), same patron type, all item types</li>
<li>default (all libraries), all patron types, same item type</li>
<li>default (all libraries), all patron types, all item types</li>
</ul>
<p>To modify a rule, create a new one with the same patron type and item type.</p>
</div>
<div>
<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="*">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 %]" />
<select name="tobranch" id="tobranch">
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
</select>
<input type="submit" value="Clone" />
</form>
[% 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 %]"/>
<table id="default-circulation-rules">
<thead>
<tr>
<th>Patron category</th>
<th>Item type</th>
<th>Current checkouts allowed</th>
<th>Current on-site checkouts allowed</th>
<th>Loan period</th>
<th>Unit</th>
<th>Hard due date</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>Renewals allowed (count)</th>
<th>Renewal period</th>
<th>No renewal before</th>
<th>Automatic renewal</th>
<th>No automatic renewal after</th>
<th>Holds allowed (count)</th>
<th>Holds per record (count)</th>
<th>On shelf holds allowed</th>
<th>Item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH rule IN rules %]
<tr id="row_[% loop.count %]">
<td>[% IF ( rule.default_humancategorycode ) %]
<em>All</em>
[% ELSE %]
[% rule.humancategorycode %]
[% END %]
</td>
<td>[% IF rule.default_translated_description %]
<em>All</em>
[% ELSE %]
[% rule.translated_description %]
[% END %]
</td>
<td>[% IF ( rule.unlimited_maxissueqty ) %]
Unlimited
[% ELSE %]
[% rule.maxissueqty %]
[% END %]
</td>
<td>[% IF rule.unlimited_maxonsiteissueqty %]
Unlimited
[% ELSE %]
[% rule.maxonsiteissueqty %]
[% END %]
</td>
<td>[% rule.issuelength %]</td>
<td>
[% rule.lengthunit %]
</td>
<td>
[% IF ( rule.hardduedate ) %]
[% IF ( rule.hardduedatebefore ) %]
before [% rule.hardduedate %]
<input type="hidden" name="hardduedatecomparebackup" value="-1" />
[% ELSIF ( rule.hardduedateexact ) %]
on [% rule.hardduedate %]
<input type="hidden" name="hardduedatecomparebackup" value="0" />
[% ELSIF ( rule.hardduedateafter ) %]
after [% rule.hardduedate %]
<input type="hidden" name="hardduedatecomparebackup" value="1" />
[% END %]
[% ELSE %]
None defined
[% END %]
</td>
<td>[% rule.fine %]</td>
<td>[% rule.chargeperiod %]</td>
<td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
<td>[% rule.firstremind %]</td>
<td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
<td>
[% IF rule.cap_fine_to_replacement_price %]
<input type="checkbox" checked="checked" disabled="disabled" />
[% ELSE %]
<input type="checkbox" disabled="disabled" />
[% END %]
</td>
<td>[% rule.finedays %]</td>
<td>[% rule.maxsuspensiondays %]</td>
<td>[% rule.renewalsallowed %]</td>
<td>[% rule.renewalperiod %]</td>
<td>[% rule.norenewalbefore %]</td>
<td>
[% IF ( rule.auto_renew ) %]
Yes
[% ELSE %]
No
[% END %]
</td>
<td>[% rule.no_auto_renewal_after %]</td>
<td>[% rule.reservesallowed %]</td>
<td>[% rule.holds_per_record %]</td>
<td>
[% IF rule.onshelfholds == 1 %]
Yes
[% ELSIF rule.onshelfholds == 2 %]
If all unavailable
[% ELSE %]
If any unavailable
[% END %]</td>
<td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
<td>
[% IF rule.article_requests == 'no' %]
No
[% ELSIF rule.article_requests == 'yes' %]
Yes
[% ELSIF rule.article_requests == 'bib_only' %]
Record only
[% ELSIF rule.article_requests == 'item_only' %]
Item only
[% END %]
</td>
<td>[% rule.rentaldiscount %]</td>
<td class="actions">
<a href="#" class="editrule btn btn-mini"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-mini delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
<tr id="edit_row">
<td>
<select name="categorycode" id="categorycode">
<option value="*">All</option>
[% FOREACH patron_category IN patron_categories%]
<option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
[% END %]
</select>
</td>
<td>
<select name="itemtype" id="matrixitemtype" style="width:13em;">
<option value="*">All</option>
[% FOREACH itemtypeloo IN itemtypeloop %]
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
[% END %]
</select>
</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="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 %]" class="datepicker" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</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="renewalsallowed" id="renewalsallowed" size="2" /></td>
<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" name="reservesallowed" id="reservesallowed" 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>
<td class="actions">
<input type="hidden" name="branch" value="[% current_branch %]"/>
<button type="submit" class="btn btn-mini"><i class="fa fa-save"></i> Save</button>
<button name="cancel" class="clear_edit btn btn-mini"><i class="fa fa-undo"></i> Clear</button>
</td>
</tr>
<tfoot>
<tr>
<th>Patron category</th>
<th>Item type</th>
<th>Current checkouts allowed</th>
<th>Current on-site checkouts allowed</th>
<th>Loan period</th>
<th>Unit</th>
<th>Hard due date</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>Renewals allowed (count)</th>
<th>Renewal period</th>
<th>No renewal before</th>
<th>Automatic renewal</th>
<th>No automatic renewal after</th>
<th>Holds allowed (count)</th>
<th>Holds per record (count)</th>
<th>On shelf holds allowed</th>
<th>Item level holds</th>
<th>Article requests</th>
<th>Rental discount (%)</th>
<th colspan="2">&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 ) %][% 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 %]"/>
<table>
<tr>
<th>&nbsp;</th>
<th>Total current checkouts allowed</th>
<th>Total current on-site checkouts allowed</th>
<th>Hold policy</th>
<th>Hold pickup library match</th>
<th>Return policy</th>
<th>Actions</th>
</tr>
<tr>
<td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
<td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
<td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
<td>
<select name="holdallowed">
[% IF ( default_holdallowed_any ) %]
<option value="2" selected="selected">
[% ELSE %]
<option value="2">
[% END %]
From any library
</option>
[% IF ( default_holdallowed_same ) %]
<option value="1" selected="selected">
[% ELSE %]
<option value="1">
[% END %]
From home library
</option>
[% IF ( default_holdallowed_none ) %]
<option value="0" selected="selected">
[% ELSE %]
<option value="0">
[% END %]
No holds allowed
</option>
</select>
</td>
<td>
<select name="hold_fulfillment_policy">
[% IF default_hold_fulfillment_policy == 'any' %]
<option value="any" selected="selected">
any library
</option>
[% ELSE %]
<option value="any">
any library
</option>
[% END %]
[% IF default_hold_fulfillment_policy == 'homebranch' %]
<option value="homebranch" selected="selected">
item's home library
</option>
[% ELSE %]
<option value="homebranch">
item's home library
</option>
[% END %]
[% IF default_hold_fulfillment_policy == '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">
[% IF ( default_returnbranch == 'homebranch' ) %]
<option value="homebranch" selected="selected">
[% ELSE %]
<option value="homebranch">
[% END %]
Item returns home
</option>
[% IF ( default_returnbranch == 'holdingbranch' ) %]
<option value="holdingbranch" selected="selected">
[% ELSE %]
<option value="holdingbranch">
[% END %]
Item returns to issuing library
</option>
[% IF ( default_returnbranch == '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-mini"><i class="fa fa-save"></i> Save</button>
<a class="btn btn-mini delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
</td>
</tr>
</table>
</form>
</div>
[% IF ( show_branch_cat_rule_form ) %]
<div id="holds-policy-by-patron-category" class="container">
<h3>[% IF humanbranch %]Checkout limit by patron category for [% Branches.GetName( humanbranch ) %][% ELSE %]Default checkout limit 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 %]"/>
<table>
<tr>
<th>Patron category</th>
<th>Total current checkouts allowed</th>
<th>Total current on-site checkouts allowed</th>
<th>&nbsp;</th>
</tr>
[% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
<em>Default</em>
[% ELSE %]
[% branch_cat_rule_loo.humancategorycode %]
[% END %]
</td>
<td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
Unlimited
[% ELSE %]
[% branch_cat_rule_loo.maxissueqty %]
[% END %]
</td>
<td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
Unlimited
[% ELSE %]
[% branch_cat_rule_loo.maxonsiteissueqty %]
[% END %]
</td>
<td class="actions">
<a class="btn btn-mini delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% branch_cat_rule_loo.categorycode %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
<tr>
<td>
<select name="categorycode">
[% FOREACH patron_category IN patron_categories%]
<option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
[% END %]
</select>
</td>
<td><input name="maxissueqty" size="3" /></td>
<td><input name="maxonsiteissueqty" size="3" /></td>
<td class="actions"><button type="submit" class="btn btn-mini"><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) %]</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 %]" />
<table>
<tr>
<th>Refund lost item fee</th>
<th>&nbsp;</th>
</tr>
<tr>
<td>
<select name="refund">
[#% Default branch %#]
[% IF ( current_branch == '*' ) %]
[% IF ( refundLostItemFeeRule.refund ) %]
<option value="1" selected="selected">
[% ELSE %]
<option value="1">
[% END %]
Yes
</option>
[% IF ( not refundLostItemFeeRule.refund ) %]
<option value="0" selected="selected">
[% ELSE %]
<option value="0">
[% END %]
No
</option>
[% ELSE %]
[#% Branch-specific %#]
[% IF ( not refundLostItemFeeRule ) %]
<option value="*" selected="selected">
[% ELSE %]
<option value="*">
[% END %]
[% IF defaultRefundRule %]
Use default (Yes)
[% ELSE %]
Use default (No)
[% END %]
</option>
[% IF ( not refundLostItemFeeRule ) %]
<option value="1">Yes</option>
<option value="0">No</option>
[% ELSE %]
[% IF ( refundLostItemFeeRule.refund ) %]
<option value="1" selected="selected">
[% ELSE %]
<option value="1">
[% END %]
Yes
</option>
[% IF ( not refundLostItemFeeRule.refund ) %]
<option value="0" selected="selected">
[% ELSE %]
<option value="0">
[% END %]
No
</option>
[% END %]
[% END %]
</select>
</td>
<td class="actions">
<button type="submit" class="btn btn-mini"><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 ) %][% 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 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 based on the patron's home library, not the library where the hold is being placed.
</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 %]"/>
<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 branch_item_rule_loo IN branch_item_rule_loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>[% IF ( branch_item_rule_loo.default_translated_description ) %]
<em>Default</em>
[% ELSE %]
[% branch_item_rule_loo.translated_description %]
[% END %]
</td>
<td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
From any library
[% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
From home library
[% ELSE %]
No holds allowed
[% END %]
</td>
<td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
any library
[% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
item's home library
[% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
item's holding library
[% END %]
</td>
<td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
Item returns home
[% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
Item returns to issuing branch
[% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
Item floats
[% ELSE %]
Error - unknown option
[% END %]
</td>
<td class="actions">
<a class="btn btn-mini delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=[% branch_item_rule_loo.itemtype %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
<tr>
<td>
<select name="itemtype">
[% FOREACH itemtypeloo IN itemtypeloop %]
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
[% END %]
</select>
</td>
<td>
<select name="holdallowed">
<option value="2">From any library</option>
<option value="1">From home library</option>
<option value="0">No holds allowed</option>
</select>
</td>
<td>
<select name="hold_fulfillment_policy">
<option value="any">
any library
</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-mini"><i class="fa fa-plus"></i> Add</button></td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]