Bugzilla – Attachment 95082 Details for
Bug 23523
Unitprice tax column values are not populated if entered upon ordering
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23523: (RM follow-up) Failing tests
Bug-23523-RM-follow-up-Failing-tests.patch (text/plain), 7.38 KB, created by
Martin Renvoize (ashimema)
on 2019-11-06 08:55:23 UTC
(
hide
)
Description:
Bug 23523: (RM follow-up) Failing tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-11-06 08:55:23 UTC
Size:
7.38 KB
patch
obsolete
>From 9eee0bc97c0a34fb45ac0e58563505f6f85014b2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 6 Nov 2019 08:53:26 +0000 >Subject: [PATCH] Bug 23523: (RM follow-up) Failing tests > >--- > C4/Acquisition.pm | 18 ++++++++++---- > t/Prices.t | 61 ++++++++++++++++++++++++++++++++++++++++++----- > 2 files changed, 68 insertions(+), 11 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index a3408883f1..1613e541b7 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -3070,7 +3070,11 @@ sub populate_order_with_prices { > $order->{rrp_tax_included} = $order->{rrp}; > > # price tax excluded = price tax included / ( 1 + tax rate ) >- $order->{unitprice_tax_excluded} = $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate_on_ordering} ); >+ $order->{unitprice_tax_excluded} = >+ defined( $order->{unitprice_tax_included} ) >+ ? $order->{unitprice_tax_included} / >+ ( 1 + $order->{tax_rate_on_ordering} ) >+ : undef; > $order->{rrp_tax_excluded} = $order->{rrp_tax_included} / ( 1 + $order->{tax_rate_on_ordering} ); > > # ecost tax included = rrp tax included ( 1 - discount ) >@@ -3081,8 +3085,8 @@ sub populate_order_with_prices { > > # tax value = quantity * ecost tax excluded * tax rate > # we should use the unitprice if included >- my $cost_tax_included = $order->{unitprice_tax_included} || $order->{ecost_tax_included}; >- my $cost_tax_excluded = $order->{unitprice_tax_excluded} || $order->{ecost_tax_excluded}; >+ my $cost_tax_included = $order->{unitprice_tax_included} // $order->{ecost_tax_included}; >+ my $cost_tax_excluded = $order->{unitprice_tax_excluded} // $order->{ecost_tax_excluded}; > $order->{tax_value_on_ordering} = ( get_rounded_price($cost_tax_included) - get_rounded_price($cost_tax_excluded) ) * $order->{quantity}; > > } >@@ -3092,7 +3096,11 @@ sub populate_order_with_prices { > $order->{rrp_tax_excluded} = $order->{rrp}; > > # price tax included = price tax excluded * ( 1 - tax rate ) >- $order->{unitprice_tax_included} = $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate_on_ordering} ); >+ $order->{unitprice_tax_included} = >+ defined( $order->{unitprice_tax_excluded} ) >+ ? $order->{unitprice_tax_excluded} * >+ ( 1 + $order->{tax_rate_on_ordering} ) >+ : undef; > $order->{rrp_tax_included} = $order->{rrp_tax_excluded} * ( 1 + $order->{tax_rate_on_ordering} ); > > # ecost tax excluded = rrp tax excluded * ( 1 - discount ) >@@ -3103,7 +3111,7 @@ sub populate_order_with_prices { > > # tax value = quantity * ecost tax included * tax rate > # we should use the unitprice if included >- my $cost_tax_excluded = $order->{unitprice_tax_excluded} || $order->{ecost_tax_excluded}; >+ my $cost_tax_excluded = $order->{unitprice_tax_excluded} // $order->{ecost_tax_excluded}; > $order->{tax_value_on_ordering} = $order->{quantity} * get_rounded_price($cost_tax_excluded) * $order->{tax_rate_on_ordering}; > } > } >diff --git a/t/Prices.t b/t/Prices.t >index 4039233f5d..e7c8d19d8b 100644 >--- a/t/Prices.t >+++ b/t/Prices.t >@@ -67,6 +67,7 @@ for my $currency_format ( qw( US FR ) ) { > discount => 10.0000, > datereceived => $today > }; >+ > $order_0_0 = C4::Acquisition::populate_order_with_prices( > { > order => $order_0_0, >@@ -151,14 +152,13 @@ for my $currency_format ( qw( US FR ) ) { > }; > > subtest 'Configuration 1: 1 1' => sub { >- plan tests => 8; >+ plan tests => 9; > > my $biblionumber_1_1 = 43; > my $order_1_1 = { > biblionumber => $biblionumber_1_1, > quantity => 2, > listprice => 82.000000, >- unitprice => 73.800000, > quantityreceived => 2, > basketno => $basketno_1_1, > invoiceid => $invoiceid_1_1, >@@ -218,6 +218,23 @@ for my $currency_format ( qw( US FR ) ) { > } > ); > >+ $order_1_1->{unitprice} = 73.800000; >+ $order_1_1 = C4::Acquisition::populate_order_with_prices( >+ { >+ order => $order_1_1, >+ booksellerid => 4, >+ ordering => 1, >+ } >+ ); >+ compare( >+ { >+ got => $order_1_1->{tax_value_on_ordering}, >+ expected => 7.03, >+ conf => '1 1', >+ field => 'tax_value' >+ } >+ ); >+ > $order_1_1 = C4::Acquisition::populate_order_with_prices( > { > order => $order_1_1, >@@ -253,14 +270,13 @@ for my $currency_format ( qw( US FR ) ) { > }; > > subtest 'Configuration 1: 1 0' => sub { >- plan tests => 8; >+ plan tests => 9; > > my $biblionumber_1_0 = 44; > my $order_1_0 = { > biblionumber => $biblionumber_1_0, > quantity => 2, > listprice => 82.000000, >- unitprice => 70.290000, > quantityreceived => 2, > basketno => $basketno_1_1, > invoiceid => $invoiceid_1_1, >@@ -320,6 +336,23 @@ for my $currency_format ( qw( US FR ) ) { > } > ); > >+ $order_1_0->{unitprice} = 70.290000; >+ $order_1_0 = C4::Acquisition::populate_order_with_prices( >+ { >+ order => $order_1_0, >+ booksellerid => 4, >+ ordering => 1, >+ } >+ ); >+ compare( >+ { >+ got => $order_1_0->{tax_value_on_ordering}, >+ expected => 6.69, >+ conf => '1 0 unitprice', >+ field => 'tax_value' >+ } >+ ); >+ > $order_1_0 = C4::Acquisition::populate_order_with_prices( > { > order => $order_1_0, >@@ -355,14 +388,13 @@ for my $currency_format ( qw( US FR ) ) { > }; > > subtest 'Configuration 1: 0 1' => sub { >- plan tests => 8; >+ plan tests => 9; > > my $biblionumber_0_1 = 45; > my $order_0_1 = { > biblionumber => $biblionumber_0_1, > quantity => 2, > listprice => 82.000000, >- unitprice => 77.490000, > quantityreceived => 2, > basketno => $basketno_1_1, > invoiceid => $invoiceid_1_1, >@@ -422,6 +454,23 @@ for my $currency_format ( qw( US FR ) ) { > } > ); > >+ $order_0_1->{unitprice} = 77.490000; >+ $order_0_1 = C4::Acquisition::populate_order_with_prices( >+ { >+ order => $order_0_1, >+ booksellerid => 4, >+ ordering => 1, >+ } >+ ); >+ compare( >+ { >+ got => $order_0_1->{tax_value_on_ordering}, >+ expected => 7.38, >+ conf => '0 1 unitprice', >+ field => 'tax_value' >+ } >+ ); >+ > $order_0_1 = C4::Acquisition::populate_order_with_prices( > { > order => $order_0_1, >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23523
:
92500
|
93950
|
95034
|
95035
|
95082
|
95102
|
95103