|
Lines 21-27
my $today;
Link Here
|
| 21 |
for my $currency_format ( qw( US FR ) ) { |
21 |
for my $currency_format ( qw( US FR ) ) { |
| 22 |
t::lib::Mocks::mock_preference( 'CurrencyFormat', $currency_format ); |
22 |
t::lib::Mocks::mock_preference( 'CurrencyFormat', $currency_format ); |
| 23 |
subtest 'Configuration 1: 0 0' => sub { |
23 |
subtest 'Configuration 1: 0 0' => sub { |
| 24 |
plan tests => 7; |
24 |
plan tests => 12; |
| 25 |
$bookseller_module->mock( |
25 |
$bookseller_module->mock( |
| 26 |
'fetch', |
26 |
'fetch', |
| 27 |
sub { |
27 |
sub { |
|
Lines 110-119
for my $currency_format ( qw( US FR ) ) {
Link Here
|
| 110 |
field => 'totalgste' |
110 |
field => 'totalgste' |
| 111 |
} |
111 |
} |
| 112 |
); |
112 |
); |
|
|
113 |
|
| 114 |
$order_0_0 = C4::Acquisition::populate_order_with_prices( |
| 115 |
{ |
| 116 |
order => $order_0_0, |
| 117 |
booksellerid => 'just_something', |
| 118 |
receiving => 1, |
| 119 |
} |
| 120 |
); |
| 121 |
# Note that this configuration is *not* correct! |
| 122 |
# unitpricegsti should be 75.28 |
| 123 |
# totalgst should be 150.56 |
| 124 |
compare( |
| 125 |
{ |
| 126 |
got => $order_0_0->{unitpricegsti}, |
| 127 |
expected => 77.49, |
| 128 |
conf => '0 0', |
| 129 |
field => 'unitpricegsti' |
| 130 |
} |
| 131 |
); |
| 132 |
compare( |
| 133 |
{ |
| 134 |
got => $order_0_0->{unitpricegste}, |
| 135 |
expected => 73.80, |
| 136 |
conf => '0 0', |
| 137 |
field => 'unitpricegste' |
| 138 |
} |
| 139 |
); |
| 140 |
compare( |
| 141 |
{ |
| 142 |
got => $order_0_0->{gstvalue}, |
| 143 |
expected => 7.38, |
| 144 |
conf => '0 0', |
| 145 |
field => 'gstvalue' |
| 146 |
} |
| 147 |
); |
| 148 |
compare( |
| 149 |
{ |
| 150 |
got => $order_0_0->{totalgsti}, |
| 151 |
expected => 154.98, |
| 152 |
conf => '0 0', |
| 153 |
field => 'totalgsti' |
| 154 |
} |
| 155 |
); |
| 156 |
compare( |
| 157 |
{ |
| 158 |
got => $order_0_0->{totalgste}, |
| 159 |
expected => 147.60, |
| 160 |
conf => '0 0', |
| 161 |
field => 'totalgste' |
| 162 |
} |
| 163 |
); |
| 113 |
}; |
164 |
}; |
| 114 |
|
165 |
|
| 115 |
subtest 'Configuration 1: 1 1' => sub { |
166 |
subtest 'Configuration 1: 1 1' => sub { |
| 116 |
plan tests => 7; |
167 |
plan tests => 12; |
| 117 |
$bookseller_module->mock( |
168 |
$bookseller_module->mock( |
| 118 |
'fetch', |
169 |
'fetch', |
| 119 |
sub { |
170 |
sub { |
|
Lines 203-212
for my $currency_format ( qw( US FR ) ) {
Link Here
|
| 203 |
field => 'totalgste' |
254 |
field => 'totalgste' |
| 204 |
} |
255 |
} |
| 205 |
); |
256 |
); |
|
|
257 |
|
| 258 |
$order_1_1 = C4::Acquisition::populate_order_with_prices( |
| 259 |
{ |
| 260 |
order => $order_1_1, |
| 261 |
booksellerid => 'just_something', |
| 262 |
receiving => 1, |
| 263 |
} |
| 264 |
); |
| 265 |
# Note that this configuration is *not* correct! |
| 266 |
# gstvalue should be 7.03 |
| 267 |
compare( |
| 268 |
{ |
| 269 |
got => $order_1_1->{unitpricegsti}, |
| 270 |
expected => 73.80, |
| 271 |
conf => '1 1', |
| 272 |
field => 'unitpricegsti' |
| 273 |
} |
| 274 |
); |
| 275 |
compare( |
| 276 |
{ |
| 277 |
got => $order_1_1->{unitpricegste}, |
| 278 |
expected => 70.29, |
| 279 |
conf => '1 1', |
| 280 |
field => 'unitpricegste' |
| 281 |
} |
| 282 |
); |
| 283 |
compare( |
| 284 |
{ |
| 285 |
got => $order_1_1->{gstvalue}, |
| 286 |
expected => 7.02, |
| 287 |
conf => '1 1', |
| 288 |
field => 'gstvalue' |
| 289 |
} |
| 290 |
); |
| 291 |
compare( |
| 292 |
{ |
| 293 |
got => $order_1_1->{totalgsti}, |
| 294 |
expected => 147.60, |
| 295 |
conf => '1 1', |
| 296 |
field => 'totalgsti' |
| 297 |
} |
| 298 |
); |
| 299 |
compare( |
| 300 |
{ |
| 301 |
got => $order_1_1->{totalgste}, |
| 302 |
expected => 140.58, |
| 303 |
conf => '1 1', |
| 304 |
field => 'totalgste' |
| 305 |
} |
| 306 |
); |
| 206 |
}; |
307 |
}; |
| 207 |
|
308 |
|
| 208 |
subtest 'Configuration 1: 1 0' => sub { |
309 |
subtest 'Configuration 1: 1 0' => sub { |
| 209 |
plan tests => 7; |
310 |
plan tests => 12; |
| 210 |
$bookseller_module->mock( |
311 |
$bookseller_module->mock( |
| 211 |
'fetch', |
312 |
'fetch', |
| 212 |
sub { |
313 |
sub { |
|
Lines 298-307
for my $currency_format ( qw( US FR ) ) {
Link Here
|
| 298 |
field => 'totalgste' |
399 |
field => 'totalgste' |
| 299 |
} |
400 |
} |
| 300 |
); |
401 |
); |
|
|
402 |
|
| 403 |
$order_1_0 = C4::Acquisition::populate_order_with_prices( |
| 404 |
{ |
| 405 |
order => $order_1_0, |
| 406 |
booksellerid => 'just_something', |
| 407 |
receiving => 1, |
| 408 |
} |
| 409 |
); |
| 410 |
# Note that this configuration is *not* correct! |
| 411 |
# unitpricegsti should be 71.69 |
| 412 |
# totalgsti should be 143.38 |
| 413 |
# gstvalue should be 7.03 |
| 414 |
compare( |
| 415 |
{ |
| 416 |
got => $order_1_0->{unitpricegsti}, |
| 417 |
expected => 73.80, |
| 418 |
conf => '1 0', |
| 419 |
field => 'unitpricegsti' |
| 420 |
} |
| 421 |
); |
| 422 |
compare( |
| 423 |
{ |
| 424 |
got => $order_1_0->{unitpricegste}, |
| 425 |
expected => 70.29, |
| 426 |
conf => '1 0', |
| 427 |
field => 'unitpricegste' |
| 428 |
} |
| 429 |
); |
| 430 |
compare( |
| 431 |
{ |
| 432 |
got => $order_1_0->{gstvalue}, |
| 433 |
expected => 7.02, |
| 434 |
conf => '1 0', |
| 435 |
field => 'gstvalue' |
| 436 |
} |
| 437 |
); |
| 438 |
compare( |
| 439 |
{ |
| 440 |
got => $order_1_0->{totalgsti}, |
| 441 |
expected => 147.60, |
| 442 |
conf => '1 0', |
| 443 |
field => 'totalgsti' |
| 444 |
} |
| 445 |
); |
| 446 |
compare( |
| 447 |
{ |
| 448 |
got => $order_1_0->{totalgste}, |
| 449 |
expected => 140.58, |
| 450 |
conf => '1 0', |
| 451 |
field => 'totalgste' |
| 452 |
} |
| 453 |
); |
| 301 |
}; |
454 |
}; |
| 302 |
|
455 |
|
| 303 |
subtest 'Configuration 1: 0 1' => sub { |
456 |
subtest 'Configuration 1: 0 1' => sub { |
| 304 |
plan tests => 7; |
457 |
plan tests => 12; |
| 305 |
$bookseller_module->mock( |
458 |
$bookseller_module->mock( |
| 306 |
'fetch', |
459 |
'fetch', |
| 307 |
sub { |
460 |
sub { |
|
Lines 390-395
for my $currency_format ( qw( US FR ) ) {
Link Here
|
| 390 |
field => 'totalgste' |
543 |
field => 'totalgste' |
| 391 |
} |
544 |
} |
| 392 |
); |
545 |
); |
|
|
546 |
|
| 547 |
$order_0_1 = C4::Acquisition::populate_order_with_prices( |
| 548 |
{ |
| 549 |
order => $order_0_1, |
| 550 |
booksellerid => 'just_something', |
| 551 |
receiving => 1, |
| 552 |
} |
| 553 |
); |
| 554 |
# Note that this configuration is correct |
| 555 |
compare( |
| 556 |
{ |
| 557 |
got => $order_0_1->{unitpricegsti}, |
| 558 |
expected => 77.49, |
| 559 |
conf => '0 1', |
| 560 |
field => 'unitpricegsti' |
| 561 |
} |
| 562 |
); |
| 563 |
compare( |
| 564 |
{ |
| 565 |
got => $order_0_1->{unitpricegste}, |
| 566 |
expected => 73.80, |
| 567 |
conf => '0 1', |
| 568 |
field => 'unitpricegste' |
| 569 |
} |
| 570 |
); |
| 571 |
compare( |
| 572 |
{ |
| 573 |
got => $order_0_1->{gstvalue}, |
| 574 |
expected => 7.38, |
| 575 |
conf => '0 1', |
| 576 |
field => 'gstvalue' |
| 577 |
} |
| 578 |
); |
| 579 |
compare( |
| 580 |
{ |
| 581 |
got => $order_0_1->{totalgsti}, |
| 582 |
expected => 154.98, |
| 583 |
conf => '0 1', |
| 584 |
field => 'totalgsti' |
| 585 |
} |
| 586 |
); |
| 587 |
compare( |
| 588 |
{ |
| 589 |
got => $order_0_1->{totalgste}, |
| 590 |
expected => 147.60, |
| 591 |
conf => '0 1', |
| 592 |
field => 'totalgste' |
| 593 |
} |
| 594 |
); |
| 393 |
}; |
595 |
}; |
| 394 |
} |
596 |
} |
| 395 |
|
597 |
|
| 396 |
- |
|
|