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

(-)a/Koha/Illrequest.pm (+30 lines)
Lines 2003-2008 sub strings_map { Link Here
2003
    return $strings;
2003
    return $strings;
2004
}
2004
}
2005
2005
2006
=head3 get_staff_table_actions
2007
2008
    my $ill_table_actions = $self->get_staff_table_actions;
2009
2010
Returns the table actions available in the Staff ILL list table
2011
A total join of core static actions with custom actions provided by
2012
installed plugins that implement the ill_table_actions hook
2013
2014
=cut
2015
2016
sub get_staff_table_actions {
2017
    my ( $self, $params ) = @_;
2018
2019
    my $ill_table_actions = [
2020
        {
2021
            button_class                  => 'btn btn-default btn-sm',
2022
            button_link                   => '/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=',
2023
            append_column_data_to_link    => 1,
2024
            button_link_translatable_text => 'ill_manage',
2025
        }
2026
    ];
2027
2028
    my @plugin_responses = Koha::Plugins->call('ill_table_actions');
2029
    for my $plugin_variables (@plugin_responses) {
2030
        push( @{$ill_table_actions}, $plugin_variables );
2031
    }
2032
2033
    return $ill_table_actions;
2034
}
2035
2006
=head3 _type
2036
=head3 _type
2007
2037
2008
=cut
2038
=cut
(-)a/ill/ill-requests.pl (+1 lines)
Lines 410-415 if ( $backends_available ) { Link Here
410
            }
410
            }
411
        }
411
        }
412
412
413
        $template->param( table_actions => encode_json( Koha::Illrequest->get_staff_table_actions ) );
413
    } elsif ( $op eq "save_comment" ) {
414
    } elsif ( $op eq "save_comment" ) {
414
        die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
415
        die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
415
           session_id => scalar $cgi->cookie('CGISESSID'),
416
           session_id => scalar $cgi->cookie('CGISESSID'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (+3 lines)
Lines 56-61 Link Here
56
    <div class="row">
56
    <div class="row">
57
57
58
        [% IF query_type == 'illlist' %]
58
        [% IF query_type == 'illlist' %]
59
            <script>
60
                var ill_table_actions = [% table_actions | $raw %];
61
            </script>
59
            <div class="col-sm-2">
62
            <div class="col-sm-2">
60
                <aside>
63
                <aside>
61
                    <form method="get" id="illfilter_form">
64
                    <form method="get" id="illfilter_form">
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js (-6 / +15 lines)
Lines 408-418 $(document).ready(function() { Link Here
408
                "orderable": false,
408
                "orderable": false,
409
                "searchable": false,
409
                "searchable": false,
410
                "render": function( data, type, row, meta ) {
410
                "render": function( data, type, row, meta ) {
411
                    return '<a class="btn btn-default btn-sm" ' +
411
                    return render_table_actions(data);
412
                            'href="/cgi-bin/koha/ill/ill-requests.pl?' +
413
                            'method=illview&amp;illrequest_id=' +
414
                            encodeURIComponent(data) +
415
                            '">' + ill_manage + '</a>';
416
                }
412
                }
417
            }
413
            }
418
        ]
414
        ]
Lines 420-425 $(document).ready(function() { Link Here
420
416
421
    $("#illfilter_form").on('submit', filter);
417
    $("#illfilter_form").on('submit', filter);
422
418
419
    function render_table_actions(data) {
420
        let actions_string = "";
421
        ill_table_actions.forEach((ill_table_action) => {
422
            let link_data = ill_table_action.append_column_data_to_link
423
                ? encodeURIComponent(data)
424
                : "";
425
            let link_text = ill_table_action.button_link_translatable_text
426
                ? eval(ill_table_action.button_link_translatable_text)
427
                : ill_table_action.button_link_text;
428
            actions_string += `<a class="${ill_table_action.button_class}" href="${ill_table_action.button_link}${link_data}">${link_text}</a>`;
429
        });
430
        return actions_string;
431
    }
432
423
    function redrawTable() {
433
    function redrawTable() {
424
        let table_dt = ill_requests_table.DataTable();
434
        let table_dt = ill_requests_table.DataTable();
425
        table_dt.draw();
435
        table_dt.draw();
426
- 

Return to bug 35331