Lines 253-266
for my $currency_format ( qw( US FR ) ) {
Link Here
|
253 |
}; |
253 |
}; |
254 |
|
254 |
|
255 |
subtest 'Configuration 1: 1 0' => sub { |
255 |
subtest 'Configuration 1: 1 0' => sub { |
256 |
plan tests => 8; |
256 |
plan tests => 9; |
257 |
|
257 |
|
258 |
my $biblionumber_1_0 = 44; |
258 |
my $biblionumber_1_0 = 44; |
259 |
my $order_1_0 = { |
259 |
my $order_1_0 = { |
260 |
biblionumber => $biblionumber_1_0, |
260 |
biblionumber => $biblionumber_1_0, |
261 |
quantity => 2, |
261 |
quantity => 2, |
262 |
listprice => 82.000000, |
262 |
listprice => 82.000000, |
263 |
unitprice => 70.290000, |
263 |
unitprice => 0, |
264 |
quantityreceived => 2, |
264 |
quantityreceived => 2, |
265 |
basketno => $basketno_1_1, |
265 |
basketno => $basketno_1_1, |
266 |
invoiceid => $invoiceid_1_1, |
266 |
invoiceid => $invoiceid_1_1, |
Lines 311-316
for my $currency_format ( qw( US FR ) ) {
Link Here
|
311 |
field => 'ecost_tax_excluded' |
311 |
field => 'ecost_tax_excluded' |
312 |
} |
312 |
} |
313 |
); |
313 |
); |
|
|
314 |
# If we order with unitprice = 0, tax is calculated from the ecost |
315 |
# (note that in addorder.pl and addorderiso2709 the unitprice may/will be set to the ecost |
314 |
compare( |
316 |
compare( |
315 |
{ |
317 |
{ |
316 |
got => $order_1_0->{tax_value_on_ordering}, |
318 |
got => $order_1_0->{tax_value_on_ordering}, |
Lines 319-324
for my $currency_format ( qw( US FR ) ) {
Link Here
|
319 |
field => 'tax_value' |
321 |
field => 'tax_value' |
320 |
} |
322 |
} |
321 |
); |
323 |
); |
|
|
324 |
$order_1_0->{unitprice} = 70.29; |
325 |
$order_1_0 = C4::Acquisition::populate_order_with_prices( |
326 |
{ |
327 |
order => $order_1_0, |
328 |
booksellerid => 3, |
329 |
ordering => 1, |
330 |
} |
331 |
); |
332 |
# If a unitprice is provided at ordering, we calculate the tax from that |
333 |
compare( |
334 |
{ |
335 |
got => $order_1_0->{tax_value_on_ordering}, |
336 |
expected => 6.69, |
337 |
conf => '1 0', |
338 |
field => 'tax_value' |
339 |
} |
340 |
); |
322 |
|
341 |
|
323 |
$order_1_0 = C4::Acquisition::populate_order_with_prices( |
342 |
$order_1_0 = C4::Acquisition::populate_order_with_prices( |
324 |
{ |
343 |
{ |
Lines 355-368
for my $currency_format ( qw( US FR ) ) {
Link Here
|
355 |
}; |
374 |
}; |
356 |
|
375 |
|
357 |
subtest 'Configuration 1: 0 1' => sub { |
376 |
subtest 'Configuration 1: 0 1' => sub { |
358 |
plan tests => 8; |
377 |
plan tests => 9; |
359 |
|
378 |
|
360 |
my $biblionumber_0_1 = 45; |
379 |
my $biblionumber_0_1 = 45; |
361 |
my $order_0_1 = { |
380 |
my $order_0_1 = { |
362 |
biblionumber => $biblionumber_0_1, |
381 |
biblionumber => $biblionumber_0_1, |
363 |
quantity => 2, |
382 |
quantity => 2, |
364 |
listprice => 82.000000, |
383 |
listprice => 82.000000, |
365 |
unitprice => 77.490000, |
384 |
unitprice => 0, |
366 |
quantityreceived => 2, |
385 |
quantityreceived => 2, |
367 |
basketno => $basketno_1_1, |
386 |
basketno => $basketno_1_1, |
368 |
invoiceid => $invoiceid_1_1, |
387 |
invoiceid => $invoiceid_1_1, |
Lines 413-418
for my $currency_format ( qw( US FR ) ) {
Link Here
|
413 |
field => 'ecost_tax_excluded' |
432 |
field => 'ecost_tax_excluded' |
414 |
} |
433 |
} |
415 |
); |
434 |
); |
|
|
435 |
# If we order with unitprice = 0, tax is calculated from the ecost |
436 |
# (note that in addorder.pl and addorderiso2709 the unitprice may/will be set to the ecost |
416 |
compare( |
437 |
compare( |
417 |
{ |
438 |
{ |
418 |
got => $order_0_1->{tax_value_on_ordering}, |
439 |
got => $order_0_1->{tax_value_on_ordering}, |
Lines 421-427
for my $currency_format ( qw( US FR ) ) {
Link Here
|
421 |
field => 'tax_value' |
442 |
field => 'tax_value' |
422 |
} |
443 |
} |
423 |
); |
444 |
); |
424 |
|
445 |
$order_0_1->{unitprice} = 77.490000; |
|
|
446 |
$order_0_1 = C4::Acquisition::populate_order_with_prices( |
447 |
{ |
448 |
order => $order_0_1, |
449 |
booksellerid => 2, |
450 |
ordering => 1, |
451 |
} |
452 |
); |
453 |
# If a unitprice is provided at ordering, we calculate the tax from that |
454 |
compare( |
455 |
{ |
456 |
got => $order_0_1->{tax_value_on_ordering}, |
457 |
expected => 7.75, |
458 |
conf => '0 1', |
459 |
field => 'tax_value' |
460 |
} |
461 |
); |
425 |
$order_0_1 = C4::Acquisition::populate_order_with_prices( |
462 |
$order_0_1 = C4::Acquisition::populate_order_with_prices( |
426 |
{ |
463 |
{ |
427 |
order => $order_0_1, |
464 |
order => $order_0_1, |
428 |
- |
|
|