|
Lines 73-225
Link Here
|
| 73 |
<p>The circulation and fine rules are applied based on the CircControl system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CircControl">[% Koha.Preference('CircControl') | html %]</a> and the HomeOrHoldingBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=HomeOrHoldingBranch">[% Koha.Preference('HomeOrHoldingBranch') | html %]</a>.</p> |
73 |
<p>The circulation and fine rules are applied based on the CircControl system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CircControl">[% Koha.Preference('CircControl') | html %]</a> and the HomeOrHoldingBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=HomeOrHoldingBranch">[% Koha.Preference('HomeOrHoldingBranch') | html %]</a>.</p> |
| 74 |
</div> |
74 |
</div> |
| 75 |
|
75 |
|
| 76 |
<div id="issuing-rules-tester" class="page-section"> |
76 |
[% INCLUDE 'circ-rule-tool.inc' %] |
| 77 |
<a id="toggle-tester" class="btn btn-default btn-sm">Circulation and fine rules test tool</a> |
|
|
| 78 |
<div id="issuing-rules-tester-container"> |
| 79 |
<h3>Circulation and fine rules test tool</h3> |
| 80 |
<p>This test tool lets you search a row of circulation and fine rules for a specific patron, item and library.</p> |
| 81 |
<p>Dropdown value for <strong>Library</strong> is determined via system preference <strong>CircControl</strong>. If the preference is set to item's library, then system preference <strong>HomeOrHoldingBranch</strong> defines the branch to use. You can test with any library by selecting the last option <i>Library</i>.</p> |
| 82 |
<table> |
| 83 |
<thead> |
| 84 |
<tr> |
| 85 |
<th>Patron</th> |
| 86 |
<th>Item</th> |
| 87 |
<th>Library</th> |
| 88 |
<th>Actions</th> |
| 89 |
</tr> |
| 90 |
</thead> |
| 91 |
<tbody> |
| 92 |
<tr> |
| 93 |
<td> |
| 94 |
<select id="tester_patron" name="tester_patron"> |
| 95 |
<option value="cardnumber">Card number</option> |
| 96 |
<option value="borrowernumber">Borrowernumber</option> |
| 97 |
<option value="categorycode">Categorycode</option> |
| 98 |
</select> |
| 99 |
<span><input type="text" name="tester_input_cardnumber" placeholder="Card number" /></span> |
| 100 |
<span><input type="text" name="tester_input_borrowernumber" placeholder="Borrowernumber" /></span> |
| 101 |
<span> |
| 102 |
<select name="tester_input_patron_category_id" id="tester_categorycode"> |
| 103 |
<option value="">All</option> |
| 104 |
[% FOREACH patron_category IN patron_categories%] |
| 105 |
<option value="[% patron_category.categorycode %]">[% patron_category.description %]</option> |
| 106 |
[% END %] |
| 107 |
</select> |
| 108 |
</span> |
| 109 |
</td> |
| 110 |
<td> |
| 111 |
<select id="tester_item" name="tester_item"> |
| 112 |
<option value="barcode">Barcode</option> |
| 113 |
<option value="itemnumber">Itemnumber</option> |
| 114 |
<option value="itemtype">Item type</option> |
| 115 |
</select> |
| 116 |
<span><input type="text" name="tester_input_barcode" placeholder="Barcode" /></span> |
| 117 |
<span><input type="text" name="tester_input_itemnumber" placeholder="Itemnumber" /></span> |
| 118 |
<span> |
| 119 |
<select name="tester_input_item_type_id" id="tester_itemtype"> |
| 120 |
<option value="">All</option> |
| 121 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
| 122 |
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option> |
| 123 |
[% END %] |
| 124 |
</select> |
| 125 |
</span> |
| 126 |
</td> |
| 127 |
<td> |
| 128 |
<select id="tester_branch" name="tester_branch"> |
| 129 |
[% IF Koha.Preference('CircControl') == 'PatronLibrary' %] |
| 130 |
<option value="patronlibrary">Patron's home library</option> |
| 131 |
[% ELSIF Koha.Preference('CircControl') == 'ItemHomeLibrary' %] |
| 132 |
[% IF Koha.Preference('HomeOrHoldingBranch') == 'homebranch' %] |
| 133 |
<option value="itemhomelibrary">Item's home library</option> |
| 134 |
[% ELSE %] |
| 135 |
<option value="itemholdinglibrary">Item's holding library</option> |
| 136 |
[% END %] |
| 137 |
[% ELSE %] |
| 138 |
<option value="pickuplibrary">Current library ([% LoginBranchname %])</option> |
| 139 |
[% END %] |
| 140 |
<option value="library">Library</option> |
| 141 |
</select> |
| 142 |
<span></span> |
| 143 |
<span> |
| 144 |
<select name="tester_input_library_id" id="tester_branchcode"> |
| 145 |
<option value="">All</option> |
| 146 |
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %] |
| 147 |
</select> |
| 148 |
</span> |
| 149 |
</td> |
| 150 |
<td><button type="submit" id="tester_submit" class="btn btn-default btn-xs"><i class="fa fa-search"></i> Find</button></td> |
| 151 |
</tr> |
| 152 |
</tbody> |
| 153 |
</table> |
| 154 |
<table> |
| 155 |
<thead> |
| 156 |
<tr> |
| 157 |
<th>Library</th> |
| 158 |
<th>Patron category</th> |
| 159 |
<th>Item type</th> |
| 160 |
<th>Current checkouts allowed</th> |
| 161 |
<th>Current on-site checkouts allowed</th> |
| 162 |
<th>Loan period</th> |
| 163 |
<th>Unit</th> |
| 164 |
<th>Hard due date</th> |
| 165 |
<th>Fine amount</th> |
| 166 |
<th>Fine charging interval</th> |
| 167 |
<th>When to charge</th> |
| 168 |
<th>Fine grace period</th> |
| 169 |
<th>Overdue fines cap (amount)</th> |
| 170 |
<th>Cap fine at replacement price</th> |
| 171 |
<th>Suspension in days (day)</th> |
| 172 |
<th>Max. suspension duration (day)</th> |
| 173 |
<th>Renewals allowed (count)</th> |
| 174 |
<th>Renewal period</th> |
| 175 |
<th>No renewal before</th> |
| 176 |
<th>Automatic renewal</th> |
| 177 |
<th>No automatic renewal after</th> |
| 178 |
<th>No automatic renewal after (hard limit)</th> |
| 179 |
<th>Holds allowed (count)</th> |
| 180 |
<th>Holds per record (count)</th> |
| 181 |
<th>On shelf holds allowed</th> |
| 182 |
<th>Item level holds</th> |
| 183 |
<th>Article requests</th> |
| 184 |
<th>Rental discount (%)</th> |
| 185 |
</tr> |
| 186 |
</thead> |
| 187 |
<tbody> |
| 188 |
<tr id="tester_res_results"> |
| 189 |
<td id="tester_res_branchcode"></td> |
| 190 |
<td id="tester_res_categorycode"></td> |
| 191 |
<td id="tester_res_itemtype"></td> |
| 192 |
<td id="tester_res_maxissueqty"></td> |
| 193 |
<td id="tester_res_maxonsiteissueqty"></td> |
| 194 |
<td id="tester_res_issuelength"></td> |
| 195 |
<td id="tester_res_lengthunit"></td> |
| 196 |
<td id="tester_res_hardduedate"></td> |
| 197 |
<td id="tester_res_fine"></td> |
| 198 |
<td id="tester_res_chargeperiod"></td> |
| 199 |
<td id="tester_res_chargeperiod_charge_at"></td> |
| 200 |
<td id="tester_res_firstremind"></td> |
| 201 |
<td id="tester_res_overduefinescap"></td> |
| 202 |
<td id="tester_res_cap_fine_to_replacement_price"></td> |
| 203 |
<td id="tester_res_finedays"></td> |
| 204 |
<td id="tester_res_maxsuspensiondays"></td> |
| 205 |
<td id="tester_res_renewalsallowed"></td> |
| 206 |
<td id="tester_res_renewalperiod"></td> |
| 207 |
<td id="tester_res_norenewalbefore"></td> |
| 208 |
<td id="tester_res_auto_renew"></td> |
| 209 |
<td id="tester_res_no_auto_renewal_after"></td> |
| 210 |
<td id="tester_res_no_auto_renewal_after_hard_limit"></td> |
| 211 |
<td id="tester_res_reservesallowed"></td> |
| 212 |
<td id="tester_res_holds_per_record"></td> |
| 213 |
<td id="tester_res_onshelfholds"></td> |
| 214 |
<td id="tester_res_opacitemholds"></td> |
| 215 |
<td id="tester_res_article_requests"></td> |
| 216 |
<td id="tester_res_rentaldiscount"></td> |
| 217 |
</tr> |
| 218 |
</tbody> |
| 219 |
</table> |
| 220 |
<div id="tester_error" class="alert alert-danger"></div> |
| 221 |
</div> |
| 222 |
</div> |
| 223 |
|
77 |
|
| 224 |
<div class="page-section"> |
78 |
<div class="page-section"> |
| 225 |
[% UNLESS restricted_to_own_library %] |
79 |
[% UNLESS restricted_to_own_library %] |
|
Lines 1580-1585
Link Here
|
| 1580 |
|
1434 |
|
| 1581 |
[% MACRO jsinclude BLOCK %] |
1435 |
[% MACRO jsinclude BLOCK %] |
| 1582 |
[% Asset.js("js/admin-menu.js") | $raw %] |
1436 |
[% Asset.js("js/admin-menu.js") | $raw %] |
|
|
1437 |
[% Asset.js("js/circ-rule-tool.js") | $raw %] |
| 1583 |
[% INCLUDE 'datatables.inc' %] |
1438 |
[% INCLUDE 'datatables.inc' %] |
| 1584 |
[% INCLUDE 'calendar.inc' %] |
1439 |
[% INCLUDE 'calendar.inc' %] |
| 1585 |
[% INCLUDE 'columns_settings.inc' %] |
1440 |
[% INCLUDE 'columns_settings.inc' %] |
|
Lines 1617-1704
Link Here
|
| 1617 |
$(edit_row).find("td:last input[name='clear']").remove(); |
1472 |
$(edit_row).find("td:last input[name='clear']").remove(); |
| 1618 |
} |
1473 |
} |
| 1619 |
|
1474 |
|
| 1620 |
function change_tester_input(el) { |
|
|
| 1621 |
$(el).parent().find("span").css("display", "none"); |
| 1622 |
$(el).parent().find("span").eq($("option:selected", el).index()).css("display", "inline"); |
| 1623 |
} |
| 1624 |
|
| 1625 |
function reset_tester_results() { |
| 1626 |
$("td[id^='tester_res_']").each(function() { |
| 1627 |
$(this).html(""); |
| 1628 |
}); |
| 1629 |
} |
| 1630 |
|
| 1631 |
function tester_submit() { |
| 1632 |
var query_params = {}; |
| 1633 |
$.each($("input[name^=tester_input_], select[name^=tester_input_]"), function () { |
| 1634 |
if ($(this).parent().css("display") === "none") { |
| 1635 |
return true; |
| 1636 |
} |
| 1637 |
var param = $(this).attr("name").replace("tester_input_", ""); |
| 1638 |
if ($(this).val() || param === 'branchcode' && !$(this).val()) { |
| 1639 |
query_params[param] = $(this).val(); |
| 1640 |
} |
| 1641 |
}); |
| 1642 |
$.ajax({ |
| 1643 |
url: "/api/v1/circulation_rules?"+$.param(query_params), |
| 1644 |
method: "GET", |
| 1645 |
statusCode: { |
| 1646 |
200: function(response) { |
| 1647 |
$("#tester_error").html("").css("display","none"); |
| 1648 |
$.each(response, function (key,val) { |
| 1649 |
if (key === "hardduedate") { |
| 1650 |
var compare; |
| 1651 |
switch (response.hardduedatecompare) { |
| 1652 |
case -1: |
| 1653 |
compare = _("Before"); |
| 1654 |
break; |
| 1655 |
case 0: |
| 1656 |
compare = _("Exactly on"); |
| 1657 |
break; |
| 1658 |
case 1: |
| 1659 |
compare = _("After"); |
| 1660 |
break; |
| 1661 |
default: |
| 1662 |
compare = _("Exactly on"); |
| 1663 |
break; |
| 1664 |
} |
| 1665 |
val = "("+compare+") " + response.hardduedate; |
| 1666 |
} |
| 1667 |
if (val === "*") { |
| 1668 |
val = _("All"); |
| 1669 |
} |
| 1670 |
$("#tester_res_"+key).html("" + val); |
| 1671 |
}); |
| 1672 |
}, |
| 1673 |
400: function(xhr) { |
| 1674 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1675 |
reset_tester_results(); |
| 1676 |
}, |
| 1677 |
404: function(xhr) { |
| 1678 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1679 |
reset_tester_results(); |
| 1680 |
}, |
| 1681 |
401: function(xhr) { |
| 1682 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1683 |
reset_tester_results(); |
| 1684 |
}, |
| 1685 |
403: function(xhr) { |
| 1686 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1687 |
reset_tester_results(); |
| 1688 |
}, |
| 1689 |
500: function(xhr) { |
| 1690 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1691 |
reset_tester_results(); |
| 1692 |
}, |
| 1693 |
503: function(xhr) { |
| 1694 |
$("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block"); |
| 1695 |
reset_tester_results(); |
| 1696 |
} |
| 1697 |
}, |
| 1698 |
dataType: "json" |
| 1699 |
}); |
| 1700 |
} |
| 1701 |
|
| 1702 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
1475 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
| 1703 |
|
1476 |
|
| 1704 |
$(document).ready(function() { |
1477 |
$(document).ready(function() { |
|
Lines 1908-1932
Link Here
|
| 1908 |
f.find("[name='branch']").val($(this).data('branch')); |
1681 |
f.find("[name='branch']").val($(this).data('branch')); |
| 1909 |
return f.submit(); |
1682 |
return f.submit(); |
| 1910 |
}); |
1683 |
}); |
| 1911 |
|
|
|
| 1912 |
$("#issuing-rules-tester-container").css("display", "none"); |
| 1913 |
$("#toggle-tester").click(function() { |
| 1914 |
$("#issuing-rules-tester-container").toggle(); |
| 1915 |
}); |
| 1916 |
$("#tester_patron").val("cardnumber"); |
| 1917 |
$("#tester_item").val("barcode"); |
| 1918 |
$("#tester_branch").val($("#tester_branch option:first").val()); |
| 1919 |
change_tester_input($("#tester_patron")); |
| 1920 |
change_tester_input($("#tester_item")); |
| 1921 |
change_tester_input($("#tester_branch")); |
| 1922 |
$("select[id^='tester_']").change(function(e) { |
| 1923 |
change_tester_input(this); |
| 1924 |
}); |
| 1925 |
|
| 1926 |
tester_submit(); |
| 1927 |
$("#tester_submit").click(function () { |
| 1928 |
tester_submit(); |
| 1929 |
}); |
| 1930 |
}); |
1684 |
}); |
| 1931 |
</script> |
1685 |
</script> |
| 1932 |
[% END %] |
1686 |
[% END %] |