From 74640683f0d7f4b9734a69763424b33977f66cfd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 25 Nov 2014 12:23:45 +0100 Subject: [PATCH] Bug 13333: Fix Display basket group for already received orders Bug 11111 adds a basket group column on the parcel page. But it seems that the already received orders never contain the value (always 'no basket group'). Test plan: Receive an order which is in a basket group and verify the basket group column is correctly filled. Signed-off-by: Paola Rossi Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Acquisition.pm | 14 +++++++++----- t/db_dependent/Acquisition/Invoices.t | 9 +++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 1c9b3fe60f..d59ae56fc8 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2574,13 +2574,17 @@ sub GetInvoiceDetails { my $invoice = $sth->fetchrow_hashref; $query = q{ - SELECT aqorders.*, biblio.*, - biblio.copyrightdate, - biblioitems.publishercode, - biblioitems.publicationyear, - aqbasket.basketname + SELECT aqorders.*, + biblio.*, + biblio.copyrightdate, + biblioitems.publishercode, + biblioitems.publicationyear, + aqbasket.basketname, + aqbasketgroups.id AS basketgroupid, + aqbasketgroups.name AS basketgroupname FROM aqorders LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno + LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid = aqbasketgroups.id LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber LEFT JOIN biblioitems ON aqorders.biblionumber = biblioitems.biblionumber WHERE invoiceid = ? diff --git a/t/db_dependent/Acquisition/Invoices.t b/t/db_dependent/Acquisition/Invoices.t index a1ea6b5713..bac86e0931 100644 --- a/t/db_dependent/Acquisition/Invoices.t +++ b/t/db_dependent/Acquisition/Invoices.t @@ -1,7 +1,4 @@ #!/usr/bin/perl -# -# This Koha test module is a stub! -# Add more tests here!!! use Modern::Perl; @@ -11,7 +8,7 @@ use C4::Bookseller qw( AddBookseller ); use Koha::Acquisition::Order; use Koha::Acquisition::Bookseller; -use Test::More tests => 22; +use Test::More tests => 24; BEGIN { use_ok('C4::Acquisition'); @@ -134,6 +131,10 @@ my $invoice2 = GetInvoiceDetails($invoiceid2); is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order'); is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders'); +my $orders = $invoice1->{orders}; +ok( exists( @$orders[0]->{basketgroupid} ), "GetInvoiceDetails: The basketgroupid key exists" ); +ok( exists( @$orders[0]->{basketgroupname} ), "GetInvoiceDetails: The basketgroupname key exists" ); + my @invoices = GetInvoices(); cmp_ok(scalar @invoices, '>=', 2, 'GetInvoices returns at least two invoices'); -- 2.39.5