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

(-)a/admin/categories.pl (-1 / +1 lines)
Lines 70-76 elsif ( $op eq 'cud-add_validate' ) { Link Here
70
    my $hidelostitems = $input->param('hidelostitems');
70
    my $hidelostitems = $input->param('hidelostitems');
71
    my $overduenoticerequired = $input->param('overduenoticerequired');
71
    my $overduenoticerequired = $input->param('overduenoticerequired');
72
    my $category_type = $input->param('category_type');
72
    my $category_type = $input->param('category_type');
73
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
73
    my $BlockExpiredPatronOpacActions = join( ',', $input->multi_param('BlockExpiredPatronOpacActions') );
74
    my $checkPrevCheckout = $input->param('checkprevcheckout');
74
    my $checkPrevCheckout = $input->param('checkprevcheckout');
75
    my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1;
75
    my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1;
76
    my $default_privacy = $input->param('default_privacy');
76
    my $default_privacy = $input->param('default_privacy');
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/_forms.scss (+11 lines)
Lines 169-174 fieldset { Link Here
169
                    padding-left: 0;
169
                    padding-left: 0;
170
                }
170
                }
171
            }
171
            }
172
173
            div.ms-drop {
174
                label {
175
                    text-align: left;
176
                    width:auto;
177
                    span{
178
                        margin-left:5px;
179
                        width:auto;
180
                    }
181
                }
182
            }
172
        }
183
        }
