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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 1199-1204 Link Here
1199
    [% Asset.js("js/checkouts.js") | $raw %]
1199
    [% Asset.js("js/checkouts.js") | $raw %]
1200
    [% Asset.js("js/tables/bookings.js") | $raw %]
1200
    [% Asset.js("js/tables/bookings.js") | $raw %]
1201
    [% Asset.js("js/recalls.js") | $raw %]
1201
    [% Asset.js("js/recalls.js") | $raw %]
1202
    [% Asset.js("js/form-submit.js") | $raw %]
1202
[% END %]
1203
[% END %]
1203
1204
1204
[% INCLUDE 'intranet-bottom.inc' %]
1205
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 786-791 Link Here
786
    [% INCLUDE 'str/members-menu.inc' %]
786
    [% INCLUDE 'str/members-menu.inc' %]
787
    [% Asset.js("js/members-menu.js") | $raw %]
787
    [% Asset.js("js/members-menu.js") | $raw %]
788
    [% Asset.js("js/recalls.js") | $raw %]
788
    [% Asset.js("js/recalls.js") | $raw %]
789
    [% Asset.js("js/form-submit.js") | $raw %]
789
    <script>
790
    <script>
790
        const LoadCheckoutsTableDelay = 0;
791
        const LoadCheckoutsTableDelay = 0;
791
        const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %];
792
        const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %];
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt (-83 / +108 lines)
Lines 40-123 Link Here
40
    <h1>Patron lists</h1>
40
    <h1>Patron lists</h1>
41
41
42
    [% IF ( lists ) %]
42
    [% IF ( lists ) %]
43
        <div class="page-section">
43
        <form action="/cgi-bin/koha/patron_lists/delete.pl" method="post" id="patrons_lists_form">
44
            <table id="patron-lists-table">
44
            [% INCLUDE 'csrf-token.inc' %]
45
                <thead>
45
            <input type="hidden" name="op" value="cud-delete" />
46
                    <tr>
46
            <div id="searchheader" class="searchheader noprint sticky">
47
                        <input type="button" type="submit" class="btn btn-default btn-sm disabled" value="Delete selected lists" id="delete_selected_lists" />
47
                <div class="btn-group">
48
                        <th>Name</th>
48
                    <button type="submit" class="btn btn-default btn-sm disabled" id="delete_selected_lists"><i class="fa fa-trash" aria-hidden="true"></i> Delete selected lists</button>
49
                        <th>Patrons in list</th>
49
                </div>
50
                        <th>Shared</th>
50
            </div>
51
                        <th class="NoSort">&nbsp;</th>
51
52
                    </tr>
52
            <div class="page-section">
53
                </thead>
53
                <table id="patron-lists-table">
54
54
                    <thead>
55
                <tbody>
56
                    [% FOREACH l IN lists %]
57
                        [% SET shared_by_other = l.owner.id != logged_in_user.id %]
58
                        <tr>
55
                        <tr>
59
                            <td>
56
                            <th class="NoSort"></th>
60
                                <input class="select_patron" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]" />
57
                            <th>Name</th>
61
                                <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a>
58
                            <th>Patrons in list</th>
62
                            </td>
59
                            <th>Shared</th>
63
                            <td>[% l.patron_list_patrons_rs.count || 0 | html %]</td>
60
                            <th class="NoSort">&nbsp;</th>
64
                            <td>
61
                        </tr>
65
                                [% IF l.shared %]
62
                    </thead>
66
                                    [% IF shared_by_other %]
63
67
                                        by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a>
64
                    <tbody>
68
                                    [% ELSE %]
65
                        [% FOREACH l IN lists %]
69
                                        by you
66
                            [% SET shared_by_other = l.owner.id != logged_in_user.id %]
67
                            <tr>
68
                                <td>
69
                                    <input class="select_list" name="patron_lists_ids" value="[% l.patron_list_id | html %]" type="checkbox" autocomplete="off" data-patron-list-id="[% l.patron_list_id | html %]" />
70
                                </td>
71
                                <td>
72
                                    <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]">[% l.name | html %]</a>
73
                                </td>
74
                                <td>[% l.patron_list_patrons_rs.count || 0 | html %]</td>
75
                                <td>
76
                                    [% IF l.shared %]
77
                                        [% IF shared_by_other %]
78
                                            by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% l.owner.id | uri %]">[% INCLUDE 'patron-title.inc' patron=l.owner %]</a>
79
                                        [% ELSE %]
80
                                            by you
81
                                        [% END %]
70
                                    [% END %]
82
                                    [% END %]
71
                                [% END %]
83
                                </td>
72
                            </td>
84
                                <td>
73
                            <td>
85
                                    <div class="btn-group dropup">
74
                                <div class="btn-group dropup">
86
                                        <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> Actions </a>
75
                                    <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id | html %]" role="button" data-bs-toggle="dropdown" href="#"> Actions </a>
87
                                        <ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]">
76
                                    <ul class="dropdown-menu" role="menu" aria-labelledby="listactions[% l.patron_list_id | html %]">
77
                                        <li
78
                                            ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-user"></i> Add patrons</a></li
