From d0e6a26558be8338af52a723a2664111abcbe861 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 22 Apr 2019 20:00:37 +0000 Subject: [PATCH] Bug 21364: (follow-up) Check for standing status and uncertain prices Fetch 'uncertainprices' when getting basket info. A side effect is that styling on baskets with uncertain prices is restored by this bug. They will appear in red To test: 1 - Add an order with an uncertainprice to the basket 2 - Return to vendor baskets view 3 - Note the actions now include "Uncertain prices" 4 - Click that, resolve the uncertain prcie 5 - Return to vendor basket view 6 - Note you can now close the basket, but don't 7 - Edit the basket, mark it as standing 8 - Return to vendor basket view 9 - Note you cannot close the basket Signed-off-by: Claire Gravely Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- C4/Acquisition.pm | 3 ++- .../prog/en/modules/acqui/booksellers.tt | 6 ++++-- .../Acquisition/GetBasketsInfosByBookseller.t | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 6a8df0280a..6f0f678aa9 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -684,7 +684,8 @@ sub GetBasketsInfosByBookseller { AND (aqorders.datecancellationprinted IS NULL OR aqorders.datecancellationprinted='0000-00-00') , aqorders.quantity , 0) - ) AS expected_items + ) AS expected_items, + SUM( aqorders.uncertainprice ) AS uncertainprices FROM aqbasket LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno WHERE booksellerid = ?}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt index a1969da27f..024c95ffe2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -150,8 +150,10 @@ View diff --git a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t index b932828186..267ff107c6 100644 --- a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t +++ b/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use Modern::Perl; -use Test::More tests => 40; +use Test::More tests => 43; use Data::Dumper; use C4::Acquisition qw( NewBasket GetBasketsInfosByBookseller ); @@ -72,6 +72,20 @@ is( $basket->{total_items_cancelled}, 0, 'Start with 0 item cancelled' ); is( $basket->{expected_items}, 6, 'Start with 6 items expected' ); is( $basket->{total_biblios_cancelled}, 0, 'Start with 0 biblio cancelled' ); +$order1->uncertainprice(1)->store; +$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); +$basket = $baskets->[0]; +is( $basket->{uncertainprices}, 1, "Uncertain prcies returns number of uncertain items"); +$order2->uncertainprice(1)->store; +$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); +$basket = $baskets->[0]; +is( $basket->{uncertainprices}, 2, "Uncertain prcies returns number of uncertain items"); +$order1->uncertainprice(0)->store; +$order2->uncertainprice(0)->store; +$baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); +$basket = $baskets->[0]; +is( $basket->{uncertainprices}, 0, "Uncertain prcies returns number of uncertain items"); + C4::Acquisition::DelOrder( $biblionumber2, $ordernumber2 ); $baskets = C4::Acquisition::GetBasketsInfosByBookseller( $supplierid ); is( scalar(@$baskets), 1, 'Order2 deleted, still 1 basket' ); -- 2.39.5