173
184
174
        ol {
185
        ol {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-13 / +17 lines)
Lines 28-33 Link Here
28
    [% t("Koha") | html %]
28
    [% t("Koha") | html %]
29
[% END %]</title>
29
[% END %]</title>
30
[% INCLUDE 'doc-head-close.inc' %]
30
[% INCLUDE 'doc-head-close.inc' %]
31
[% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.min.css") | $raw %]
31
<style>#enrolmentmessage.hint { display : none; }</style>
32
<style>#enrolmentmessage.hint { display : none; }</style>
32
</head>
33
</head>
33
34
Lines 340-364 Link Here
340
                      [% END %]
341
                      [% END %]
341
                    </select>
342
                    </select>
342
                </li>
343
                </li>
343
                <li><label for="block_expired">Block expired patrons:</label>
344
                <li><label for="block_expired">Block expired patrons actions:</label>
344
                    <select name="BlockExpiredPatronOpacActions" id="block_expired">
345
                    <select name="BlockExpiredPatronOpacActions" id="block_expired" multiple="multiple">
345
                        [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
346
                        <optgroup label="Follow system preference">
346
                            <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
347
                        [% IF not category or category.BlockExpiredPatronOpacActions_contains('follow_syspref_BlockExpiredPatronOpacActions') %]
348
                            <option value="follow_syspref_BlockExpiredPatronOpacActions" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
347
                        [% ELSE %]
349
                        [% ELSE %]
348
                            <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
350
                            <option value="follow_syspref_BlockExpiredPatronOpacActions"> BlockExpiredPatronOpacActions </option>
349
                        [% END %]
351
                        [% END %]
350
352
                        </optgroup>
351
                        [% IF category and category.BlockExpiredPatronOpacActions == 1 %]
353
                        <optgroup label="Specific actions">
352
                            <option value="1" selected="selected"> Block </option>
354
                        [% IF category and category.BlockExpiredPatronOpacActions_contains('hold') %]
355
                            <option value="hold" selected="selected"> Placing a hold on an item </option>
353
                        [% ELSE %]
356
                        [% ELSE %]
354
                            <option value="1"> Block </option>
357
                            <option value="hold"> Placing a hold on an item </option>
355
                        [% END %]
358
                        [% END %]
356
359
                        [% IF category and category.BlockExpiredPatronOpacActions_contains('renew') %]
357
                        [% IF category and category.BlockExpiredPatronOpacActions == 0 %]
360
                            <option value="renew" selected="selected"> Renewing an item </option>
358
                            <option value="0" selected="selected"> Don't block </option>
359
                        [% ELSE %]
361
                        [% ELSE %]
360
                            <option value="0"> Don't block </option>
362
                            <option value="renew"> Renewing an item </option>
361
                        [% END %]
363
                        [% END %]
364
                        </optgroup>
362
                    </select>
365
                    </select>
363
                    <div class="hint">
366
                    <div class="hint">
364
                        Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
367
                        Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
Lines 751-756 Link Here
751
    </script>
754
    </script>
752
    [% Asset.js("js/admin-menu.js") | $raw %]
755
    [% Asset.js("js/admin-menu.js") | $raw %]
753
    [% Asset.js("js/messaging-preference-form.js") | $raw %]
756
    [% Asset.js("js/messaging-preference-form.js") | $raw %]
757
    [% Asset.js("lib/jquery/plugins/multiple-select/multiple-select.min.js") | $raw %]
754
    [% INCLUDE 'calendar.inc' %]
758
    [% INCLUDE 'calendar.inc' %]
755
    [% INCLUDE 'datatables.inc' %]
759
    [% INCLUDE 'datatables.inc' %]
756
    [% INCLUDE 'columns_settings.inc' %]
760
    [% INCLUDE 'columns_settings.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/categories.js (-43 / +90 lines)
Lines 1-45 Link Here
1
/* global __ */
1
/* global __ */
2
2
3
jQuery.validator.addMethod( "letters_numbers", function(value,element){
3
jQuery.validator.addMethod(
4
    var patt = /^[a-zA-Z0-9\-_]+$/g;
4
    "letters_numbers",
5
    if (patt.test(element.value)) {
5
    function (value, element) {
6
        return true;
6
        var patt = /^[a-zA-Z0-9\-_]+$/g;
7
    } else {
7
        if (patt.test(element.value)) {
8
        return false;
8
            return true;
9
    }
9
        } else {
10
    }, __("Category code can only contain the following characters: letters, numbers, - and _.")
10
            return false;
11
        }
12
    },
13
    __(
14
        "Category code can only contain the following characters: letters, numbers, - and _."
15
    )
11
);
16
);
12
17
13
jQuery.validator.addMethod( "enrollment_period", function(){
18
jQuery.validator.addMethod(
19
    "enrollment_period",
20
    function () {
14
        enrolmentperiod = $("#enrolmentperiod").val();
21
        enrolmentperiod = $("#enrolmentperiod").val();
15
        enrolmentperioddate = $("#enrolmentperioddate").val();
22
        enrolmentperioddate = $("#enrolmentperioddate").val();
16
        if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
23
        if (
24
            $("#enrolmentperiod").val() !== "" &&
25
            $("#enrolmentperioddate").val() !== ""
26
        ) {
17
            return false;
27
            return false;
18
        } else {
28
        } else {
19
            return true;
29
            return true;
20
        }
30
        }
21
    }, __("Please choose an enrollment period in months OR by date.")
31
    },
32
    __("Please choose an enrollment period in months OR by date.")
22
);
33
);
23
34
24
$(document).ready(function() {
35
$(document).ready(function () {
25
    KohaTable("patron_categories", {
36
    KohaTable(
26
        "columnDefs":  [{
37
        "patron_categories",
27
            "targets":  [-1],
38
        {
28
            "orderable":  false,
39
            columnDefs: [
29
            "searchable":  false
40
                {
30
        }, {
41
                    targets: [-1],
31
            "targets":  [3, 4, 5],
42
                    orderable: false,
32
            "type":  "natural"
43
                    searchable: false,
33
        }, ],
44
                },
34
        "pagingType":  "full",
45
                {
35
        "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
46
                    targets: [3, 4, 5],
36
    }, table_settings);
47
                    type: "natural",
48
                },
49
            ],
50
            pagingType: "full",
51
            exportColumns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
52
        },
53
        table_settings
54
    );
37
55
38
    if ($("#branches option:selected").length < 1) {
56
    if ($("#branches option:selected").length < 1) {
39
        $("#branches option:first").attr("selected", "selected");
57
        $("#branches option:first").attr("selected", "selected");
40
    }
58
    }
41
59
42
    $("#categorycode").on("blur",function(){
60
    $("#categorycode").on("blur", function () {
43
        toUC(this);
61
        toUC(this);
44
    });
62
    });
45
63
Lines 47-99 $(document).ready(function() { Link Here
47
        rules: {
65
        rules: {
48
            categorycode: {
66
            categorycode: {
49
                required: true,
67
                required: true,
50
                letters_numbers: true
68
                letters_numbers: true,
51
            },
69
            },
52
            description: "required",
70
            description: "required",
53
            enrolmentperiod: {
71
            enrolmentperiod: {
54
                required: function(element){
72
                required: function (element) {
55
                    return $("#enrolmentperioddate").val() === "";
73
                    return $("#enrolmentperioddate").val() === "";
56
                },
74
                },
57
                digits: true,
75
                digits: true,
58
                enrollment_period: true,
76
                enrollment_period: true,
59
                min: 1
77
                min: 1,
60
            },
78
            },
61
            enrolmentperioddate: {
79
            enrolmentperioddate: {
62
                required: function(element){
80
                required: function (element) {
63
                    return $("#enrolmentperiod").val() === "";
81
                    return $("#enrolmentperiod").val() === "";
64
                },
82
                },
65
                enrollment_period: true
83
                enrollment_period: true,
66
            },
84
            },
67
            password_expiry_days: {
85
            password_expiry_days: {
68
                digits: true
86
                digits: true,
69
            },
87
            },
70
            dateofbirthrequired: {
88
            dateofbirthrequired: {
71
                digits: true
89
                digits: true,
72
            },
90
            },
73
            upperagelimit: {
91
            upperagelimit: {
74
                digits: true
92
                digits: true,
75
            },
93
            },
76
            enrolmentfee: {
94
            enrolmentfee: {
77
                number: true
95
                number: true,
78
            },
96
            },
79
            reservefee: {
97
            reservefee: {
80
                number: true
98
                number: true,
81
            },
99
            },
82
            category_type: {
100
            category_type: {
83
                required: true
101
                required: true,
84
            },
102
            },
85
            min_password_length: {
103
            min_password_length: {
86
                digits: true
104
                digits: true,
87
            }
105
            },
88
        },
106
        },
89
        messages: {
107
        messages: {
90
            enrolmentperiod: {
108
            enrolmentperiod: {
91
                required: __("Please choose an enrollment period in months OR by date.")
109
                required: __(
110
                    "Please choose an enrollment period in months OR by date."
111
                ),
92
            },
112
            },
93
            enrolmentperioddate: {
113
            enrolmentperioddate: {
94
                required: __("Please choose an enrollment period in months OR by date.")
114
                required: __(
95
            }
115
                    "Please choose an enrollment period in months OR by date."
96
        }
116
                ),
117
            },
118
        },
119
    });
97
120
121
    let blocked_actions_select = $("select#block_expired[multiple='multiple']");
122
    blocked_actions_select.multipleSelect({
123
        placeholder: _("Please select ..."),
124
        selectAll: false,
125
        hideOptgroupCheckboxes: true,
126
        allSelected: _("All selected"),
127
        countSelected: _("# of % selected"),
128
        noMatchesFound: _("No matches found"),
129
        onClick: function (view) {
130
            if (
131
                view.value == "follow_syspref_BlockExpiredPatronOpacActions" &&
132
                view.selected
133
            ) {
134
                blocked_actions_select.multipleSelect("uncheck", "hold");
135
                blocked_actions_select.multipleSelect("uncheck", "renew");
136
            } else if (
137
                view.value != "follow_syspref_BlockExpiredPatronOpacActions" &&
138
                view.selected
139
            ) {
140
                blocked_actions_select.multipleSelect(
141
                    "uncheck",
142
                    "follow_syspref_BlockExpiredPatronOpacActions"
143
                );
144
            }
145
        },
98
    });
146
    });
99
});
147
});
100
- 

Return to bug 36453