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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt (-38 / +42 lines)
Lines 1-48 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Library checkin and transfer policy</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Library checkin and transfer policy</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6
[% INCLUDE 'datatables.inc' %]
7
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8
<script type="text/javascript">
9
//<![CDATA[
10
	$(document).ready(function(){
11
        $("#CheckAll").click(function(){ $("#transferlimit_tabs").checkCheckboxes(); return false; });
12
        $("#UncheckAll").click(function(){ $("#transferlimit_tabs").unCheckCheckboxes(); return false; });
13
        $('#transferlimit_tabs').tabs();
14
15
		 $('#branchselect').change(function() {
16
		    $('#selectlibrary').submit();
17
		 });
18
19
		var checkall = $(".checkall");
20
		var uncheckall = $(".uncheckall");
21
22
		$(checkall).click(function(){
23
			var tid = $(this).attr("id");
24
			tid = tid.replace("CheckAll","");
25
			$("#"+tid).checkCheckboxes();
26
			return false;
27
		});
28
29
		$(uncheckall).click(function(){
30
			var tid = $(this).attr("id");
31
			tid = tid.replace("UncheckAll","");
32
			$("#"+tid).unCheckCheckboxes();
33
			return false;
34
		});
35
        $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
36
            "aoColumnDefs": [
37
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
38
            ],
39
            'bPaginate': false
40
        }));
41
	});
42
//]]>
43
</script>
44
<style type="text/css">td { text-align: center; } .sorted { min-width: 50%; }</style>
7
<style type="text/css">td { text-align: center; } .sorted { min-width: 50%; }</style>
45
</head>
8
</head>
9
46
<body id="admin_branch_transfer_limits" class="admin">
10
<body id="admin_branch_transfer_limits" class="admin">
47
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
48
[% INCLUDE 'prefs-admin-search.inc' %]
12
[% INCLUDE 'prefs-admin-search.inc' %]
Lines 119-122 Link Here
119
  [% INCLUDE 'admin-menu.inc' %]
83
  [% INCLUDE 'admin-menu.inc' %]
120
</div>
84
</div>
121
</div>
85
</div>
86
87
[% MACRO jsinclude BLOCK %]
88
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
89
    [% INCLUDE 'datatables.inc' %]
90
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
91
    <script type="text/javascript">
92
        $(document).ready(function(){
93
            $("#CheckAll").click(function(){ $("#transferlimit_tabs").checkCheckboxes(); return false; });
94
            $("#UncheckAll").click(function(){ $("#transferlimit_tabs").unCheckCheckboxes(); return false; });
95
            $('#transferlimit_tabs').tabs();
96
97
             $('#branchselect').change(function() {
98
                $('#selectlibrary').submit();
99
             });
100
101
            var checkall = $(".checkall");
102
            var uncheckall = $(".uncheckall");
103
104
            $(checkall).click(function(){
105
                var tid = $(this).attr("id");
106
                tid = tid.replace("CheckAll","");
107
                $("#"+tid).checkCheckboxes();
108
                return false;
109
            });
110
111
            $(uncheckall).click(function(){
112
                var tid = $(this).attr("id");
113
                tid = tid.replace("UncheckAll","");
114
                $("#"+tid).unCheckCheckboxes();
115
                return false;
116
            });
117
            $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
118
                "aoColumnDefs": [
119
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
120
                ],
121
                'bPaginate': false
122
            }));
123
        });
124
    </script>
