From 544a70c91af4d401cd26143f659eaedfcc5c4938 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Fri, 20 Oct 2023 10:10:52 +0200 Subject: [PATCH] Bug 35114: Adjust logic around basket total calculation Like in total basket.pl calculation we took the unitprice first than the ecost to get the same total value between basketgroup and basket details Test plan : 1) Be sure to have basketgroup with any vendor (which must have a discount rate to see ecost calculation) 2) Go to basket details and basketgroup overview to see the difference 3) Apply this basket and refresh pages to see now the same result --- acqui/basketgroup.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 38f7b6b44c..413baf772b 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -77,9 +77,14 @@ sub BasketTotal { for my $order (@orders){ # FIXME The following is wrong if ( $bookseller->listincgst ) { - $total = $total + ( get_rounded_price($order->{ecost_tax_included}) * $order->{quantity} ); - } else { - $total = $total + ( get_rounded_price($order->{ecost_tax_excluded}) * $order->{quantity} ); + my $total_unitprice_tax_inc_rounded = get_rounded_price( $order->{unitprice_tax_included} ) * $order->{quantity}; + my $total_ecost_tax_inc_rounded = get_rounded_price( $order->{ecost_tax_included} ) * $order->{quantity}; + $total += $total_unitprice_tax_inc_rounded || $total_ecost_tax_inc_rounded; + } + else { + my $total_unitprice_tax_exc_rounded = get_rounded_price( $order->{unitprice_tax_excluded} ) * $order->{quantity}; + my $total_ecost_tax_exc_rounded = get_rounded_price( $order->{ecost_tax_excluded} ) * $order->{quantity}; + $total += $total_unitprice_tax_exc_rounded || $total_ecost_tax_exc_rounded; } } return $total; -- 2.30.2