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

(-)a/acqui/invoice.pl (-3 / +3 lines)
Lines 71-77 if ( C4::Context->preference('AcqEnableFiles') ) { Link Here
71
        tabletag => 'aqinvoices', recordid => $invoiceid );
71
        tabletag => 'aqinvoices', recordid => $invoiceid );
72
}
72
}
73
73
74
if ( $op && $op eq 'close' ) {
74
if ( $op && $op eq 'cud-close' ) {
75
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
75
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
76
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
76
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
77
    my @invoiceid = $input->multi_param('invoiceid');
77
    my @invoiceid = $input->multi_param('invoiceid');
Lines 84-90 if ( $op && $op eq 'close' ) { Link Here
84
        exit 0;
84
        exit 0;
85
    }
85
    }
86
}
86
}
87
elsif ( $op && $op eq 'reopen' ) {
87
elsif ( $op && $op eq 'cud-reopen' ) {
88
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
88
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
89
        unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
89
        unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
90
    my @invoiceid = $input->multi_param('invoiceid');
90
    my @invoiceid = $input->multi_param('invoiceid');
Lines 154-160 elsif ( $op && $op eq 'cud-delete' ) { Link Here
154
        exit 0;
154
        exit 0;
155
    }
155
    }
156
}
156
}
157
elsif ( $op && $op eq 'del_adj' ) {
157
elsif ( $op && $op eq 'cud-del_adj' ) {
158
158
159
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
159
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
160
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
160
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-4 / +4 lines)
Lines 230-236 Link Here
230
                                        [% END # /IF adjustment.encumber_open  %]
230
                                        [% END # /IF adjustment.encumber_open  %]
231
                                        [% UNLESS readonly %]
231
                                        [% UNLESS readonly %]
232
                                            <td>
232
                                            <td>
233
                                                <a class="btn btn-default btn-xs delete_adjustment" href="/cgi-bin/koha/acqui/invoice.pl?op=del_adj&adjustment_id=[% adjustment.adjustment_id | html %]&invoiceid=[% invoiceid | html %]"><i class="fa fa-trash-can"></i> Delete</a>
233
                                                <a class="btn btn-default btn-xs submit-form-link" href="#" data-adjustment_id="[% adjustment.adjustment_id | html %]" data-invoiceid="[% invoiceid | html %]" data-action="invoice.pl" data-method="post" data-op="cud-del_adj" data-confirmation="confirm_del_adj">
234
                                                <i class="fa fa-trash-can"></i> Delete</a>
234
                                            </td>
235
                                            </td>
235
                                        [% END %]
236
                                        [% END %]
236
                                    </tr>
237
                                    </tr>
Lines 537-543 Link Here
537
</span> <!-- /#all_fund_dropdown -->
538
</span> <!-- /#all_fund_dropdown -->
538
539
539
[% MACRO jsinclude BLOCK %]
540
[% MACRO jsinclude BLOCK %]
541
    <script>var confirm_del_adj = _("Are you sure you want to delete this adjustment?");</script>
540
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
542
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
543
    [% Asset.js("js/form-submit.js") | $raw %]
541
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
544
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
542
    [% Asset.js("js/acq.js") | $raw %]
545
    [% Asset.js("js/acq.js") | $raw %]
543
    [% INCLUDE 'calendar.inc' %]
546
    [% INCLUDE 'calendar.inc' %]
Lines 586-594 Link Here
586
                e.preventDefault();
589
                e.preventDefault();
587
                $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
590
                $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
588
            });
591
            });
589
            $("a.delete_adjustment").click(function(){
590
                return ( confirm( _("Are you sure you want to delete this file ?") ) );
591
            });
592
592
593
            //keep a copy of all budgets before removing the inactives
593
            //keep a copy of all budgets before removing the inactives
594
            var disabledBudgetsCopy = $("#all_fund_dropdown").html();
594
            var disabledBudgetsCopy = $("#all_fund_dropdown").html();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-3 / +4 lines)
Lines 102-117 Link Here
102
                                                        <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
102
                                                        <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
103
                                                        [% IF invoice.closedate %]
103
                                                        [% IF invoice.closedate %]
104
                                                            [% IF CAN_user_acquisition_reopen_closed_invoices %]
104
                                                            [% IF CAN_user_acquisition_reopen_closed_invoices %]
105
                                                                <li><a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa-solid fa-rotate"></i> Reopen</a></li>
105
                                                            <li><a class="submit-form-link" data-action="invoice.pl" data-op="cud-reopen" data-invoiceid="[% invoice.invoiceid | uri %]" data-referer="/cgi-bin/koha/acqui/invoices.pl?op=do_search&invoicenumber=[% invoicenumber | html %]&supplier=[% booksellerid | html %]&shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]&shipmentdateto=[% shipmentdateto | $KohaDates %]&billingdatefrom=[% billingdatefrom | $KohaDates %]&billingdateto=[% billingdateto | $KohaDates %]&isbneanissn=[% isbneanissn | html %]&title=[% title | html %]&author=[% author | html %]&publisher=[% publisher | html %]&publicationyear=[% publicationyear | html %]&branch=[% branch | html %]" data-method="post"><i class="fa-solid fa-rotate"></i> Reopen</a></li>