79
                                        >
80
                                        [% UNLESS shared_by_other %]
81
                                            <li
82
                                                ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a></li
83
                                            >
84
                                            <li
88
                                            <li
85
                                                ><a class="delete_patron dropdown-item" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id | html %]" data-list-name="[% l.name | html %]"
89
                                                ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-user"></i> Add patrons</a></li
86
                                                    ><i class="fa fa-trash-can"></i> Delete list</a
87
                                                ></li
88
                                            >
90
                                            >
89
                                        [% END %]
91
                                            [% UNLESS shared_by_other %]
90
                                        [% IF ( l.patron_list_patrons_rs.count ) %]
92
                                                <li
91
                                            <li><hr class="dropdown-divider" /></li>
93
                                                    ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"
92
                                            <li>
94
                                                        ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit list</a
93
                                                <a class="print_cards dropdown-item" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id | html %]" data-patron_list_id="[% l.patron_list_id | html %]"
95
                                                    ></li
94
                                                    ><i class="fa fa-print"></i> Print patron cards</a
95
                                                >
96
                                                >
96
                                            </li>
97
                                            [% IF CAN_user_tools_edit_patrons %]
98
                                                <li>
97
                                                <li>
99
                                                    <a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show">
98
                                                    <a
100
                                                        <i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons
99
                                                        class="dropdown-item submit-form-link"
101
                                                    </a>
100
                                                        href="#"
101
                                                        data-patron_list_id="[% l.patron_list_id | html %]"
102
                                                        data-action="delete.pl"
103
                                                        data-method="post"
104
                                                        data-op="cud-delete"
105
                                                        data-confirmation-msg="Are you sure you want to delete this list?"
106
                                                        ><i class="fa fa-trash-can"></i> Delete list</a
107
                                                    >
102
                                                </li>
108
                                                </li>
103
                                            [% END %]
109
                                            [% END %]
104
                                            [% IF CAN_user_tools_delete_anonymize_patrons %]
110
                                            [% IF ( l.patron_list_patrons_rs.count ) %]
111
                                                <li><hr class="dropdown-divider" /></li>
105
                                                <li>
112
                                                <li>
106
                                                    <a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower">
113
                                                    <a class="print_cards dropdown-item" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id | html %]" data-patron_list_id="[% l.patron_list_id | html %]"
107
                                                        <i class="fa fa-trash-can"></i> Batch delete patrons
114
                                                        ><i class="fa fa-print"></i> Print patron cards</a
108
                                                    </a>
115
                                                    >
109
                                                </li>
116
                                                </li>
117
                                                [% IF CAN_user_tools_edit_patrons %]
118
                                                    <li>
119
                                                        <a class="dropdown-item dropdown-item" href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id | uri %]&op=show">
120
                                                            <i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch edit patrons
121
                                                        </a>
122
                                                    </li>
123
                                                [% END %]
124
                                                [% IF CAN_user_tools_delete_anonymize_patrons %]
125
                                                    <li>
126
                                                        <a class="dropdown-item" href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id | uri %]&checkbox=borrower">
127
                                                            <i class="fa fa-trash-can"></i> Batch delete patrons
128
                                                        </a>
129
                                                    </li>
130
                                                [% END %]
110
                                            [% END %]
131
                                            [% END %]
111
                                        [% END %]
132
                                        </ul>
112
                                    </ul>
133
                                    </div>
113
                                </div>
134
                                </td>
114
                            </td>
135
                            </tr>
115
                        </tr>
136
                        [% END %]
116
                    [% END %]
137
                    </tbody>
117
                </tbody>
138
                </table>
118
            </table>
139
            </div>
119
        </div>
140
            <!-- /.page-section -->
120
        <!-- /.page-section -->
141
        </form>
142
        <!-- /#patron_lists_form -->
121
143
122
        <!-- Modal to print patron cards -->
144
        <!-- Modal to print patron cards -->
123
        <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
145
        <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
Lines 140-145 Link Here
140
162
141
[% MACRO jsinclude BLOCK %]
163
[% MACRO jsinclude BLOCK %]
142
    [% Asset.js("js/tools-menu.js") | $raw %]
164
    [% Asset.js("js/tools-menu.js") | $raw %]
165
    [% Asset.js("js/form-submit.js") | $raw %]
143
    [% INCLUDE 'datatables.inc' %]
166
    [% INCLUDE 'datatables.inc' %]
144
    <script>
167
    <script>
145
        $(document).ready(function() {
168
        $(document).ready(function() {
Lines 152-183 Link Here
152
                autoWidth: false,
175
                autoWidth: false,
153
                columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }],
176
                columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }],
154
                pagingType: "full",
177
                pagingType: "full",
178
                "sorting": [[ 1, "asc" ]]
155
            });
179
            });
180
156
            $(".delete_patron").on("click", function(){
181
            $(".delete_patron").on("click", function(){
157
                $(".dropdown").removeClass("open");
182
                $(".dropdown").removeClass("open");
158
                var list = $(this).data("list-name");
183
                var list = $(this).data("list-name");
159
                return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
184
                return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
160
            });
185
            });
