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 38-48 Link Here
38
      <h1>Invoices</h1>
38
      <h1>Invoices</h1>
39
      [% IF ( do_search ) %]
39
      [% IF ( do_search ) %]
40
        [% IF invoices %]
40
        [% IF invoices %]
41
          [% BLOCK invoices_table %]
42
            [% IF closed %]
43
                [% SET tab = 'closed' %]
44
            [% ELSE %]
45
                [% SET tab = 'opened' %]
46
            [% END %]
41
          <label for="show_only_subscription">
47
          <label for="show_only_subscription">
42
            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
48
            <input type="checkbox" style="vertical-align: middle;" class="show_only_subscription" data-tableid="[% tab %]resultst"/>
43
            Show only subscriptions
49
            Show only subscriptions
44
          </label>
50
          </label>
45
          <table id="resultst">
51
          <table id="[% tab %]resultst" class="result">
46
            <thead>
52
            <thead>
47
              <tr>
53
              <tr>
48
                [% IF CAN_user_acquisition_merge_invoices %]
54
                [% IF CAN_user_acquisition_merge_invoices %]
Lines 113-135 Link Here
113
            </tbody>
119
            </tbody>
114
          </table>
120
          </table>
115
          [% IF CAN_user_acquisition_merge_invoices %]
121
          [% IF CAN_user_acquisition_merge_invoices %]
116
              <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
122
              <a class="submit merge" id="merge" href="#merge_invoices">Merge selected invoices</a>
117
              <div id="merge_invoices">
123
              [% IF tab == 'closed' %]
118
                  <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
124
                <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>
119
                  <fieldset class="rows">
125
              [% ELSE  %]
120
                      <ol>
126
                <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>
121
                      <li><h2>Merge invoices</h2></li>
127
              [% END %]
122
                      <li><table id="merge_table">
128
123
                          <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
129
              [% END %] <!-- invoices_table -->
124
                          <tbody>
130
              <div id="invoicestabs" class="toptabs" style="clear:both;">
125
                          </tbody>
131
                  <ul class="ui-tabs-nav">
126
                      </table></li>
132
                      <li><a href="#opened">Open Invoices ([% openedinvoices.size || 0 | html %])</a></li>
127
                      <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
133
                      <li><a href="#closed">Closed Invoices ([% closedinvoices.size || 0 | html %]) </a></li>
128
                              <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
134
                  </ul>
129
                              <span class="required">Required</span>
135
                  <div id="opened">
130
                              </li>
136
                      [% IF openedinvoices %]
131
                      <li><label for="merge_shipmentdate">Shipment date:</label>
137
                        [% INCLUDE invoices_table invoices = openedinvoices %]
132
                              <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
138
                    [% ELSE %]
139
                        <div class="dialog message">
140
                            <p>Your search returned no open invoices.</p>
141
                        </div>
142
                    [% END %]
143
                  </div> <!-- opened -->
144
                  <div id="closed">
145
                      [% IF closedinvoices %]
146
                        [% INCLUDE invoices_table invoices = closedinvoices closed = 1 %]
147
                    [% ELSE %]
148
                        <div class="dialog message">
149
                            <p>Your search returned no closed invoices.</p>
150
                        </div>
151
                    [% END %]
152
                </div> <!-- closed -->
153
              </div> <!-- invoicestabs -->
154
155
156
                <div id="merge_invoices">
157
                    <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
158
                    <fieldset class="rows">
159
                        <ol>
160
                        <li><h2>Merge invoices</h2></li>
161
                        <li><table id="merge_table">
162
                            <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
163
                            <tbody>
164
                            </tbody>
165
                        </table></li>
166
                        <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
167
                                <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
168
                                <span class="required">Required</span>
169
                                </li>
170
                        <li><label for="merge_shipmentdate">Shipment date:</label>
171
                                <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
133
172
134
                      <li><label for="merge_billingdate">Billing date:</label>
173
                      <li><label for="merge_billingdate">Billing date:</label>
135
                              <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
174
                              <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
Lines 322-331 Link Here
322
    [% INCLUDE 'calendar.inc' %]
361
    [% INCLUDE 'calendar.inc' %]
323
    <script>
362
    <script>
324
        $(document).ready(function() {
363
        $(document).ready(function() {
364
            $('#invoicestabs').tabs();
325
            $(".delete_invoice").click(function(){
365
            $(".delete_invoice").click(function(){
326
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
366
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
327
            });
367
            });
328
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
368
            var resultst = $("table.result").dataTable($.extend(true, {}, dataTablesDefaults, {
329
                bPaginate: false,
369
                bPaginate: false,
330
                aoColumnDefs: [
370
                aoColumnDefs: [
331
                    { "bSortable": false, "aTargets": [1, -1] },
371
                    { "bSortable": false, "aTargets": [1, -1] },
Lines 333-349 Link Here
333
                ]
373
                ]
334
            }));
374
            }));
335
375
336
            $("#show_only_subscription").prop("checked", false);
376
            $(".show_only_subscription").prop("checked", false);
337
377
338
            $("#show_only_subscription").click(function(){
378
            $(".show_only_subscription").click(function(){
379
                var table_id = $(this).attr("data-tableid");
339
                if ( $(this).prop("checked") ) {
380
                if ( $(this).prop("checked") ) {
340
                    resultst.fnFilter( "1", 0, true );
381
                    $('#'+table_id).dataTable().fnFilter( "1", 0, true );
341
                } else {
382
                } else {
342
                    resultst.fnFilter( '', 0 );
383
                    $('#'+table_id).dataTable().fnFilter( '', 0 );
343
                }
384
                }
344
            });
385
            });
345
386
346
            $('#merge').click(function (ev) {
387
            $('#open_sel,#close_sel').click(function () {
388
                var referer = $(this).attr("data-referer");
389
                var op = $(this).attr("data-op");
390
                var invoice_link = "invoice.pl?op="+op;
391
                $('.select-invoice:checked').each(function () {
392
                    var row = $(this).parents('tr');
393
                    invoice_link = invoice_link + "&amp;invoiceid="+$(row).attr('data-invoiceid');
394
                });
395
                window.location.href =invoice_link +"&amp;"+referer;
396
            });
397
398
            $('.merge').click(function (ev) {
347
                var booksellerid;
399
                var booksellerid;
348
                var mismatch;
400
                var mismatch;
349
                var invoices = [ ];
401
                var invoices = [ ];
350
- 

Return to bug 22773