106
                                                            [% END %]
106
                                                            [% END %]
107
                                                        [% ELSE %]
107
                                                        [% ELSE %]
108
                                                            [% IF CAN_user_acquisition_edit_invoices %]
108
                                                            [% IF CAN_user_acquisition_edit_invoices %]
109
                                                                <li><a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-times-circle"></i> Close</a></li>
109
                                                            <li><a class="submit-form-link" data-action="invoice.pl" data-op="cud-close" data-invoiceid="[% invoice.invoiceid | html %]" data-referer="/cgi-bin/koha/acqui/invoices.pl?op=do_search&invoicenumber=[% invoicenumber | html %]&supplier=[% booksellerid | html %]&shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]&shipmentdateto=[% shipmentdateto | $KohaDates %]&billingdatefrom=[% billingdatefrom | $KohaDates %]&billingdateto=[% billingdateto | $KohaDates %]&isbneanissn=[% isbneanissn | html %]&title=[% title | html %]&author=[% author | html %]&publisher=[% publisher | html %]&publicationyear=[% publicationyear | html %]&branch=[% branch | html %]" data-method="post"><i class="fa fa-times-circle"></i> Close</a></li>
110
                                                            [% END %]
110
                                                            [% END %]
111
                                                        [% END # /IF invoice.closedate %]
111
                                                        [% END # /IF invoice.closedate %]
112
                                                        [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
112
                                                        [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
113
                                                            [% IF CAN_user_acquisition_delete_invoices %]
113
                                                            [% IF CAN_user_acquisition_delete_invoices %]
114
                                                                <li><a href="invoice.pl?op=delete&amp;invoiceid=[% invoice.invoiceid | uri %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]" class="delete_invoice"><i class="fa fa-trash-can"></i> Delete</a></li>
114
                                                            <li><a class="submit-form-link" data-action="invoice.pl" data-op="cud-delete" data-invoiceid="[% invoice.invoiceid | html %]" data-referer="/cgi-bin/koha/acqui/invoices.pl?op=do_search&invoicenumber=[% invoicenumber | html %]&supplier=[% booksellerid | html %]&shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]&shipmentdateto=[% shipmentdateto | $KohaDates %]&billingdatefrom=[% billingdatefrom | $KohaDates %]&billingdateto=[% billingdateto | $KohaDates %]&isbneanissn=[% isbneanissn | uri %]&title=[% title | html %]%26author=[% author | html %]&publisher=[% publisher | html %]&publicationyear=[% publicationyear | html %]&branch=[% branch | html %]" data-method="post"><i class="fa fa-trash-can"></i> Delete</a></li>
115
                                                            [% END %]
115
                                                            [% END %]
116
                                                        [% END %]
116
                                                        [% END %]
117
                                                    </ul>
117
                                                    </ul>
Lines 418-423 Link Here
418
418
419
[% MACRO jsinclude BLOCK %]
419
[% MACRO jsinclude BLOCK %]
420
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
420
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
421
    [% Asset.js("js/form-submit.js") | $raw %]
421
    [% INCLUDE 'datatables.inc' %]
422
    [% INCLUDE 'datatables.inc' %]
422
    [% INCLUDE 'calendar.inc' %]
423
    [% INCLUDE 'calendar.inc' %]
423
    [% INCLUDE 'select2.inc' %]
424
    [% INCLUDE 'select2.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/form-submit.js (-1 / +34 lines)
Line 0 Link Here
0
- 
1
$(document).ready(function(){
2
3
    $('.submit-form-link').click(function(e){
4
        e.preventDefault();
5
        let form_data = $(this).data();
6
7
        form_confirm = form_data.confirmation;
8
        let confirmation = 1;
9
        if( form_confirm ){
10
            delete form_data.confirmation;
11
            confirmation = confirm( eval(form_confirm) );
12
        }
13
        if( !confirmation ){ return false }
14
15
        let the_form = $('<form/>');
16
        if( form_data.method === 'post' ){
17
            form_data.csrf_token = $('meta[name="csrf-token"]').attr('content');
18
        }
19
        the_form.attr('method', form_data.method);
20
        the_form.attr('action', form_data.action);
21
        delete form_data.method;
22
        delete form_data.action;
23
        $.each( form_data, function( key, value){
24
            the_form.append( $('<input/>',{
25
                type: "hidden",
26
                name: key,
27
                value: value,
28
                })
29
            );
30
        });
31
        $('body').append( the_form );
32
        the_form.submit();
33
    });
34
});

Return to bug 36246