161
186
162
            $("#delete_selected_lists").on("click", function() {
187
            $("#patrons_lists_form").submit(function(){
163
                if (selectedPatronLists.length != 0) {
188
                var checkedItems = $("input[name=patron_lists_ids]:checked");
164
                    if (confirm(_("Are you sure you want to delete the selected lists ?"))) {
189
                if ( checkedItems.size() == 0) {
165
                    var delete_lists_url = '/cgi-bin/koha/patron_lists/delete.pl?patron_lists_ids=' + selectedPatronLists.join("&patron_lists_ids=");
190
                    alert(_("You must select one or more lists to delete"));
166
                    window.location.href = delete_lists_url;
191
                    return false;
167
                    }
192
                }
193
                if( confirm(_("Are you sure you want to delete the selected lists?")) ) {
194
                    return true;
195
                } else {
196
                    return false;
168
                }
197
                }
169
            });
198
            });
170
199
171
            $(document).on("click", ".select_patron", function() {
200
            $(document).on("click", ".select_list", function() {
172
                if($(this).is(':checked')){
201
                var checkedItems = $("input[name=patron_lists_ids]:checked");
173
                    $("#delete_selected_lists").attr("class","btn btn-default btn-sm");
202
                if ( checkedItems.size() == 0 ) {
174
                    selectedPatronLists.push($(this).data("patron-list-id"));
203
                    $("#delete_selected_lists").addClass("disabled").prop("disabled", true);
175
                }
204
                } else {
176
                else {
205
                    $("#delete_selected_lists").removeClass("disabled").prop("disabled", false);
177
                    selectedPatronLists = selectedPatronLists.filter(item => item !== $(this).data("patron-list-id"));
178
                    if(selectedPatronLists.length === 0){
179
                        $("#delete_selected_lists").attr("class","btn btn-default btn-sm disabled");
180
                    }
181
                }
206
                }
182
            });
207
            });
183
208
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt (-5 / +15 lines)
Lines 1-3 Link Here
1
[% USE raw %]
2
[% USE Koha %]
3
[% USE Asset %]
1
[% USE KohaDates %]
4
[% USE KohaDates %]
2
5
3
[% IF no_access_to_patron %]
6
[% IF no_access_to_patron %]
Lines 57-67 Link Here
57
                                            <li
60
                                            <li
58
                                                ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-pencil"></i> Edit list</a></li
61
                                                ><a class="dropdown-item" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id | uri %]"><i class="fa fa-pencil"></i> Edit list</a></li
59
                                            >
62
                                            >
60
                                            <li
63
                                            <li>
61
                                                ><a class="delete_patron dropdown-item" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id | html %]" data-list-name="[% l.name | html %]"
64
                                                <a
62
                                                    ><i class="fa fa-trash"></i> Delete list</a
65
                                                    class="dropdown-item submit-form-link"
63
                                                ></li
66
                                                    href="#"
64
                                            >
67
                                                    data-patron_list_id="[% l.patron_list_id | html %]"
68
                                                    data-action="/cgi-bin/koha/patron_lists/delete.pl"
69
                                                    data-method="post"
70
                                                    data-op="cud-delete"
71
                                                    data-confirmation-msg="Are you sure you want to delete this list?"
72
                                                    ><i class="fa fa-trash-can"></i> Delete list</a
73
                                                >
74
                                            </li>
65
                                        [% END %]
75
                                        [% END %]
66
                                        [% IF ( l.patron_list_patrons_rs.count ) %]
76
                                        [% IF ( l.patron_list_patrons_rs.count ) %]
67
                                            <li><hr class="dropdown-divider" /></li>
77
                                            <li><hr class="dropdown-divider" /></li>
(-)a/patron_lists/delete.pl (-7 / +9 lines)
Lines 26-31 use C4::Output; Link Here
26
use Koha::List::Patron qw( DelPatronList );
26
use Koha::List::Patron qw( DelPatronList );
27
27
28
my $cgi = CGI->new;
28
my $cgi = CGI->new;
29
my $op  = $cgi->param('op') // q{};
29
30
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
    {
32
    {
Lines 39-50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
39
my $id        = $cgi->param('patron_list_id');
40
my $id        = $cgi->param('patron_list_id');
40
my @lists_ids = $cgi->multi_param('patron_lists_ids');
41
my @lists_ids = $cgi->multi_param('patron_lists_ids');
41
42
42
if ( defined $id && $id ne '' ) {
43
if ( $op eq 'cud-delete' ) {
43
    DelPatronList( { patron_list_id => $id } );
44
    if ( defined $id && $id ne '' ) {
44
}
45
        DelPatronList( { patron_list_id => $id } );
45
if (@lists_ids) {
46
    }
46
    foreach my $list_id (@lists_ids) {
47
    if (@lists_ids) {
47
        DelPatronList( { patron_list_id => $list_id } );
48
        foreach my $list_id (@lists_ids) {
49
            DelPatronList( { patron_list_id => $list_id } );
50
        }
48
    }
51
    }
49
}
52
}
50
53
51
- 

Return to bug 37266