From 16ecf1c33beb25ec9e058b62834900d2c17c9e36 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Wed, 20 Nov 2024 09:41:22 -0500 Subject: [PATCH] Bug 38343: (QA follow-up) Improve tests and tidy --- acqui/parcels.pl | 4 ++-- t/db_dependent/Acquisition/Invoices.t | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/acqui/parcels.pl b/acqui/parcels.pl index 4b36a0a7d0..23baa663f3 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -151,8 +151,8 @@ $template->param( ); my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); -my @parcels = GetInvoices( - supplierid => $booksellerid, +my @parcels = GetInvoices( + supplierid => $booksellerid, invoicenumber => $code, ( $datefrom ? ( shipmentdatefrom => $datefrom ) : () ), ( $dateto ? ( shipmentdateto => $dateto ) : () ), diff --git a/t/db_dependent/Acquisition/Invoices.t b/t/db_dependent/Acquisition/Invoices.t index aa27e3d5df..337bd94883 100755 --- a/t/db_dependent/Acquisition/Invoices.t +++ b/t/db_dependent/Acquisition/Invoices.t @@ -8,7 +8,7 @@ use Koha::Acquisition::Booksellers; use Koha::Acquisition::Orders; use Koha::Database; -use Test::More tests => 27; +use Test::More tests => 29; BEGIN { use_ok('C4::Acquisition', qw( NewBasket GetBasket AddInvoice GetInvoice ModReceiveOrder GetInvoiceDetails GetInvoices ModInvoice CloseInvoice ReopenInvoice MergeInvoices DelInvoice )); @@ -107,7 +107,6 @@ my $invoiceid_closed = AddInvoice( closedate => '2024-12-13', ); - my $invoice1 = GetInvoice( $invoiceid1 ); my $invoice2 = GetInvoice( $invoiceid2 ); @@ -170,10 +169,14 @@ is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by ISBN w @invoices = GetInvoices(isbneanissn => '123456789'); is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by partial ISBN works (bug 8854)'); -@invoices = GetInvoices(booksellerid => $booksellerid, closedate => undef); -is(scalar @invoices, 2, ); -is($invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices()'); -is($invoices[1]->{invoicenumber}, 'invoice2', 'GetInvoices()'); +@invoices = GetInvoices( booksellerid => $booksellerid, closedate => undef ); +is( scalar @invoices, 2, 'GetInvoices() to search by only open invoices' ); +is( $invoices[0]->{invoicenumber}, 'invoice1', 'GetInvoices() to search by only open invoices' ); +is( $invoices[1]->{invoicenumber}, 'invoice2', 'GetInvoices() to search by only open invoices' ); + +@invoices = GetInvoices( booksellerid => $booksellerid, closedate => '2024-12-13' ); +is( scalar @invoices, 1, 'GetInvoices() to filter by closedate' ); +is( $invoices[0]->{invoicenumber}, 'invoice_close', 'GetInvoices() to filter by closedate' ); my $invoicesummary1 = GetInvoice($invoiceid1); is($invoicesummary1->{'invoicenumber'}, 'invoice1', 'GetInvoice retrieves correct invoice'); -- 2.34.1