125
[% END %]
122
[% INCLUDE 'intranet-bottom.inc' %]
126
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-7 / +14 lines)
Lines 1-21 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Price %]
3
[% USE Price %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
6
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
6
[% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
7
[% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
7
</title>
8
</title>
8
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'calendar.inc' %]
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript">
13
    var MSG_BOTH_ENROLLMENTPERIODS = _("Please choose only one enrollment period setting.");
14
    var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
15
</script>
16
<script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
17
<style type="text/css">#enrolmentmessage.hint { display : none; }</style>
11
<style type="text/css">#enrolmentmessage.hint { display : none; }</style>
18
</head>
12
</head>
13
19
<body id="admin_categorie" class="admin">
14
<body id="admin_categorie" class="admin">
20
[% INCLUDE 'header.inc' %]
15
[% INCLUDE 'header.inc' %]
21
[% INCLUDE 'patrons-admin-search.inc' %]
16
[% INCLUDE 'patrons-admin-search.inc' %]
Lines 494-497 Link Here
494
[% INCLUDE 'admin-menu.inc' %]
489
[% INCLUDE 'admin-menu.inc' %]
495
</div>
490
</div>
496
</div>
491
</div>
492
493
[% MACRO jsinclude BLOCK %]
494
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
495
    [% INCLUDE 'calendar.inc' %]
496
    [% INCLUDE 'datatables.inc' %]
497
    <script type="text/javascript">
498
        var MSG_CATEGORYCODE_CHARS = _("Category code can only contain the following characters: letters, numbers, - and _.");
499
        var MSG_BOTH_ENROLLMENTPERIODS = _("Please choose only one enrollment period setting.");
500
        var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
501
    </script>
502
    <script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
503
[% END %]
497
[% INCLUDE 'intranet-bottom.inc' %]
504
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt (-16 / +19 lines)
Lines 1-23 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Cities &rsaquo; [% IF city.cityid %] Modify city[% ELSE %] New city[% END %][% ELSE %][% IF op == 'delete_confirm' %]Cities &rsaquo; Confirm deletion of city[% ELSE %] Cities[% END %][% END %]</title>
3
<title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Cities &rsaquo; [% IF city.cityid %] Modify city[% ELSE %] New city[% END %][% ELSE %][% IF op == 'delete_confirm' %]Cities &rsaquo; Confirm deletion of city[% ELSE %] Cities[% END %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
4
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
5
[% INCLUDE 'datatables.inc' %]
6
<script type="text/javascript">
7
//<![CDATA[
8
    $(document).ready(function() {
9
        $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, {
10
            "aoColumnDefs": [
11
                { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
12
            ],
13
            "aaSorting": [[ 1, "asc" ]],
14
            "iDisplayLength": 10,
15
            "sPaginationType": "full_numbers"
16
        }));
17
    });
18
//]]>
19
</script>
20
</head>
6
</head>
7
21
<body id="admin_cities" class="admin">
8
<body id="admin_cities" class="admin">
22
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'cities-admin-search.inc' %]
10
[% INCLUDE 'cities-admin-search.inc' %]
Lines 185-189 Link Here
185
[% INCLUDE 'admin-menu.inc' %]
172
[% INCLUDE 'admin-menu.inc' %]
186
</div>
173
</div>
187
</div>
174
</div>
188
[% INCLUDE 'intranet-bottom.inc' %]
189
175
176
[% MACRO jsinclude BLOCK %]
177
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
178
    [% INCLUDE 'datatables.inc' %]
179
    <script type="text/javascript">
180
        $(document).ready(function() {
181
            $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, {
182
                "aoColumnDefs": [
183
                    { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
184
                ],
185
                "aaSorting": [[ 1, "asc" ]],
186
                "iDisplayLength": 10,
187
                "sPaginationType": "full_numbers"
188
            }));
189
        });
190
    </script>
