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

(-)a/admin/credit_types.pl (-2 / +2 lines)
Lines 99-105 elsif ( $op eq 'cud-add_validate' ) { Link Here
99
    };
99
    };
100
    $op = 'list';
100
    $op = 'list';
101
}
101
}
102
elsif ( $op eq 'archive' ) {
102
elsif ( $op eq 'cud-archive' ) {
103
    try {
103
    try {
104
        $credit_type->archived(1)->store();
104
        $credit_type->archived(1)->store();
105
        push @messages, { code => 'success_on_archive', type => 'message' };
105
        push @messages, { code => 'success_on_archive', type => 'message' };
Lines 110-116 elsif ( $op eq 'archive' ) { Link Here
110
    };
110
    };
111
    $op = 'list';
111
    $op = 'list';
112
}
112
}
113
elsif ( $op eq 'unarchive' ) {
113
elsif ( $op eq 'cud-unarchive' ) {
114
    try {
114
    try {
115
        $credit_type->archived(0)->store();
115
        $credit_type->archived(0)->store();
116
        push @messages, { code => 'success_on_restore', type => 'message' };
116
        push @messages, { code => 'success_on_restore', type => 'message' };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt (-4 / +24 lines)
Lines 202-212 Link Here
202
                                                <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form&amp;code=[% credit_type.code | uri %]&type=credit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
202
                                                <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form&amp;code=[% credit_type.code | uri %]&type=credit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
203
                                            [% END %]
203
                                            [% END %]
204
                                            [% IF !credit_type.is_system && !credit_type.archived %]
204
                                            [% IF !credit_type.is_system && !credit_type.archived %]
205
                                                <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=archive&amp;code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
205
                                                <form id="archive_[% credit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/credit_types.pl">
206
                                                    [% INCLUDE 'csrf-token.inc' %]
207
                                                    <input type="hidden" name="op" value="cud-archive" />
208
                                                    <input type="hidden" name="code" value="[% credit_type.code | html %]" />
209
                                                </form>
210
                                                <a class="btn btn-default btn-xs archive_button" href="#" data-code="[% credit_type.code | html %]"><i class="fa fa-archive"></i> Archive</a>
206
                                            [% END %]
211
                                            [% END %]
207
208
                                            [% IF !credit_type.is_system && credit_type.archived %]
212
                                            [% IF !credit_type.is_system && credit_type.archived %]
209
                                                <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=unarchive&amp;code=[% credit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a>
213
                                                <form id="unarchive_[% credit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/credit_types.pl">
214
                                                    [% INCLUDE 'csrf-token.inc' %]
215
                                                    <input type="hidden" name="op" value="cud-unarchive" />
216
                                                    <input type="hidden" name="code" value="[% credit_type.code | html %]" />
217
                                                </form>
218
                                                <a class="btn btn-default btn-xs unarchive_button" href="#" data-code="[% credit_type.code | html %]"><i class="fa fa-undo"></i> Restore</a>
210
                                            [% END %]
219
                                            [% END %]
211
                                        </td>
220
                                        </td>
212
                                    </tr>
221
                                    </tr>
Lines 265-270 Link Here
265
274
266
            //Start filtered
275
            //Start filtered
267
            $('#filter_system').click();
276
            $('#filter_system').click();
277
278
            $(".archive_button").on("click", function(e){
279
                e.preventDefault();
280
                var code = $(this).data('code');
281
                $('#archive_'+code).submit();
282
            });
283
284
            $(".unarchive_button").on("click", function(e){
285
                e.preventDefault();
286
                var code = $(this).data('code');
287
                $('#unarchive_'+code).submit();
288
            });
268
        });
289
        });
269
    </script>
290
    </script>
270
[% END %]
291
[% END %]
271
- 

Return to bug 36193