From cbb3fbf142a7f7f12c00056938a37283183d8ed5 Mon Sep 17 00:00:00 2001 From: Devinim 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 Signed-off-by: Kelly McElligott Signed-off-by: Katrin Fischer Bug 22773: The deprecated plugin is removed Signed-off-by: Kelly McElligott Signed-off-by: Christopher Kellermeyer Signed-off-by: Katrin Fischer Remove asset for removed js --- acqui/invoice.pl | 11 ++- acqui/invoices.pl | 11 +++ .../prog/en/modules/acqui/invoices.tt | 102 ++++++++++++++++----- 3 files changed, 96 insertions(+), 28 deletions(-) diff --git a/acqui/invoice.pl b/acqui/invoice.pl index 38577469c1..669dd26a96 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -71,7 +71,10 @@ if ( C4::Context->preference('AcqEnableFiles') ) { if ( $op && $op eq 'close' ) { output_and_exit( $input, $cookie, $template, 'insufficient_permission' ) unless $logged_in_patron->has_permission( { acquisition => 'edit_invoices' } ); - 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); @@ -81,8 +84,10 @@ if ( $op && $op eq 'close' ) { elsif ( $op && $op eq 'reopen' ) { output_and_exit( $input, $cookie, $template, 'insufficient_permission' ) unless $logged_in_patron->has_permission( { acquisition => 'reopen_closed_invoices' } ); - - 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 076e26733b..85e066094d 100755 --- a/acqui/invoices.pl +++ b/acqui/invoices.pl @@ -111,9 +111,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/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index 4536842f41..859a242039 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -25,11 +25,17 @@

Invoices

[% IF ( do_search ) %] [% IF invoices %] + [% BLOCK invoices_table %] + [% IF closed %] + [% SET tab = 'closed' %] + [% ELSE %] + [% SET tab = 'opened' %] + [% END %] - +
[% IF CAN_user_acquisition_merge_invoices %] @@ -108,23 +114,56 @@
[% IF CAN_user_acquisition_merge_invoices %] - Merge selected invoices -
-
-
-
    -
  1. Merge invoices

  2. -
  3. - - - -
    Invoice no.Shipment dateBilling dateShipment cost
  4. -
  5. - - Required -
  6. -
  7. -
  8. + Merge selected invoices + [% IF tab == 'closed' %] + Reopen Selected Invoices + [% ELSE %] + Close Selected Invoices + [% END %] + + [% END %] +
    + +
    + [% IF openedinvoices %] + [% INCLUDE invoices_table invoices = openedinvoices %] + [% ELSE %] +
    +

    Your search returned no open invoices.

    +
    + [% END %] +
    +
    + [% IF closedinvoices %] + [% INCLUDE invoices_table invoices = closedinvoices closed = 1 %] + [% ELSE %] +
    +

    Your search returned no closed invoices.

    +
    + [% END %] +
    +
    + + +
    + +
    +
      +
    1. Merge invoices

    2. +
    3. + + + +
      Invoice no.Shipment dateBilling dateShipment cost
    4. +
    5. + + Required +
    6. +
    7. +
    8. @@ -317,10 +356,11 @@ [% INCLUDE 'calendar.inc' %]