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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt (-39 / +43 lines)
Lines 1-49 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion/anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
6
<title>Koha &rsaquo; Tools &rsaquo; Batch patron deletion/anonymization [% IF step == 2 %]&rsaquo; Confirm[% END %][% IF step == 3 %]&rsaquo; Finished[% END %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
<script type="text/javascript">
9
    $(document).ready(function(){
10
        $("#delete_patrons_form").on("submit",function(){
11
            return checkForm( this );
12
        });
13
    });
14
15
        /**
16
         *  checkForm(form)
17
         *  This function check the form is correctly filled.
18
         */
19
          function checkForm(form) {
20
              if((form.checkbox[0].checked)){
21
                  if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
22
                    alert(_("Please enter at least one criterion for deletion!"));
23
                    return false;
24
                  }
25
              }
26
              if((form.checkbox[1].checked)){
27
                  if(!(form.date2.value)){
28
                      alert(_("Please enter a date!"));
29
                      return false;
30
                  }
31
              }
32
              if(!form.checkbox[0].checked && !form.checkbox[1].checked) {
33
                alert( _("Please check at least one action") );
34
                return false;
35
              }
36
              return true;
37
          }
38
39
    $(document).ready(function() {
40
        $('#branch').change(function() {
41
            $('#selectlibrary').submit();
42
        });
43
    });
44
</script>
45
46
</head>
8
</head>
9
47
<body id="tools_cleanborrowers" class="tools">
10
<body id="tools_cleanborrowers" class="tools">
48
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
49
[% INCLUDE 'cat-search.inc' %]
12
[% INCLUDE 'cat-search.inc' %]
Lines 240-243 Link Here
240
[% INCLUDE 'tools-menu.inc' %]
203
[% INCLUDE 'tools-menu.inc' %]
241
</div>
204
</div>
242
</div>
205
</div>
206
207
[% MACRO jsinclude BLOCK %]
208
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
209
    [% INCLUDE 'calendar.inc' %]
210
    <script type="text/javascript">
211
        $(document).ready(function(){
212
            $("#delete_patrons_form").on("submit",function(){
213
                return checkForm( this );
214
            });
215
216
            $('#branch').change(function() {
217
                $('#selectlibrary').submit();
218
            });
219
        });
220
221
        /**
222
         *  checkForm(form)
223
         *  This function check the form is correctly filled.
224
         */
225
        function checkForm(form) {
226
            if((form.checkbox[0].checked)){
227
                if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
228
                  alert(_("Please enter at least one criterion for deletion!"));
229
                  return false;
230
                }
231
            }
232
            if((form.checkbox[1].checked)){
233
                if(!(form.date2.value)){
234
                    alert(_("Please enter a date!"));
235
                    return false;
236
                }
237
            }
238
            if(!form.checkbox[0].checked && !form.checkbox[1].checked) {
239
              alert( _("Please check at least one action") );
240
              return false;
241
            }
242
            return true;
243
        }
244
    </script>
245
[% END %]
246
243
[% INCLUDE 'intranet-bottom.inc' %]
247
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt (-124 / +128 lines)
Lines 1-134 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% INCLUDE 'doc-head-open.inc'%]
4
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Tools &rsaquo; Batch patron modification</title>
6
<title>Koha &rsaquo; Tools &rsaquo; Batch patron modification</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9
[% INCLUDE 'datatables.inc' %]
10
<script type="text/javascript">
11
//<![CDATA[
12
        var patron_attributes_lib = new Array();
13
        var patron_attributes_values = new Array();
14
        $(document).ready(function() {
15
            [% IF borrowers %]
16
                $("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
17
                    "sDom": 't',
18
                    [% IF ( op == 'show_results' ) %]
19
                        "aoColumnDefs": [
20
                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
21
                        ],
22
                    [% ELSE %]
23
                        "aoColumnDefs": [
24
                            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
25
                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
26
                        ],
27
                    [% END %]
28
                    "bPaginate": false
29
                }));
30
                $("#selectallbutton").click(function() {
31
                    $("#borrowerst").find("input:checkbox").each(function() {
32
                        $(this).prop("checked", true);
33
                    });
34
                    return false;
35
                });
36
                $("#clearallbutton").click(function() {
37
                    $("#borrowerst").find("input:checkbox").each(function() {
38
                        $(this).prop("checked", false);
39
                    });
40
                    return false;
41
                });
42
            [% END %]
43
44
            var values = new Array();
45
            var lib = new Array();
46
            [% FOREACH pav IN patron_attributes_values %]
47
                values = new Array();
48
                lib = new Array();
49
                [% FOREACH option IN pav.options %]
50
                    values.push("[% option.lib %]");
51
                    lib.push("[% option.authorised_value %]");
52
                [% END %]
53
                patron_attributes_lib["[% pav.attribute_code %]"] = values;