191
[% END %]
192
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt (-48 / +53 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Item circulation alerts</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Item circulation alerts</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 37-91 table.grid td.default { Link Here
37
  background: #f88;
38
  background: #f88;
38
}
39
}
39
</style>
40
</style>
40
41
<script type="text/javascript">//<![CDATA[
42
var $branch = "[% branch %]";
43
$(function(){
44
    $('#alerttabs').tabs();
45
46
    var blocked            = _("Blocked!");
47
    var saving             = _("Saving...");
48
    var disabledForAll     = _("Disabled for all");
49
    var disabledForCurrent = _("Disabled for %s").format($branch);
50
51
    $('#branch_selector input:submit').hide();
52
    $('#branch').change(function(){
53
        $('#branch_selector').submit();
54
    });
55
56
    $('table.grid.active tbody td').click(function(ev){
57
        var id = this.id;
58
        var td = $(this);
59
        if (td.hasClass('default') && $branch != '*') {
60
            td.html(blocked);
61
            window.setTimeout(
62
              function(){ td.html(disabledForAll) },
63
              3000
64
            );
65
        } else {
66
            td.html(saving);
67
            $.ajax({
68
                url      : '/cgi-bin/koha/admin/item_circulation_alerts.pl',
69
                type     : 'POST',
70
                dataType : 'json',
71
                data     : { action: 'toggle', id: id, branch: $branch },
72
                success  : function(response){
73
                    if ($branch == '*' && response.classes.match(/default/)) {
74
                        td.html(disabledForAll);
75
                    } else if (response.classes.match(/disabled/)) {
76
                        td.html(disabledForCurrent);
77
                    } else {
78
                        td.html(' ');
79
                    }
80
                    td.attr('class', response.classes);
81
                }
82
            });
83
        }
84
    });
85
86
}); //]]>
87
</script>
88
</head>
41
</head>
42
89
<body id="admin_item_circulation_alerts" class="admin">
43
<body id="admin_item_circulation_alerts" class="admin">
90
[% INCLUDE 'header.inc' %]
44
[% INCLUDE 'header.inc' %]
91
[% INCLUDE 'prefs-admin-search.inc' %]
45
[% INCLUDE 'prefs-admin-search.inc' %]
Lines 202-205 $(function(){ Link Here
202
[% INCLUDE 'admin-menu.inc' %]
156
[% INCLUDE 'admin-menu.inc' %]
203
</div>
157
</div>
204
</div>
158
</div>
159
160
[% MACRO jsinclude BLOCK %]
161
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
162
    <script type="text/javascript">
163
        var $branch = "[% branch %]";
164
        $(function(){
165
            $('#alerttabs').tabs();
166
167
            var blocked            = _("Blocked!");
168
            var saving             = _("Saving...");
169
            var disabledForAll     = _("Disabled for all");
170
            var disabledForCurrent = _("Disabled for %s").format($branch);
171
172
            $('#branch_selector input:submit').hide();
173
            $('#branch').change(function(){
174
                $('#branch_selector').submit();
175
            });
176
177
            $('table.grid.active tbody td').click(function(ev){
178
                var id = this.id;
179
                var td = $(this);
180
                if (td.hasClass('default') && $branch != '*') {
181
                    td.html(blocked);
182
                    window.setTimeout(
183
                      function(){ td.html(disabledForAll) },
184
                      3000
185
                    );
186
                } else {
187
                    td.html(saving);
188
                    $.ajax({
189
                        url      : '/cgi-bin/koha/admin/item_circulation_alerts.pl',
190
                        type     : 'POST',
191
                        dataType : 'json',
192
                        data     : { action: 'toggle', id: id, branch: $branch },
193
                        success  : function(response){
194
                            if ($branch == '*' && response.classes.match(/default/)) {
195
                                td.html(disabledForAll);
196
                            } else if (response.classes.match(/disabled/)) {
197
                                td.html(disabledForCurrent);
198
                            } else {
199
                                td.html(' ');
200
                            }
201
                            td.attr('class', response.classes);
202
                        }
203
                    });
204
                }
205
            });
206
207
        });
208
    </script>
209
[% END %]
205
[% INCLUDE 'intranet-bottom.inc' %]
210
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-18 / +21 lines)
Lines 1-4 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Patron attribute types
4
<title>Koha &rsaquo; Administration &rsaquo; Patron attribute types
4
[% IF ( attribute_type_form ) %]
5
[% IF ( attribute_type_form ) %]
Lines 13-37 Link Here
13
[% END %]
14
[% END %]
14
</title>
15
</title>
15
[% INCLUDE 'doc-head-close.inc' %]
16
[% INCLUDE 'doc-head-close.inc' %]
16
17
<script type="text/javascript">
18
//<![CDATA[
19
$(document).ready(function() {
20
    if ( $("#branches option:selected").length < 1 ) {
21
        $("#branches option:first").attr("selected", "selected");
22
    }
23
24
    $("#opac_display").change( function() {
25
        if ( this.checked ) {
26
            $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
27
        } else {
28
            $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
29
        }
30
    } ).change();
31
} );
32
//]]>
33
</script>
34
</head>
17
</head>
18
35
<body id="admin_patron-attr-types" class="admin">
19
<body id="admin_patron-attr-types" class="admin">
36
[% INCLUDE 'header.inc' %]
20
[% INCLUDE 'header.inc' %]
37
[% INCLUDE 'prefs-admin-search.inc' %]
21
[% INCLUDE 'prefs-admin-search.inc' %]
Lines 313-316 $(document).ready(function() { Link Here
313
[% INCLUDE 'admin-menu.inc' %]
297
[% INCLUDE 'admin-menu.inc' %]
314
</div>
298
</div>
315
</div>
299
</div>
300
301
[% MACRO jsinclude BLOCK %]
302
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
303
    <script type="text/javascript">
304
        $(document).ready(function() {
305
            if ( $("#branches option:selected").length < 1 ) {
306
                $("#branches option:first").attr("selected", "selected");
307
            }
308
309
            $("#opac_display").change( function() {
310
                if ( this.checked ) {
311
                    $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
312
                } else {
313
                    $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
314
                }
315
            } ).change();
316
        });
317
    </script>
318
[% END %]
316
[% INCLUDE 'intranet-bottom.inc' %]
319
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-122 / +125 lines)
Lines 1-130 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
<script type="text/javascript">
7
//<![CDATA[
8
9
function clear_edit(){
10
    var cancel = confirm(_("Are you sure you want to cancel your changes?"));
11
    if ( !cancel ) return;
12
    $('#default-circulation-rules td').removeClass('highlighted-row');
13
    var edit_row = $("#edit_row");
14
    $(edit_row).find("input").each(function(){
15
        var type = $(this).attr("type");
16
        if (type != "button" && type != "submit" ) {
17
            $(this).val("");
18
            $(this).prop('disabled', false);
19
        }
20
        if ( type == "checkbox" ) {
21
            $(this).prop('checked', false);
22
        }
23
    });
24
    $(edit_row).find("select").prop('disabled', false);
25
    $(edit_row).find("select option:first").attr("selected", "selected");
26
    $(edit_row).find("td:last input[name='clear']").remove();
27
}
28
29
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
30
31
32
$(document).ready(function() {
33
    $(".delete").on("click",function(){
34
        return confirmDelete(MSG_CONFIRM_DELETE);
35
    });
36
37
    $("#clone_rules").on("click",function(){
38
        var library_dropdown = document.getElementById("branch");
39
        var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
40
        var selected_library_text = $("#branch option:selected").text();
41
        var to_library = $("#tobranch option:selected").text();
42
        var MSG_CONFIRM_CLONE;
43
        if (selected_library === "*") {
44
            MSG_CONFIRM_CLONE = _("Are you sure you want to clone this standard rule to %s library? This will override the existing rules in this library.").format(to_library);
45
            return confirmClone(MSG_CONFIRM_CLONE);
46
        } else {
47
            MSG_CONFIRM_CLONE = _("Are you sure you want to clone this circulation and fine rule from %s to %s library? This will override the existing rules in this library.").format(selected_library_text, to_library);
48
            return confirmClone(MSG_CONFIRM_CLONE);
49
        }
50
    });
51
52
        $('#cap_fine_to_replacement_price').on('change', function(){
53
            $('#overduefinescap').prop('disabled', $(this).is(':checked') );
54
        });
55
        $('#selectlibrary').find("input:submit").hide();
56
        $('#branch').change(function() {
57
                $('#selectlibrary').submit();
58
        });
59
        $(".editrule").click(function(){
60
            if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
61
                var edit = confirm(_("Are you sure you want to edit another rule?"));
62
                if (!edit) return false;
63
            }
64
            $('#default-circulation-rules td').removeClass('highlighted-row');
65
            $(this).parent().parent().find("td").each(function (i) {
66
                $(this).addClass('highlighted-row');
67
                itm = $(this).text();
68
                itm = itm.replace(/^\s*|\s*$/g,'');
69
                var current_column = $("#edit_row td:eq("+i+")");
70
                if ( i == 7 ) {
71
                    // specific processing for the Hard due date column
72
                    var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
73
                    var input_value = '';
74
                    if (typeof select_value === 'undefined'){
75
                        select_value = '-1';
76
                    }else {
77
                        input_value = itm.split(' ')[1];
78
                    }
79
                    $(current_column).find("input[type='text']").val(input_value);
80
                    $(current_column).find("select").val(select_value);
81
                } else if ( i == 13 ) {
82
                    // specific processing for cap_fine_to_replacement_price
83
                    var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
84
                    $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
85
                    $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
86
                } else {
87
                    $(current_column).find("input[type='text']").val(itm);
88
                    // select the corresponding option
89
                    $(current_column).find("select option").each(function(){
90
                        opt = $(this).text().toLowerCase();
91
                        opt = opt.replace(/^\s*|\s*$/g,'');
92
                        if ( opt == itm.toLowerCase() ) {
93
                            $(this).attr('selected', 'selected');
94
                        }
95
                    });
96
                    if ( i == 0 || i == 1 ) {
97
                        // Disable the 2 first columns, we cannot update them.
98
                        var val = $(current_column).find("select option:selected").val();
99
                        var name = "categorycode";
100
                        if ( i == 1 ) {
101
                            name="itemtype";
102
                        }
103
                        // Remove potential previous input added
104
                        $(current_column).find("input").remove();
105
                        $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
106
                    } else if ( i == 3 || i == 4 ) {
107
                        // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
108
                        // The value is "Unlimited" (or an equivalent translated string)
109
                        // an it should be set to an empty string
110
                        if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
111
                            $(current_column).find("input[type='text']").val("");
112
                        }
113
                    }
114
                }
115
            });
116
            $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
117
            $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
118
            return false;
119
        });
120
        $(".clear_edit").on("click",function(e){
121
            e.preventDefault();
122
            clear_edit();
123
        });
124
});
125
//]]>
126
</script>
127
</head>
6
</head>
7
128
<body id="admin_smart-rules" class="admin">
8
<body id="admin_smart-rules" class="admin">
129
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'header.inc' %]
130
[% INCLUDE 'prefs-admin-search.inc' %]
10
[% INCLUDE 'prefs-admin-search.inc' %]
Lines 834-837 $(document).ready(function() { Link Here
834
[% INCLUDE 'admin-menu.inc' %]
714
[% INCLUDE 'admin-menu.inc' %]
835
</div>
715
</div>
836
</div>
716
</div>
717
718
[% MACRO jsinclude BLOCK %]
719
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
720
    [% INCLUDE 'calendar.inc' %]
721
    <script type="text/javascript">
722
723
        function clear_edit(){
724
            var cancel = confirm(_("Are you sure you want to cancel your changes?"));
725
            if ( !cancel ) return;
726
            $('#default-circulation-rules td').removeClass('highlighted-row');
727
            var edit_row = $("#edit_row");
728
            $(edit_row).find("input").each(function(){
729
                var type = $(this).attr("type");
730
                if (type != "button" && type != "submit" ) {
731
                    $(this).val("");
732
                    $(this).prop('disabled', false);
733
                }
734
                if ( type == "checkbox" ) {
735
                    $(this).prop('checked', false);
736
                }
737
            });
738
            $(edit_row).find("select").prop('disabled', false);
739
            $(edit_row).find("select option:first").attr("selected", "selected");
740
            $(edit_row).find("td:last input[name='clear']").remove();
741
        }
742
743
        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
744
745
        $(document).ready(function() {
746
            $(".delete").on("click",function(){
747
                return confirmDelete(MSG_CONFIRM_DELETE);
748
            });
749
750
            $("#clone_rules").on("click",function(){
751
                var library_dropdown = document.getElementById("branch");
752
                var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
753
                var selected_library_text = $("#branch option:selected").text();
754
                var to_library = $("#tobranch option:selected").text();
755
                var MSG_CONFIRM_CLONE;
756
                if (selected_library === "*") {
757
                    MSG_CONFIRM_CLONE = _("Are you sure you want to clone this standard rule to %s library? This will override the existing rules in this library.").format(to_library);
758
                    return confirmClone(MSG_CONFIRM_CLONE);
759
                } else {
760
                    MSG_CONFIRM_CLONE = _("Are you sure you want to clone this circulation and fine rule from %s to %s library? This will override the existing rules in this library.").format(selected_library_text, to_library);
761
                    return confirmClone(MSG_CONFIRM_CLONE);
762
                }
763
            });
764
765
            $('#cap_fine_to_replacement_price').on('change', function(){
766
                $('#overduefinescap').prop('disabled', $(this).is(':checked') );
767
            });
768
            $('#selectlibrary').find("input:submit").hide();
769
            $('#branch').change(function() {
770
                    $('#selectlibrary').submit();
771
            });
772
            $(".editrule").click(function(){
773
                if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
774
                    var edit = confirm(_("Are you sure you want to edit another rule?"));
775
                    if (!edit) return false;
776
                }
777
                $('#default-circulation-rules td').removeClass('highlighted-row');
778
                $(this).parent().parent().find("td").each(function (i) {
779
                    $(this).addClass('highlighted-row');
780
                    itm = $(this).text();
781
                    itm = itm.replace(/^\s*|\s*$/g,'');
782
                    var current_column = $("#edit_row td:eq("+i+")");
783
                    if ( i == 7 ) {
784
                        // specific processing for the Hard due date column
785
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
786
                        var input_value = '';
787
                        if (typeof select_value === 'undefined'){
788
                            select_value = '-1';
789
                        }else {
790
                            input_value = itm.split(' ')[1];
791
                        }
792
                        $(current_column).find("input[type='text']").val(input_value);
793
                        $(current_column).find("select").val(select_value);
794
                    } else if ( i == 13 ) {
795
                        // specific processing for cap_fine_to_replacement_price
796
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
797
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
798
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
799
                    } else {
800
                        $(current_column).find("input[type='text']").val(itm);
801
                        // select the corresponding option
802
                        $(current_column).find("select option").each(function(){
803
                            opt = $(this).text().toLowerCase();
804
                            opt = opt.replace(/^\s*|\s*$/g,'');
805
                            if ( opt == itm.toLowerCase() ) {
806
                                $(this).attr('selected', 'selected');
807
                            }
808
                        });
809
                        if ( i == 0 || i == 1 ) {
810
                            // Disable the 2 first columns, we cannot update them.
811
                            var val = $(current_column).find("select option:selected").val();
812
                            var name = "categorycode";
813
                            if ( i == 1 ) {
814
                                name="itemtype";
815
                            }
816
                            // Remove potential previous input added
817
                            $(current_column).find("input").remove();
818
                            $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
819
                        } else if ( i == 3 || i == 4 ) {
820
                            // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
821
                            // The value is "Unlimited" (or an equivalent translated string)
822
                            // an it should be set to an empty string
823
                            if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
824
                                $(current_column).find("input[type='text']").val("");
825
                            }
826
                        }
827
                    }
828
                });
829
                $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
830
                $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
831
                return false;
832
            });
833
            $(".clear_edit").on("click",function(e){
834
                e.preventDefault();
835
                clear_edit();
836
            });
837
        });
