@@ -, +, @@ "Circulation and fine rules test tool" (CircControl and HomeOrHoldingBranch system preferences affects the result) --- .../prog/en/modules/admin/smart-rules.tt | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -612,6 +612,154 @@ +
This test tool lets you search a row of circulation and fine rules for a specific patron, item and library.
+Dropdown value for Library is determined via system preference CircControl. If the preference is set to item's library, then system preference HomeOrHoldingBranch defines the branch to use. You can test with any library by selecting the last option Library.
+Patron | +Item | +Library | +Actions | +
---|---|---|---|
+ + + + + + + | ++ + + + + + + | ++ + + + + + | ++ |
Library | +Patron category | +Item type | +Current checkouts allowed | +Current on-site checkouts allowed | +Loan period | +Unit | +Hard due date | +Fine amount | +Fine charging interval | +When to charge | +Fine grace period | +Overdue fines cap (amount) | +Cap fine at replacement price | +Suspension in days (day) | +Max. suspension duration (day) | +Renewals allowed (count) | +Renewal period | +No renewal before | +Automatic renewal | +No automatic renewal after | +No automatic renewal after (hard limit) | +Holds allowed (count) | +Holds per record (count) | +On shelf holds allowed | +Item level holds | +Article requests | +Rental discount (%) | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + |
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.
@@ -1468,6 +1616,89 @@ $(edit_row).find("td:last input[name='clear']").remove(); } + function change_tester_input(el) { + $(el).parent().find("span").css("display", "none"); + $(el).parent().find("span").eq($("option:selected", el).index()).css("display", "inline"); + } + + function reset_tester_results() { + $("td[id^='tester_res_']").each(function() { + $(this).html(""); + }); + } + + function tester_submit() { + var url = "/api/v1/issuingrules/effective"; + var query_params = {}; + $.each($("input[name^=tester_input_], select[name^=tester_input_]"), function () { + if ($(this).parent().css("display") === "none") { + return true; + } + var param = $(this).attr("name").replace("tester_input_", ""); + if ($(this).val() || param === 'branchcode' && !$(this).val()) { + query_params[param] = $(this).val(); + } + }); + $.ajax({ + url: "/api/v1/issuingrules/effective?"+$.param(query_params), + method: "GET", + statusCode: { + 200: function(response) { + $("#tester_error").html("").css("display","none"); + $.each(response, function (key,val) { + if (key === "hardduedate") { + var compare; + switch (response.hardduedatecompare) { + case -1: + compare = _("Before"); + break; + case 0: + compare = _("Exactly on"); + break; + case 1: + compare = _("After"); + break; + default: + compare = _("Exactly on"); + break; + } + val = "("+compare+") " + response.hardduedate; + } + if (val === "*") { + val = _("All"); + } + $("#tester_res_"+key).html("" + val); + }); + }, + 400: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + }, + 404: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + }, + 401: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + }, + 403: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + }, + 500: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + }, + 503: function(xhr) { + $("#tester_error").html(' ' + xhr.responseJSON.error).css("display", "block"); + reset_tester_results(); + } + }, + dataType: "json" + }); + } + var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); $(document).ready(function() { @@ -1678,6 +1909,24 @@ return f.submit(); }); + $("#issuing-rules-tester-container").css("display", "none"); + $("#toggle-tester").click(function() { + $("#issuing-rules-tester-container").toggle(); + }); + $("#tester_patron").val("cardnumber"); + $("#tester_item").val("barcode"); + $("#tester_branch").val($("#tester_branch option:first").val()); + change_tester_input($("#tester_patron")); + change_tester_input($("#tester_item")); + change_tester_input($("#tester_branch")); + $("select[id^='tester_']").change(function(e) { + change_tester_input(this); + }); + + tester_submit(); + $("#tester_submit").click(function () { + tester_submit(); + }); }); [% END %] --