54
                patron_attributes_values["[% pav.attribute_code %]"] = lib;
55
            [% END %]
56
57
            $('select[name="patron_attributes"]').change(function() {
58
                updateAttrValues(this);
59
            } );
60
61
            $('select[name="patron_attributes"]').change();
62
63
            $(".clear-date").on("click",function(e){
64
                e.preventDefault();
65
                var fieldID = this.id.replace("clear-date-","");
66
                $("#" + fieldID).val("");
67
            });
68
            $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){
69
                e.preventDefault();
70
                add_attributes();
71
            });
72
            $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){
73
                e.preventDefault();
74
                del_attributes(this);
75
            });
76
        });
77
78
        function updateAttrValues (select_attr) {
79
            var attr_code = $(select_attr).val();
80
            var type = $(select_attr).find("option:selected").attr('data-type');
81
            var category = $(select_attr).find("option:selected").attr('data-category');
82
            var span = $(select_attr).parent().parent().find('span.patron_attributes_value');
83
            var information_category_node = $(select_attr).parent().parent().find('span.information_category');
84
            information_category_node.html("");
85
            if ( category.length > 0 ) {
86
                information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
87
            }
88
            if ( type == 'select' ) {
89
                var options = '<option value = ""></option>';
90
                for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
91
                    options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
92
                }
93
                span.html('<select name="patron_attributes_value">' + options + '</select>');
94
            } else {
95
                span.html('<input type="text" name="patron_attributes_value"/>')
96
            }
97
        }
98
99
        function add_attributes() {
100
            var li_node = $("li.attributes:last");
101
            var li_clone = $(li_node).clone();
102
            if ( $(li_clone).find("a.del_attributes").length == 0 ) {
103
                $(li_clone).append('<a href="#" title="Delete" class="del_attributes"><i class="fa fa-fw fa-trash"></i> Delete</a>');
104
            }
105
            $(li_clone).find('select[name="patron_attributes"]').change(function() {
106
                updateAttrValues(this);
107
            } );
108
109
            $(li_clone).find('select[name="patron_attributes"]').change();
110
111
            $("#fields_list>ol").append(li_clone);
112
            update_attr_values();
113
        }
114
115
        function del_attributes(a_node) {
116
            $(a_node).parent('li').remove();
117
            update_attr_values();
118
        }
119
120
        function update_attr_values() {
121
            $("li.attributes").each(function(i) {
122
                $(this).find("input:checkbox").val("attr"+i+"_value");
123
            });
124
        }
125
        function clearDate(nodeid) {
126
            $("#"+nodeid).val("");
127
        }
128
129
//]]>
130
</script>
131
</head>
9
</head>
10
132
<body id="tools_modborrowers" class="tools">
11
<body id="tools_modborrowers" class="tools">
133
[% INCLUDE 'header.inc' %]
12
[% INCLUDE 'header.inc' %]
134
[% INCLUDE 'cat-search.inc' %]
13
[% INCLUDE 'cat-search.inc' %]
Lines 412-415 Link Here
412
                [% INCLUDE 'tools-menu.inc' %]
291
                [% INCLUDE 'tools-menu.inc' %]
413
            </div>
292
            </div>
414
        </div>
293
        </div>
294
295
[% MACRO jsinclude BLOCK %]
296
    [% INCLUDE 'calendar.inc' %]
297
    [% INCLUDE 'datatables.inc' %]
298
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
299
    <script type="text/javascript">
300
        var patron_attributes_lib = new Array();
301
        var patron_attributes_values = new Array();
302
        $(document).ready(function() {
303
            [% IF borrowers %]
304
                $("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
305
                    "sDom": 't',
306
                    [% IF ( op == 'show_results' ) %]
307
                        "aoColumnDefs": [
308
                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
309
                        ],
310
                    [% ELSE %]
311
                        "aoColumnDefs": [
312
                            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
313
                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
314
                        ],
315
                    [% END %]
316
                    "bPaginate": false
317
                }));
318
                $("#selectallbutton").click(function() {
319
                    $("#borrowerst").find("input:checkbox").each(function() {
320
                        $(this).prop("checked", true);
321
                    });
322
                    return false;
323
                });
324
                $("#clearallbutton").click(function() {
325
                    $("#borrowerst").find("input:checkbox").each(function() {
326
                        $(this).prop("checked", false);
327
                    });
328
                    return false;
329
                });
330
            [% END %]
331
332
            var values = new Array();
333
            var lib = new Array();
334
            [% FOREACH pav IN patron_attributes_values %]
335
                values = new Array();
336
                lib = new Array();
337
                [% FOREACH option IN pav.options %]
338
                    values.push("[% option.lib %]");
339
                    lib.push("[% option.authorised_value %]");
340
                [% END %]
341
                patron_attributes_lib["[% pav.attribute_code %]"] = values;
