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

(-)a/acqui/invoice.pl (-3 / +8 lines)
Lines 71-77 if ( C4::Context->preference('AcqEnableFiles') ) { Link Here
71
if ( $op && $op eq 'close' ) {
71
if ( $op && $op eq 'close' ) {
72
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
72
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
73
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
73
        unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } );
74
    CloseInvoice($invoiceid);
74
    my @invoiceid = $input->multi_param('invoiceid');
75
    foreach my $invoiceid ( @invoiceid ) {
76
        CloseInvoice($invoiceid);
77
    }
75
    my $referer = $input->param('referer');
78
    my $referer = $input->param('referer');
76
    if ($referer) {
79
    if ($referer) {
77
        print $input->redirect($referer);
80
        print $input->redirect($referer);
Lines 81-88 if ( $op && $op eq 'close' ) { Link Here
81
elsif ( $op && $op eq 'reopen' ) {
84
elsif ( $op && $op eq 'reopen' ) {
82
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
85
    output_and_exit( $input, $cookie, $template, 'insufficient_permission' )
83
        unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
86
        unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } );
84
87
    my @invoiceid = $input->multi_param('invoiceid');
85
    ReopenInvoice($invoiceid);
88
    foreach my $invoiceid ( @invoiceid ) {
89
        ReopenInvoice($invoiceid);
90
    }
86
    my $referer = $input->param('referer');
91
    my $referer = $input->param('referer');
87
    if ($referer) {
92
    if ($referer) {
88
        print $input->redirect($referer);
93
        print $input->redirect($referer);
(-)a/acqui/invoices.pl (+11 lines)
Lines 111-119 foreach my $budget (@$budgets) { Link Here
111
    push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags );
111
    push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags );
112
}
112
}
113
113
114
my (@openedinvoices, @closedinvoices);
115
for my $sub ( @{$invoices} ) {
116
    unless ( $sub->{closedate} ) {
117
        push @openedinvoices, $sub
118
    } else {
119
        push @closedinvoices, $sub
120
    }
121
}
122
114
$template->{'VARS'}->{'budgets_loop'} = \@budgets_loop;
123
$template->{'VARS'}->{'budgets_loop'} = \@budgets_loop;
115
124
116
$template->param(
125
$template->param(
126
    openedinvoices => \@openedinvoices,
127
    closedinvoices => \@closedinvoices,
117
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
128
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
118
    invoices => $invoices,
129
    invoices => $invoices,
119
    invoicenumber   => $invoicenumber,
130
    invoicenumber   => $invoicenumber,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-26 / +77 lines)
Lines 25-35 Link Here
25
      <h1>Invoices</h1>
25
      <h1>Invoices</h1>
26
      [% IF ( do_search ) %]
26
      [% IF ( do_search ) %]
27
        [% IF invoices %]
27
        [% IF invoices %]
28
          [% BLOCK invoices_table %]
29
            [% IF closed %]
30
                [% SET tab = 'closed' %]
31
            [% ELSE %]
32
                [% SET tab = 'opened' %]
33
            [% END %]
28
          <label for="show_only_subscription">
34
          <label for="show_only_subscription">
29
            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
35
            <input type="checkbox" style="vertical-align: middle;" class="show_only_subscription" data-tableid="[% tab %]resultst"/>
30
            Show only subscriptions
36
            Show only subscriptions
31
          </label>
37
          </label>
32
          <table id="resultst">
38
          <table id="[% tab %]resultst" class="result">
33
            <thead>
39
            <thead>
34
              <tr>
40
              <tr>
35
                [% IF CAN_user_acquisition_merge_invoices %]
41
                [% IF CAN_user_acquisition_merge_invoices %]
Lines 108-130 Link Here
108
            </tbody>
114
            </tbody>
109
          </table>
115
          </table>
110
          [% IF CAN_user_acquisition_merge_invoices %]
116
          [% IF CAN_user_acquisition_merge_invoices %]
111
              <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
117
              <a class="submit merge" id="merge" href="#merge_invoices">Merge selected invoices</a>
112
              <div id="merge_invoices">
118
              [% IF tab == 'closed' %]
113
                  <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
119
                <a class="submit" id="open_sel" href="#reopen_selected" data-op="reopen" data-referer="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-refresh"></i> Reopen Selected Invoices</a>
114
                  <fieldset class="rows">
120
              [% ELSE  %]
115
                      <ol>
121
                <a class="submit" id="close_sel" href="#close_selected" data-op="close" data-referer="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 Selected Invoices</a>
116
                      <li><h2>Merge invoices</h2></li>
122
              [% END %]
117
                      <li><table id="merge_table">
123
118
                          <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
124
              [% END %] <!-- invoices_table -->
119
                          <tbody>
125
              <div id="invoicestabs" class="toptabs" style="clear:both;">
120
                          </tbody>
126
                  <ul class="ui-tabs-nav">
121
                      </table></li>
127
                      <li><a href="#opened">Open Invoices ([% openedinvoices.size || 0 | html %])</a></li>
122
                      <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
128
                      <li><a href="#closed">Closed Invoices ([% closedinvoices.size || 0 | html %]) </a></li>
123
                              <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
129
                  </ul>
124
                              <span class="required">Required</span>
130
                  <div id="opened">
125
                              </li>
131
                      [% IF openedinvoices %]
126
                      <li><label for="merge_shipmentdate">Shipment date:</label>
132
                        [% INCLUDE invoices_table invoices = openedinvoices %]
127
                              <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
133
                    [% ELSE %]
134
                        <div class="dialog message">
135
                            <p>Your search returned no open invoices.</p>
136
                        </div>
137
                    [% END %]
138
                  </div> <!-- opened -->
139
                  <div id="closed">
140
                      [% IF closedinvoices %]
141
                        [% INCLUDE invoices_table invoices = closedinvoices closed = 1 %]
142
                    [% ELSE %]
143
                        <div class="dialog message">
144
                            <p>Your search returned no closed invoices.</p>
145
                        </div>
146
                    [% END %]
147
                </div> <!-- closed -->
148
              </div> <!-- invoicestabs -->
149
150
151
                <div id="merge_invoices">
152
                    <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
153
                    <fieldset class="rows">
154
                        <ol>
155
                        <li><h2>Merge invoices</h2></li>
156
                        <li><table id="merge_table">
157
                            <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
158
                            <tbody>
159
                            </tbody>
160
                        </table></li>
161
                        <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
162
                                <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
163
                                <span class="required">Required</span>
164
                                </li>
165
                        <li><label for="merge_shipmentdate">Shipment date:</label>
166
                                <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
128
167
129
                      <li><label for="merge_billingdate">Billing date:</label>
168
                      <li><label for="merge_billingdate">Billing date:</label>
130
                              <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
169
                              <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
Lines 317-326 Link Here
317
    [% INCLUDE 'calendar.inc' %]
356
    [% INCLUDE 'calendar.inc' %]
318
    <script>
357
    <script>
319
        $(document).ready(function() {
358
        $(document).ready(function() {
359
            $('#invoicestabs').tabs();
320
            $(".delete_invoice").click(function(){
360
            $(".delete_invoice").click(function(){
321
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
361
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
322
            });
362
            });
323
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
363
            var resultst = $("table.result").dataTable($.extend(true, {}, dataTablesDefaults, {
324
                bPaginate: false,
364
                bPaginate: false,
325
                aoColumnDefs: [
365
                aoColumnDefs: [
326
                    { "bSortable": false, "aTargets": [1, -1] },
366
                    { "bSortable": false, "aTargets": [1, -1] },
Lines 329-345 Link Here
329
                ]
369
                ]
330
            }));
370
            }));
331
371
332
            $("#show_only_subscription").prop("checked", false);
372
            $(".show_only_subscription").prop("checked", false);
333
373
334
            $("#show_only_subscription").click(function(){
374
            $(".show_only_subscription").click(function(){
375
                var table_id = $(this).attr("data-tableid");
335
                if ( $(this).prop("checked") ) {
376
                if ( $(this).prop("checked") ) {
336
                    resultst.fnFilter( "1", 0, true );
377
                    $('#'+table_id).dataTable().fnFilter( "1", 0, true );
337
                } else {
378
                } else {
338
                    resultst.fnFilter( '', 0 );
379
                    $('#'+table_id).dataTable().fnFilter( '', 0 );
339
                }
380
                }
340
            });
381
            });
341
382
342
            $('#merge').click(function (ev) {
383
            $('#open_sel,#close_sel').click(function () {
384
                var referer = $(this).attr("data-referer");
385
                var op = $(this).attr("data-op");
386
                var invoice_link = "invoice.pl?op="+op;
387
                $('.select-invoice:checked').each(function () {
388
                    var row = $(this).parents('tr');
389
                    invoice_link = invoice_link + "&amp;invoiceid="+$(row).attr('data-invoiceid');
390
                });
391
                window.location.href =invoice_link +"&amp;"+referer;
392
            });
393
394
            $('.merge').click(function (ev) {
343
                var booksellerid;
395
                var booksellerid;
344
                var mismatch;
396
                var mismatch;
345
                var invoices = [ ];
397
                var invoices = [ ];
346
- 

Return to bug 22773