From 7af340ceaeb6b2e898817bb3a546b5044813ab3d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 5 Nov 2012 10:35:08 +0100 Subject: [PATCH] Bug 7288: Allow to display only subscriptions in the invoices table This patch adds a checkbox "Show only subscriptions" in the invoices table. If this checkbox is checked, a filter is added on the table in order to show only subscription invoices --- C4/Acquisition.pm | 1 + .../prog/en/modules/acqui/invoices.tt | 22 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index b6fab5d..aa6e93b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2303,6 +2303,7 @@ sub GetInvoices { my $dbh = C4::Context->dbh; my $query = qq{ SELECT aqinvoices.*, aqbooksellers.name AS suppliername, + aqorders.subscriptionid, COUNT( DISTINCT IF( aqorders.datereceived IS NOT NULL, 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 52d2ecc..9261711 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -14,15 +14,25 @@ $(document).ready(function() { [% IF (dateformat == 'metric') %] dt_add_type_uk_date(); [% END %] - $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, { + var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, { bInfo: false, bPaginate: false, - bFilter: false, sDom: "t", aoColumnDefs: [ - { "bSortable": false, "aTargets": [6] } + { "aTargets": [-1], "bSortable": false, "bSearchable": false }, + { "aTargets": [0], "bSortable": false, "bSearchable": false, "bVisible": false }, ] })); + + $("#show_only_subscription").attr("checked", false); + + $("#show_only_subscription").click(function(){ + if ( $(this).attr("checked") ) { + resultst.fnFilter( "[0-9]+", 0, true ); + } else { + resultst.fnFilter( '', 0 ); + } + }); }); //]]> @@ -42,9 +52,14 @@ $(document).ready(function() {

Invoices

[% IF ( do_search ) %] [% IF invoices %] + + @@ -57,6 +72,7 @@ $(document).ready(function() { [% FOREACH invoice IN invoices %] +
Subscriptionid Invoice no. Vendor Billing date
[% invoice.subscriptionid %] [% invoice.invoicenumber %] [% invoice.suppliername %] -- 1.7.10.4