342
                patron_attributes_values["[% pav.attribute_code %]"] = lib;
343
            [% END %]
344
345
            $('select[name="patron_attributes"]').change(function() {
346
                updateAttrValues(this);
347
            } );
348
349
            $('select[name="patron_attributes"]').change();
350
351
            $(".clear-date").on("click",function(e){
352
                e.preventDefault();
353
                var fieldID = this.id.replace("clear-date-","");
354
                $("#" + fieldID).val("");
355
            });
356
            $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){
357
                e.preventDefault();
358
                add_attributes();
359
            });
360
            $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){
361
                e.preventDefault();
362
                del_attributes(this);
363
            });
364
        });
365
366
        function updateAttrValues (select_attr) {
367
            var attr_code = $(select_attr).val();
368
            var type = $(select_attr).find("option:selected").attr('data-type');
369
            var category = $(select_attr).find("option:selected").attr('data-category');
370
            var span = $(select_attr).parent().parent().find('span.patron_attributes_value');
371
            var information_category_node = $(select_attr).parent().parent().find('span.information_category');
372
            information_category_node.html("");
373
            if ( category.length > 0 ) {
374
                information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
375
            }
376
            if ( type == 'select' ) {
377
                var options = '<option value = ""></option>';
378
                for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
379
                    options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
380
                }
381
                span.html('<select name="patron_attributes_value">' + options + '</select>');
382
            } else {
383
                span.html('<input type="text" name="patron_attributes_value"/>')
384
            }
385
        }
386
387
        function add_attributes() {
388
            var li_node = $("li.attributes:last");
389
            var li_clone = $(li_node).clone();
390
            if ( $(li_clone).find("a.del_attributes").length == 0 ) {
391
                $(li_clone).append('<a href="#" title="Delete" class="del_attributes"><i class="fa fa-fw fa-trash"></i> Delete</a>');
392
            }
393
            $(li_clone).find('select[name="patron_attributes"]').change(function() {
394
                updateAttrValues(this);
395
            } );
396
397
            $(li_clone).find('select[name="patron_attributes"]').change();
398
399
            $("#fields_list>ol").append(li_clone);
400
            update_attr_values();
401
        }
402
403
        function del_attributes(a_node) {
404
            $(a_node).parent('li').remove();
405
            update_attr_values();
406
        }
407
408
        function update_attr_values() {
409
            $("li.attributes").each(function(i) {
410
                $(this).find("input:checkbox").val("attr"+i+"_value");
411
            });
412
        }
413
        function clearDate(nodeid) {
414
            $("#"+nodeid).val("");
415
        }
416
    </script>
417
[% END %]
418
415
[% INCLUDE 'intranet-bottom.inc' %]
419
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt (-19 / +21 lines)
Lines 1-27 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Tools &rsaquo; Overdue notice/status triggers</title>
5
<title>Koha &rsaquo; Tools &rsaquo; Overdue notice/status triggers</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
6
7
<script type="text/javascript">
8
//<![CDATA[
9
var tab_map = { "1" : _("First"), "2" : _("Second"), "3" : _("Third")};
10
$(document).ready(function() {
11
    $('#selectlibrary').find("input:submit").hide();
12
    $('#branch').change(function() {
13
            $('#selectlibrary').submit();
14
    });
15
    $("li>a.tab").each( function(){
16
        var id = $(this).attr("data-number");
17
        $(this).html(tab_map[id]);
18
    } );
19
    $('#rulestabs').tabs();
20
});
21
//]]>
22
</script>
23
24
</head>
7
</head>
8
25
<body id="tools_overduerules" class="tools">
9
<body id="tools_overduerules" class="tools">
26
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'header.inc' %]
27
[% INCLUDE 'cat-search.inc' %]
11
[% INCLUDE 'cat-search.inc' %]
Lines 170-173 $(document).ready(function() { Link Here
170
        [% INCLUDE 'tools-menu.inc' %]
154
        [% INCLUDE 'tools-menu.inc' %]
171
    </div>
155
    </div>
172
</div>
156
</div>
157
158
[% MACRO jsinclude BLOCK %]
159
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
160
    <script type="text/javascript">
161
        var tab_map = { "1" : _("First"), "2" : _("Second"), "3" : _("Third")};
162
        $(document).ready(function() {
163
            $('#selectlibrary').find("input:submit").hide();
164
            $('#branch').change(function() {
165
                $('#selectlibrary').submit();
166
            });
167
            $("li>a.tab").each( function(){
168
                var id = $(this).attr("data-number");
169
                $(this).html(tab_map[id]);
170
            });
171
            $('#rulestabs').tabs();
172
        });
173
    </script>
174
[% END %]
175
173
[% INCLUDE 'intranet-bottom.inc' %]
176
[% INCLUDE 'intranet-bottom.inc' %]
174
- 

Return to bug 19680