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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt (-3 / +32 lines)
Lines 47-52 Link Here
47
            <table id="patron-lists-table">
47
            <table id="patron-lists-table">
48
                <thead>
48
                <thead>
49
                    <tr>
49
                    <tr>
50
                        <input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists"/>
50
                        <th>Name</th>
51
                        <th>Name</th>
51
                        <th>Patrons in list</th>
52
                        <th>Patrons in list</th>
52
                        <th>Shared</th>
53
                        <th>Shared</th>
Lines 58-64 Link Here
58
                    [% FOREACH l IN lists %]
59
                    [% FOREACH l IN lists %]
59
                        [% SET shared_by_other = l.owner.id != logged_in_user.id %]
60
                        [% SET shared_by_other = l.owner.id != logged_in_user.id %]
60
                        <tr>
61
                        <tr>
61
                            <td><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a></td>
62
                            <td>
63
                                <input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]">
64
                                <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a>
65
                            </td>
62
                            <td>[% l.patron_list_patrons_rs.count || 0 | html %]</td>
66
                            <td>[% l.patron_list_patrons_rs.count || 0 | html %]</td>
63
                            <td>
67
                            <td>
64
                                [% IF l.shared %]
68
                                [% IF l.shared %]
Lines 68-73 Link Here
68
                                        by you
72
                                        by you
69
                                    [% END %]
73
                                    [% END %]
70
                                [% END %]
74
                                [% END %]
75
71
                            </td>
76
                            </td>
72
                            <td>
77
                            <td>
73
                                <div class="btn-group dropup">
78
                                <div class="btn-group dropup">
Lines 147-163 Link Here
147
            var patronExportModal = $("#patronExportModal");
152
            var patronExportModal = $("#patronExportModal");
148
            var patronExportModalBody = $("#patronExportModal .modal-body");
153
            var patronExportModalBody = $("#patronExportModal .modal-body");
149
154
155
            let selectedPatronLists = new Array();
156
150
            $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
157
            $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
151
                "autoWidth": false,
158
                "autoWidth": false,
152
                "aoColumnDefs": [
159
                "aoColumnDefs": [
153
                    { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
160
                    {"bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ]}
154
                ],
161
                ],
155
                "sPaginationType": "full"
162
                "sPaginationType": "full"
156
            } ));
163
            } ));
157
            $(".delete_patron").on("click", function(){
164
            $(".delete_patron").on("click", function(){
158
                $(".dropdown").removeClass("open");
165
                $(".dropdown").removeClass("open");
159
                var list = $(this).data("list-name");
166
                var list = $(this).data("list-name");
160
                return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) );
167
                return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
168
            });
169
170
            $("#delete_selected_lists").on("click", function() {
171
                if (selectedPatronLists.length != 0) {
172
                    if (confirm(_("Are you sure you want to delete the selected lists ?"))) {
173
                    var delete_lists_url = '/cgi-bin/koha/patron_lists/delete.pl?patron_lists_ids=' + selectedPatronLists.join("&patron_lists_ids=");
174
                    window.location.href = delete_lists_url;
175
                    }
176
                }
177
            });
178
179
            $(".select_patron").on("click", function() {
180
                if($(this).is(':checked')){
181
                    $("#delete_selected_lists").attr("class","btn btn-default btn-sm");
182
                    selectedPatronLists.push($(this).data("patron-list-id"));
183
                }
184
                else {
185
                    selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id"));
186
                    if(selectedPatronLists.length === 0){
187
                        $("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled");
188
                    }
189
                }
161
            });
190
            });
162
191
163
            $(".print_cards").on("click", function(e){
192
            $(".print_cards").on("click", function(e){
(-)a/patron_lists/delete.pl (-3 / +10 lines)
Lines 37-43 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
37
);
37
);
38
38
39
my $id = $cgi->param('patron_list_id');
39
my $id = $cgi->param('patron_list_id');
40
40
my @lists_ids = $cgi->multi_param('patron_lists_ids');
41
DelPatronList( { patron_list_id => $id } );
41
42
if (defined $id && $id ne '') {
43
    DelPatronList({ patron_list_id => $id });
44
}
45
if (@lists_ids) {
46
    foreach my $list_id (@lists_ids) {
47
        DelPatronList({ patron_list_id => $list_id });
48
    }
49
}
42
50
43
print $cgi->redirect('lists.pl');
51
print $cgi->redirect('lists.pl');
44
- 

Return to bug 34977