|
Lines 83-88
Link Here
|
| 83 |
<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 |
83 |
<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 |
| 84 |
<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=HomeOrHoldingBranch">[% Koha.Preference('HomeOrHoldingBranch') | html %]</a>.</p |
84 |
<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=HomeOrHoldingBranch">[% Koha.Preference('HomeOrHoldingBranch') | html %]</a>.</p |
| 85 |
> |
85 |
> |
|
|
86 |
<p>The “Global checkout limits” section is designed to create a limit for all librairies, thus preventing checkouts accumulation.</p> |
| 86 |
</div> |
87 |
</div> |
| 87 |
|
88 |
|
| 88 |
<div class="page-section"> |
89 |
<div class="page-section"> |
|
Lines 890-895
Link Here
|
| 890 |
</div> |
891 |
</div> |
| 891 |
[% END %] |
892 |
[% END %] |
| 892 |
|
893 |
|
|
|
894 |
<div id="global_checkout_limits" class="page-section"> |
| 895 |
<h2>Global checkout limits</h2> |
| 896 |
<p>Specify checkout limits for all librairies.</p> |
| 897 |
<form id="set-global-checkouts-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
| 898 |
[% INCLUDE 'csrf-token.inc' %] |
| 899 |
<input type="hidden" name="op" value="cud-set-global-checkout-limits" /> |
| 900 |
<table id="global-checkout-limits-rules"> |
| 901 |
<thead> |
| 902 |
<tr> |
| 903 |
<th class="fixed_sort">Patron category</th> |
| 904 |
<th class="fixed_sort">Item type</th> |
| 905 |
<th class="noExport restricted-access">Actions</th> |
| 906 |
<th>Current checkouts allowed</th> |
| 907 |
<th>Current on-site checkouts allowed</th> |
| 908 |
</tr> |
| 909 |
</thead> |
| 910 |
<tbody> |
| 911 |
[% FOREACH c IN categorycodes %] |
| 912 |
[% SET c = '' UNLESS c.defined %] |
| 913 |
[% FOREACH i IN itemtypes %] |
| 914 |
[% SET i = '' UNLESS i.defined %] |
| 915 |
[% SET maxissueqty = CirculationRules.Search( '', c, i, 'maxissueqty', { want_rule => 1, has_priority => 1 } ) %] |
| 916 |
[% SET maxonsiteissueqty = CirculationRules.Search( '', c, i, 'maxonsiteissueqty', { want_rule => 1, has_priority => 1 } ) %] |
| 917 |
[% SET show_rule = maxissueqty || maxonsiteissueqty %] |
| 918 |
[% IF show_rule %] |
| 919 |
<tr> |
| 920 |
<td data-code="[% c | html %]"> |
| 921 |
[% IF c == undef %] |
| 922 |
<em>All</em> |
| 923 |
[% ELSE %] |
| 924 |
[% Categories.GetName(c) | html %] |
| 925 |
[% END %] |
| 926 |
</td> |
| 927 |
<td data-code="[% i | html %]"> |
| 928 |
[% IF i == undef %] |
| 929 |
<em>All</em> |
| 930 |
[% ELSE %] |
| 931 |
[% ItemTypes.GetDescription(i,1) | html %] |
| 932 |
[% END %] |
| 933 |
</td> |
| 934 |
<td class="actions restricted-access"> |
| 935 |
<a href="#" class="editrule-global-checkout-limits btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
| 936 |
<a href="#" class="delete-global-checkout-limits btn btn-default btn-xs" data-itemtype="[% i || '*' | html %]" data-categorycode="[% c || '*' | html %]" data-branch="*"><i class="fa fa-trash-can"></i> Delete</a> |
| 937 |
</td> |
| 938 |
<td> |
| 939 |
[% IF maxissueqty.rule_value && maxissueqty.rule_value != '' %] |
| 940 |
[% maxissueqty.rule_value | html %] |
| 941 |
[% ELSE %] |
| 942 |
<span>Not defined</span> |
| 943 |
[% END %] |
| 944 |
</td> |
| 945 |
<td> |
| 946 |
[% IF maxonsiteissueqty.rule_value && maxonsiteissueqty.rule_value != '' %] |
| 947 |
[% maxonsiteissueqty.rule_value | html %] |
| 948 |
[% ELSE %] |
| 949 |
<span>Not defined</span> |
| 950 |
[% END %] |
| 951 |
</td> |
| 952 |
</tr> |
| 953 |
[% END %] |
| 954 |
[% END %] |
| 955 |
[% END %] |
| 956 |
<tr class="noExport restricted-access" id="global_checkout_limits_edit_row"> |
| 957 |
<td> |
| 958 |
<select name="categorycode" id="global_checkout_limits_categorycode"> |
| 959 |
<option value="*">All</option> |
| 960 |
[% FOREACH patron_category IN patron_categories%] |
| 961 |
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> |
| 962 |
[% END %] |
| 963 |
</select> |
| 964 |
</td> |
| 965 |
<td> |
| 966 |
<select name="itemtype" id="global_checkout_limits_itemtype" style="width:13em;"> |
| 967 |
<option value="*">All</option> |
| 968 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
| 969 |
[% NEXT IF itemtypeloo.parent_type %] |
| 970 |
[% SET children = itemtypeloo.children_with_localization %] |
| 971 |
[% IF children.count %] |
| 972 |
<optgroup label="[% itemtypeloo.translated_description | html %]"> |
| 973 |
<option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option> |
| 974 |
[% FOREACH child IN children %] |
| 975 |
<option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option> |
| 976 |
[% END %] |
| 977 |
</optgroup> |
| 978 |
[% ELSE %] |
| 979 |
<option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option> |
| 980 |
[% END %] |
| 981 |
[% END %] |
| 982 |
</select> |
| 983 |
</td> |
| 984 |
<td class="actions"> |
| 985 |
<button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button> |
| 986 |
<button name="cancel" class="clear_edit_global_checkouts_limit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button> |
| 987 |
</td> |
| 988 |
<td><input type="text" name="maxissueqty" id="global_checkout_limits_maxissueqty" size="3" /></td> |
| 989 |
<td><input type="text" name="maxonsiteissueqty" id="global_checkout_limits_maxonsiteissueqty" size="3" /></td> |
| 990 |
</tr> |
| 991 |
</tbody> |
| 992 |
</table> |
| 993 |
</form> |
| 994 |
</div> |
| 995 |
|
| 893 |
<div id="waiting-hold-cancel-category" class="page-section"> |
996 |
<div id="waiting-hold-cancel-category" class="page-section"> |
| 894 |
[% IF humanbranch %] |
997 |
[% IF humanbranch %] |
| 895 |
<h2>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h2> |
998 |
<h2>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h2> |
|
Lines 1459-1465
Link Here
|
| 1459 |
}); |
1562 |
}); |
| 1460 |
}); |
1563 |
}); |
| 1461 |
|
1564 |
|
| 1462 |
function clear_edit() { |
1565 |
function clear_edit_form(editRowSelector, tableSelector) { |
| 1463 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
1566 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
| 1464 |
if (!cancel) return; |
1567 |
if (!cancel) return; |
| 1465 |
$("#default-circulation-rules tr").removeClass("highlighted-row"); |
1568 |
$("#default-circulation-rules tr").removeClass("highlighted-row"); |
|
Lines 1472-1489
Link Here
|
| 1472 |
$(this).val(""); |
1575 |
$(this).val(""); |
| 1473 |
$(this).prop("disabled", false); |
1576 |
$(this).prop("disabled", false); |
| 1474 |
} |
1577 |
} |
| 1475 |
if (type == "checkbox") { |
1578 |
if (type === "checkbox") { |
| 1476 |
$(this).prop("checked", false); |
1579 |
$(this).prop("checked", false); |
| 1477 |
} |
1580 |
} |
| 1478 |
}); |
1581 |
}); |
| 1479 |
$(edit_row).find("select").prop("disabled", false); |
1582 |
edit_row.find("select").prop('disabled', false); |
| 1480 |
$(edit_row).find("select option:selected").removeAttr("selected"); |
1583 |
edit_row.find("select option:selected").prop('selected', false); |
| 1481 |
$(edit_row).find("select option:first-child").attr("selected", "selected"); |
1584 |
edit_row.find("select option:first-child").prop("selected", true); |
| 1482 |
$(edit_row).find("td:last input[name='clear']").remove(); |
1585 |
edit_row.find("td:last input[name='clear']").remove(); |
| 1483 |
} |
1586 |
} |
| 1484 |
|
1587 |
|
| 1485 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
1588 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
| 1486 |
|
1589 |
$(".editrule-global-checkout-limits").click(function(){ |
|
|
1590 |
if ( $("#global_checkout_limits_edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) { |
| 1591 |
var edit = confirm(_("Are you sure you want to edit another rule?")); |
| 1592 |
if (!edit) return false; |
| 1593 |
} |
| 1594 |
$('#global-checkout-limits-rules td').removeClass('highlighted-row'); |
| 1595 |
$(this).parent().parent().find("td").each(function (i) { |
| 1596 |
$(this).addClass('highlighted-row'); |
| 1597 |
itm_code = $(this).data('code'); |
| 1598 |
itm_text = $(this).text(); |
| 1599 |
itm_text = itm_text.replace(/^\s*|\s*$/g,''); |
| 1600 |
var current_column = $("#global_checkout_limits_edit_row td:eq("+i+")"); |
| 1601 |
var current_input_id = $(current_column).children('input').first().attr('id'); |
| 1602 |
$(current_column).find("input[type='text']").val(itm_text); |
| 1603 |
// select the corresponding option |
| 1604 |
$(current_column).find("select option").each(function(){ |
| 1605 |
// Reset selection status for all options |
| 1606 |
$(this).prop('selected', false); |
| 1607 |
// Declare opt here to ensure it is scoped correctly within the loop |
| 1608 |
let opt = $(this).val(); |
| 1609 |
// Select the matching option |
| 1610 |
if (opt == itm_code) { |
| 1611 |
$(this).prop('selected', true); |
| 1612 |
} |
| 1613 |
}); |
| 1614 |
// After setting the correct option, update the select to reflect the change |
| 1615 |
$(current_column).find('select').trigger('change'); |
| 1616 |
if ( i == 0 || i == 1 ) { |
| 1617 |
// Disable the 2 first columns, we cannot update them. |
| 1618 |
var val = $(current_column).find("select option:selected").val(); |
| 1619 |
var name = "categorycode"; |
| 1620 |
if ( i == 1 ) { |
| 1621 |
name="itemtype"; |
| 1622 |
} |
| 1623 |
// Remove potential previous input added |
| 1624 |
$(current_column).find("input").remove(); |
| 1625 |
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
| 1626 |
} else if ( current_input_id === "global_checkout_limits_maxissueqty" || current_input_id === "global_checkout_limits_maxonsiteissueqty" ) { |
| 1627 |
// If the value is not an integer for |
| 1628 |
// - "Global current checkouts allowed" |
| 1629 |
// - "Global current on-site checkouts allowed" |
| 1630 |
// The value will be "Not defined" |
| 1631 |
if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) { |
| 1632 |
$(current_column).find("input[type='text']").val(""); |
| 1633 |
} |
| 1634 |
} |
| 1635 |
}); |
| 1636 |
return false; |
| 1637 |
}); |
| 1487 |
$(document).ready(function () { |
1638 |
$(document).ready(function () { |
| 1488 |
$('[data-bs-toggle="popover"]').popover(); |
1639 |
$('[data-bs-toggle="popover"]').popover(); |
| 1489 |
|
1640 |
|
|
Lines 1632-1639
Link Here
|
| 1632 |
}); |
1783 |
}); |
| 1633 |
$(".clear_edit").on("click", function (e) { |
1784 |
$(".clear_edit").on("click", function (e) { |
| 1634 |
e.preventDefault(); |
1785 |
e.preventDefault(); |
| 1635 |
clear_edit(); |
1786 |
clear_edit_form("#edit_row", "#default-circulation-rules"); |
| 1636 |
}); |
1787 |
}); |
|
|
1788 |
$(".clear_edit_global_checkouts_limit").on("click",function(e){ |
| 1789 |
e.preventDefault(); |
| 1790 |
clear_edit_form("#global_checkout_limits_edit_row", "#global-checkout-limits-rules"); |
| 1791 |
}); |
| 1637 |
|
1792 |
|
| 1638 |
$("#set-article-requests-daily-limit").on("submit", function () { |
1793 |
$("#set-article-requests-daily-limit").on("submit", function () { |
| 1639 |
if (!$("input[name='open_article_requests_limit'").val().length) { |
1794 |
if (!$("input[name='open_article_requests_limit'").val().length) { |
|
Lines 1724-1729
Link Here
|
| 1724 |
f.find("[name='branch']").val($(this).data("branch")); |
1879 |
f.find("[name='branch']").val($(this).data("branch")); |
| 1725 |
return f.submit(); |
1880 |
return f.submit(); |
| 1726 |
}); |
1881 |
}); |
|
|
1882 |
|
| 1883 |
$(".delete-global-checkout-limits").on("click", function(e){ |
| 1884 |
e.preventDefault(); |
| 1885 |
if ( !confirmDelete(MSG_CONFIRM_DELETE) ) { |
| 1886 |
return false; |
| 1887 |
} |
| 1888 |
let f = $("#delete_form"); |
| 1889 |
f.find("[name='op']").val('cud-delete-global-checkout-limits'); |
| 1890 |
f.find("[name='itemtype']").val($(this).data('itemtype')); |
| 1891 |
f.find("[name='categorycode']").val($(this).data('categorycode')); |
| 1892 |
f.find("[name='branch']").val($(this).data('branch')); |
| 1893 |
return f.submit(); |
| 1894 |
}); |
| 1895 |
|
| 1896 |
if($("#branch").val() != '*') { |
| 1897 |
var rowCount = $("#default-circulation-rules tbody tr").length; |
| 1898 |
if(rowCount == 1){ |
| 1899 |
$("#global_checkout_limits").remove(); |
| 1900 |
} else { |
| 1901 |
$("#global_checkout_limits .restricted-access").remove(); |
| 1902 |
} |
| 1903 |
} |
| 1727 |
}); |
1904 |
}); |
| 1728 |
</script> |
1905 |
</script> |
| 1729 |
[% END %] |
1906 |
[% END %] |
| 1730 |
- |
|
|