Bugzilla – Attachment 106538 Details for
Bug 22773
Bulk close invoices and filter invoice view (open/closed)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22773: Bulk Close invoices and Filter invoice view (open/closed)
Bug-22773-Bulk-Close-invoices-and-Filter-invoice-v.patch (text/plain), 10.10 KB, created by
Katrin Fischer
on 2020-07-05 10:46:35 UTC
(
hide
)
Description:
Bug 22773: Bulk Close invoices and Filter invoice view (open/closed)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-07-05 10:46:35 UTC
Size:
10.10 KB
patch
obsolete
>From a708c7d3e30e0e8af136b73da3ebe42c7a9cf3f1 Mon Sep 17 00:00:00 2001 >From: Devinim <kohadevinim@devinim.com.tr> >Date: Tue, 1 Oct 2019 09:38:24 +0000 >Subject: [PATCH] Bug 22773: Bulk Close invoices and Filter invoice view > (open/closed) > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > acqui/invoice.pl | 10 +++- > acqui/invoices.pl | 11 ++++ > .../lib/jquery/plugins/dataTables.fnFilterAll.js | 39 +++++++++++++ > .../prog/en/modules/acqui/invoices.tt | 64 ++++++++++++++++++++-- > 4 files changed, 116 insertions(+), 8 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js > >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >index 26717e99fe..d62f6fe9c9 100755 >--- a/acqui/invoice.pl >+++ b/acqui/invoice.pl >@@ -62,7 +62,10 @@ if ( C4::Context->preference('AcqEnableFiles') ) { > } > > if ( $op && $op eq 'close' ) { >- CloseInvoice($invoiceid); >+ my @invoiceid = $input->multi_param('invoiceid'); >+ foreach my $invoiceid ( @invoiceid ) { >+ CloseInvoice($invoiceid); >+ } > my $referer = $input->param('referer'); > if ($referer) { > print $input->redirect($referer); >@@ -70,7 +73,10 @@ if ( $op && $op eq 'close' ) { > } > } > elsif ( $op && $op eq 'reopen' ) { >- ReopenInvoice($invoiceid); >+ my @invoiceid = $input->multi_param('invoiceid'); >+ foreach my $invoiceid ( @invoiceid ) { >+ ReopenInvoice($invoiceid); >+ } > my $referer = $input->param('referer'); > if ($referer) { > print $input->redirect($referer); >diff --git a/acqui/invoices.pl b/acqui/invoices.pl >index 8ab7a3256d..ec65579c88 100755 >--- a/acqui/invoices.pl >+++ b/acqui/invoices.pl >@@ -112,9 +112,20 @@ foreach my $budget (@$budgets) { > push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags ); > } > >+my (@openedinvoices, @closedinvoices); >+for my $sub ( @{$invoices} ) { >+ unless ( $sub->{closedate} ) { >+ push @openedinvoices, $sub >+ } else { >+ push @closedinvoices, $sub >+ } >+} >+ > $template->{'VARS'}->{'budgets_loop'} = \@budgets_loop; > > $template->param( >+ openedinvoices => \@openedinvoices, >+ closedinvoices => \@closedinvoices, > do_search => ( $op and $op eq 'do_search' ) ? 1 : 0, > invoices => $invoices, > invoicenumber => $invoicenumber, >diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js >new file mode 100644 >index 0000000000..91c9d2093e >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js >@@ -0,0 +1,39 @@ >+/** >+ * Apply the same filter to all DataTable instances on a particular page. The >+ * function call exactly matches that used by `fnFilter()` so regular expression >+ * and individual column sorting can be used. >+ * >+ * DataTables 1.10+ provides this ability through its new API, which is able to >+ * to control multiple tables at a time. >+ * `$('.dataTable').DataTable().search( ... )` for example will apply the same >+ * filter to all tables on the page. The new API should be used in preference >+ * to this older method if at all possible. >+ * >+ * @name fnFilterAll >+ * @summary Apply a common filter to all DataTables on a page >+ * @author [Kristoffer Karlström](http://www.kmmtiming.se/) >+ * @deprecated >+ * >+ * @param {string} sInput Filtering input >+ * @param {integer} [iColumn=null] Column to apply the filter to >+ * @param {boolean} [bRegex] Regular expression flag >+ * @param {boolean} [bSmart] Smart filtering flag >+ * >+ * @example >+ * $(document).ready(function() { >+ * var table = $(".dataTable").dataTable(); >+ * >+ * $("#search").keyup( function () { >+ * // Filter on the column (the index) of this element >+ * table.fnFilterAll(this.value); >+ * } ); >+ * }); >+ */ >+ >+jQuery.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) { >+ var settings = $.fn.dataTableSettings; >+ >+ for ( var i=0 ; i<settings.length ; i++ ) { >+ settings[i].oInstance.fnFilter( sInput, iColumn, bRegex, bSmart); >+ } >+}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >index 5b8b34fad0..87197dc7ef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >@@ -27,7 +27,13 @@ > <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" /> > Show only subscriptions > </label> >- <table id="resultst"> >+ [% BLOCK invoices_table %] >+ [% IF closed %] >+ [% SET tab = 'closed' %] >+ [% ELSE %] >+ [% SET tab = 'opened' %] >+ [% END %] >+ <table id="[% tab %]resultst" class="result"> > <thead> > <tr> > <th> </th> >@@ -95,7 +101,40 @@ > [% END %] > </tbody> > </table> >- <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a> >+ <a class="submit merge" id="merge" href="#merge_invoices">Merge selected invoices</a> >+ [% IF tab == 'closed' %] >+ <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> >+ [% ELSE %] >+ <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> >+ [% END %] >+ >+ [% END %] <!-- invoices_table --> >+ <div id="invoicestabs" class="toptabs" style="clear:both;"> >+ <ul class="ui-tabs-nav"> >+ <li><a href="#opened">Open Invoices ([% openedinvoices.size || 0 | html %])</a></li> >+ <li><a href="#closed">Closed Invoices ([% closedinvoices.size || 0 | html %]) </a></li> >+ </ul> >+ <div id="opened"> >+ [% IF openedinvoices %] >+ [% INCLUDE invoices_table invoices = openedinvoices %] >+ [% ELSE %] >+ <div class="dialog message"> >+ <p>Your search returned no open invoices.</p> >+ </div> >+ [% END %] >+ </div> <!-- opened --> >+ <div id="closed"> >+ [% IF closedinvoices %] >+ [% INCLUDE invoices_table invoices = closedinvoices closed = 1 %] >+ [% ELSE %] >+ <div class="dialog message"> >+ <p>Your search returned no closed invoices.</p> >+ </div> >+ [% END %] >+ </div> <!-- closed --> >+ </div> <!-- invoicestabs --> >+ >+ > <div id="merge_invoices"> > <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post"> > <fieldset class="rows"> >@@ -300,13 +339,15 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >+ [% Asset.js("lib/jquery/plugins/dataTables.fnFilterAll.js") | $raw %] > [% INCLUDE 'calendar.inc' %] > <script> > $(document).ready(function() { >+ $('#invoicestabs').tabs(); > $(".delete_invoice").click(function(){ > return confirmDelete(_("Are you sure you want to delete this invoice?")); > }); >- var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ var resultst = $("table.result").dataTable($.extend(true, {}, dataTablesDefaults, { > bPaginate: false, > aoColumnDefs: [ > { "bSortable": false, "aTargets": [1, -1] }, >@@ -319,13 +360,24 @@ > > $("#show_only_subscription").click(function(){ > if ( $(this).prop("checked") ) { >- resultst.fnFilter( "1", 0, true ); >+ resultst.fnFilterAll( "1", 0, true ); > } else { >- resultst.fnFilter( '', 0 ); >+ resultst.fnFilterAll( '', 0 ); > } > }); > >- $('#merge').click(function (ev) { >+ $('#open_sel,#close_sel').click(function () { >+ var referer = $(this).attr("data-referer"); >+ var op = $(this).attr("data-op"); >+ var invoice_link = "invoice.pl?op="+op; >+ $('.select-invoice:checked').each(function () { >+ var row = $(this).parents('tr'); >+ invoice_link = invoice_link + "&invoiceid="+$(row).attr('data-invoiceid'); >+ }); >+ window.location.href =invoice_link +"&"+referer; >+ }); >+ >+ $('.merge').click(function (ev) { > var booksellerid; > var mismatch; > var invoices = [ ]; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22773
:
93357
|
93375
|
93448
|
93660
|
94411
|
95290
|
96906
|
96907
|
96908
|
96909
|
96910
|
98729
|
98730
|
98731
|
98732
|
98733
|
106538
|
106539
|
106540
|
106541
|
106542
|
106543
|
106544
|
115420
|
115421
|
115422
|
115423
|
115424
|
115425
|
115426
|
116010
|
119282
|
119283
|
119284
|
119285
|
119286
|
119287
|
119288
|
119289
|
119290