View | Details | Raw Unified | Return to bug 26814
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +38 lines)
Lines 1012-1017 Link Here
1012
            $(edit_row).find("td:last input[name='clear']").remove();
1012
            $(edit_row).find("td:last input[name='clear']").remove();
1013
        }
1013
        }
1014
1014
1015
        function disable_onsite_checkout_hold_rules() {
1016
            var onsite_checkout = $("#edit_row").find("select[name='onsite_checkout']");
1017
1018
            var CANNOT_SET_HOLD_RULES_FOR_ONSITE_CHECKOUT =
1019
                _("Cannot set this rule when on-site checkout is defined");
1020
1021
            var hold_related_rule_els = [
1022
                $("input#reservesallowed"),
1023
                $("input#holds_per_record"),
1024
                $("input#holds_per_day"),
1025
                $("select#onshelfholds"),
1026
                $("select#opacitemholds"),
1027
                $("select#article_requests")
1028
            ];
1029
1030
            // when onsite_checkout is selected (any other value than *),
1031
            // disable hold related input fields, because it makes no sense
1032
            // to set hold rules for a specific type of checkout
1033
            $.each(hold_related_rule_els, function (i, field) {
1034
                if (onsite_checkout.val() !== "*") {
1035
                    $(field).attr("disabled", "disabled");
1036
                    $(field).val("");
1037
                    $(field).after('<span class="hold_rule_disabled error">' + CANNOT_SET_HOLD_RULES_FOR_ONSITE_CHECKOUT + "</span>")
1038
                } else {
1039
                    $(field).removeAttr("disabled");
1040
                    $("span.hold_rule_disabled").remove();
1041
                }
1042
            });
1043
        }
1044
1015
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1045
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1016
1046
1017
        $(document).ready(function() {
1047
        $(document).ready(function() {
Lines 1112-1119 Link Here
1112
                $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1142
                $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1113
                $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1143
                $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1114
                $("#default-circulation-rules tr:last td:eq(2) select").prop('disabled', true);
1144
                $("#default-circulation-rules tr:last td:eq(2) select").prop('disabled', true);
1145
1146
                disable_onsite_checkout_hold_rules();
1147
1115
                return false;
1148
                return false;
1116
            });
1149
            });
1150
1151
            $("select[id='matrixonsite_checkout']").change(function () {
1152
                disable_onsite_checkout_hold_rules();
1153
            });
1154
1117
            $(".clear_edit").on("click",function(e){
1155
            $(".clear_edit").on("click",function(e){
1118
                e.preventDefault();
1156
                e.preventDefault();
1119
                clear_edit();
1157
                clear_edit();
1120
- 

Return to bug 26814