838
    </script>
839
[% END %]
837
[% INCLUDE 'intranet-bottom.inc' %]
840
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt (-58 / +59 lines)
Lines 1-70 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Transport cost matrix</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Transport cost matrix</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
6
<script type="text/javascript">
7
//<![CDATA[
8
function check_transport_cost(e) {
9
    var val = e.value;
10
    if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
11
        return;
12
    }
13
    alert(_("Cost must be expressed as a decimal number >= 0"));
14
}
15
function disable_transport_cost_chg(e) {
16
    var input_name = e.name;
17
    var cost_id = input_name.replace(/disable_/,''); // Parse the code_id out of the input name
18
    disable_transport_cost(cost_id, e.checked);
19
}
20
function disable_transport_cost(cost_id, disable) {
21
    if (disable) {
22
        $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
23
    } else {
24
        $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
25
    }
26
}
27
function enable_cost_input(cost_id) {
28
    var cell = $('#celldiv_'+cost_id);
29
    var cost = $(cell).text();
30
    var disabled = $(cell).hasClass('disabled-transfer');
31
    $(cell).removeClass('disabled-transfer');
32
33
    $('#celldiv_'+cost_id).html(
34
        '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
35
        '<br/>Disable <input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
36
    );
37
    disable_transport_cost(cost_id, disabled);
38
}
39
40
function form_submit (f) {
41
    $(f).find('input:disabled').prop('disabled', false);
42
    return true;
43
}
44
$(document).ready(function(){
45
    $(".enable_cost_input").on("click",function(){
46
        var cost_id = $(this).data("cost-id");
47
        enable_cost_input( cost_id );
48
    });
49
    $("body").on("blur",".cost_input",function(){
50
        check_transport_cost(this);
51
    });
52
    $("body").on("change",".disable_transport_cost",function(){
53
        disable_transport_cost_chg(this);
54
    });
55
    $("#cost_matrix_form").on("submit",function(){
56
        return form_submit(this);
57
    });
58
})
59
//]]>
60
</script>
61
<style type="text/css">
6
<style type="text/css">
62
.disabled-transfer {
7
.disabled-transfer {
63
    background-color: #FF8888;
8
    background-color: #FF8888;
64
}
9
}
65
</style>
10
</style>
66
67
</head>
11
</head>
12
68
<body id="admin_transport_cost_matrix" class="admin">
13
<body id="admin_transport_cost_matrix" class="admin">
69
[% INCLUDE 'header.inc' %]
14
[% INCLUDE 'header.inc' %]
70
[% INCLUDE 'prefs-admin-search.inc' %]
15
[% INCLUDE 'prefs-admin-search.inc' %]
Lines 144-147 $(document).ready(function(){ Link Here
144
[% INCLUDE 'admin-menu.inc' %]
89
[% INCLUDE 'admin-menu.inc' %]
145
</div>
90
</div>
146
</div>
91
</div>
92
93
[% MACRO jsinclude BLOCK %]
94
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
95
    <script type="text/javascript">
96
        function check_transport_cost(e) {
97
            var val = e.value;
98
            if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
99
                return;
100
            }
101
            alert(_("Cost must be expressed as a decimal number >= 0"));
102
        }
103
        function disable_transport_cost_chg(e) {
104
            var input_name = e.name;
105
            var cost_id = input_name.replace(/disable_/,''); // Parse the code_id out of the input name
106
            disable_transport_cost(cost_id, e.checked);
107
        }
108
        function disable_transport_cost(cost_id, disable) {
109
            if (disable) {
110
                $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer');
111
            } else {
112
                $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer');
113
            }
114
        }
115
        function enable_cost_input(cost_id) {
116
            var cell = $('#celldiv_'+cost_id);
117
            var cost = $(cell).text();
118
            var disabled = $(cell).hasClass('disabled-transfer');
119
            $(cell).removeClass('disabled-transfer');
120
121
            $('#celldiv_'+cost_id).html(
122
                '<input type="text" name="cost_'+cost_id+'" class="cost_input" size="4" value="'+$.trim(cost)+'" />'+
123
                '<br/>Disable <input name="disable_'+cost_id+'" value="1" class="disable_transport_cost" type="checkbox" '+(disabled ? 'checked' : '')+' />'
124
            );
125
            disable_transport_cost(cost_id, disabled);
126
        }
127
128
        function form_submit (f) {
129
            $(f).find('input:disabled').prop('disabled', false);
130
            return true;
131
        }
132
        $(document).ready(function(){
133
            $(".enable_cost_input").on("click",function(){
134
                var cost_id = $(this).data("cost-id");
135
                enable_cost_input( cost_id );
136
            });
137
            $("body").on("blur",".cost_input",function(){
138
                check_transport_cost(this);
139
            });
140
            $("body").on("change",".disable_transport_cost",function(){
141
                disable_transport_cost_chg(this);
142
            });
143
            $("#cost_matrix_form").on("submit",function(){
144
                return form_submit(this);
145
            });
146
        });
147
    </script>
148
[% END %]
147
[% INCLUDE 'intranet-bottom.inc' %]
149
[% INCLUDE 'intranet-bottom.inc' %]
148
- 

Return to bug 19603