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

(-)a/acqui/invoice.pl (-2 / +8 lines)
Lines 62-68 if ( C4::Context->preference('AcqEnableFiles') ) { Link Here
62
}
62
}
63
63
64
if ( $op && $op eq 'close' ) {
64
if ( $op && $op eq 'close' ) {
65
    CloseInvoice($invoiceid);
65
    my @invoiceid = $input->multi_param('invoiceid');
66
    foreach my $invoiceid ( @invoiceid ) {
67
        CloseInvoice($invoiceid);
68
    }
66
    my $referer = $input->param('referer');
69
    my $referer = $input->param('referer');
67
    if ($referer) {
70
    if ($referer) {
68
        print $input->redirect($referer);
71
        print $input->redirect($referer);
Lines 70-76 if ( $op && $op eq 'close' ) { Link Here
70
    }
73
    }
71
}
74
}
72
elsif ( $op && $op eq 'reopen' ) {
75
elsif ( $op && $op eq 'reopen' ) {
73
    ReopenInvoice($invoiceid);
76
    my @invoiceid = $input->multi_param('invoiceid');
77
    foreach my $invoiceid ( @invoiceid ) {
78
        ReopenInvoice($invoiceid);
79
    }
74
    my $referer = $input->param('referer');
80
    my $referer = $input->param('referer');
75
    if ($referer) {
81
    if ($referer) {
76
        print $input->redirect($referer);
82
        print $input->redirect($referer);
(-)a/acqui/invoices.pl (+11 lines)
Lines 112-120 foreach my $budget (@$budgets) { Link Here
112
    push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags );
112
    push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags );
113
}
113
}
114
114
115
my (@openedinvoices, @closedinvoices);
116
for my $sub ( @{$invoices} ) {
117
    unless ( $sub->{closedate} ) {
118
        push @openedinvoices, $sub
119
    } else {
120
        push @closedinvoices, $sub
121
    }
122
}
123
115
$template->{'VARS'}->{'budgets_loop'} = \@budgets_loop;
124
$template->{'VARS'}->{'budgets_loop'} = \@budgets_loop;
116
125
117
$template->param(
126
$template->param(
127
    openedinvoices => \@openedinvoices,
128
    closedinvoices => \@closedinvoices,
118
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
129
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
119
    invoices => $invoices,
130
    invoices => $invoices,
120
    invoicenumber   => $invoicenumber,
131
    invoicenumber   => $invoicenumber,
(-)a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js (+40 lines)
Line 0 Link Here
1
/**
2
 * Apply the same filter to all DataTable instances on a particular page. The
3
 * function call exactly matches that used by `fnFilter()` so regular expression
4
 * and individual column sorting can be used.
5
 *
6
 * DataTables 1.10+ provides this ability through its new API, which is able to
7
 * to control multiple tables at a time.
8
 * `$('.dataTable').DataTable().search( ... )` for example will apply the same
9
 * filter to all tables on the page. The new API should be used in preference
10
 * to this older method if at all possible.
11
 *
12
 *  @name fnFilterAll
13
 *  @summary Apply a common filter to all DataTables on a page
14
 *  @author [Kristoffer Karlström](http://www.kmmtiming.se/)
15
 *  @deprecated
16
 *
17
 *  @param {string} sInput Filtering input
18
 *  @param {integer} [iColumn=null] Column to apply the filter to
19
 *  @param {boolean} [bRegex] Regular expression flag
20
 *  @param {boolean} [bSmart] Smart filtering flag
21
 *
22
 *  @example
23
 *    $(document).ready(function() {
24
 *      var table = $(".dataTable").dataTable();
25
 *       
26
 *      $("#search").keyup( function () {
27
 *        // Filter on the column (the index) of this element
28
 *        table.fnFilterAll(this.value);
29
 *      } );
30
 *    });
31
 */
32
33
jQuery.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) {
34
    var settings = $.fn.dataTableSettings;
35
    
36
    for ( var i=0 ; i<settings.length ; i++ ) {
37
        settings[i].oInstance.fnFilter( sInput, iColumn, bRegex, bSmart);
38
    }
39
};
40
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-7 / +58 lines)
Lines 27-33 Link Here
27
            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
27
            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
28
            Show only subscriptions
28
            Show only subscriptions
29
          </label>
29
          </label>
30
          <table id="resultst">
30
          [% BLOCK invoices_table %]
31
            [% IF closed %]
32
                [% SET tab = 'closed' %]
33
            [% ELSE %]
34
                [% SET tab = 'opened' %]
35
            [% END %]
36
          <table id="[% tab %]resultst" class="result">
31
            <thead>
37
            <thead>
32
              <tr>
38
              <tr>
33
                <th>&nbsp;</th>
39
                <th>&nbsp;</th>
Lines 95-101 Link Here
95
              [% END %]
101
              [% END %]
96
            </tbody>
102
            </tbody>
97
          </table>
103
          </table>
98
          <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
104
          <a class="submit merge" id="merge" href="#merge_invoices">Merge selected invoices</a>
105
          [% IF tab == 'closed' %]
106
            <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>
107
          [% ELSE  %]
108
            <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>
109
          [% END %]
110
111
          [% END %] <!-- invoices_table -->
112
          <div id="invoicestabs" class="toptabs" style="clear:both;">
113
              <ul class="ui-tabs-nav">
114
                  <li><a href="#opened">Open Invoices ([% openedinvoices.size || 0 | html %])</a></li>
115
                  <li><a href="#closed">Closed Invoices ([% closedinvoices.size || 0 | html %]) </a></li>
116
              </ul>
117
              <div id="opened">
118
                  [% IF openedinvoices %]
119
                    [% INCLUDE invoices_table invoices = openedinvoices %]
120
                [% ELSE %]
121
                    <div class="dialog message">
122
                        <p>Your search returned no open invoices.</p>
123
                    </div>
124
                [% END %]
125
              </div> <!-- opened -->
126
              <div id="closed">
127
                  [% IF closedinvoices %]
128
                    [% INCLUDE invoices_table invoices = closedinvoices closed = 1 %]
129
                [% ELSE %]
130
                    <div class="dialog message">
131
                        <p>Your search returned no closed invoices.</p>
132
                    </div>
133
                [% END %]
134
            </div> <!-- closed -->
135
          </div> <!-- invoicestabs -->
136
137
99
            <div id="merge_invoices">
138
            <div id="merge_invoices">
100
                <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
139
                <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
101
                <fieldset class="rows">
140
                <fieldset class="rows">
Lines 300-312 Link Here
300
[% MACRO jsinclude BLOCK %]
339
[% MACRO jsinclude BLOCK %]
301
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
340
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
302
    [% INCLUDE 'datatables.inc' %]
341
    [% INCLUDE 'datatables.inc' %]
342
    [% Asset.js("lib/jquery/plugins/dataTables.fnFilterAll.js") | $raw %]
303
    [% INCLUDE 'calendar.inc' %]
343
    [% INCLUDE 'calendar.inc' %]
304
    <script>
344
    <script>
305
        $(document).ready(function() {
345
        $(document).ready(function() {
346
            $('#invoicestabs').tabs();
306
            $(".delete_invoice").click(function(){
347
            $(".delete_invoice").click(function(){
307
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
348
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
308
            });
349
            });
309
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
350
            var resultst = $("table.result").dataTable($.extend(true, {}, dataTablesDefaults, {
310
                bPaginate: false,
351
                bPaginate: false,
311
                aoColumnDefs: [
352
                aoColumnDefs: [
312
                    { "bSortable": false, "aTargets": [1, -1] },
353
                    { "bSortable": false, "aTargets": [1, -1] },
Lines 319-331 Link Here
319
360
320
            $("#show_only_subscription").click(function(){
361
            $("#show_only_subscription").click(function(){
321
                if ( $(this).prop("checked") ) {
362
                if ( $(this).prop("checked") ) {
322
                    resultst.fnFilter( "1", 0, true );
363
                    resultst.fnFilterAll( "1", 0, true );
323
                } else {
364
                } else {
324
                    resultst.fnFilter( '', 0 );
365
                    resultst.fnFilterAll( '', 0 );
325
                }
366
                }
326
            });
367
            });
327
368
328
            $('#merge').click(function (ev) {
369
            $('#open_sel,#close_sel').click(function () {
370
                var referer = $(this).attr("data-referer");
371
                var op = $(this).attr("data-op");
372
                var invoice_link = "invoice.pl?op="+op;
373
                $('.select-invoice:checked').each(function () {
374
                    var row = $(this).parents('tr');
375
                    invoice_link = invoice_link + "&amp;invoiceid="+$(row).attr('data-invoiceid');
376
                });
377
                window.location.href =invoice_link +"&amp;"+referer;
378
            });
379
380
            $('.merge').click(function (ev) {
329
                var booksellerid;
381
                var booksellerid;
330
                var mismatch;
382
                var mismatch;
331
                var invoices = [ ];
383
                var invoices = [ ];
332
- 

Return to bug 22773