Lines 19-25
my ( $invoiceid_0_0, $invoiceid_1_1, $invoiceid_1_0, $invoiceid_0_1 );
Link Here
|
19 |
my $today; |
19 |
my $today; |
20 |
|
20 |
|
21 |
subtest 'Configuration 1: 0 0' => sub { |
21 |
subtest 'Configuration 1: 0 0' => sub { |
22 |
plan tests => 7; |
22 |
plan tests => 12; |
23 |
$bookseller_module->mock( |
23 |
$bookseller_module->mock( |
24 |
'fetch', |
24 |
'fetch', |
25 |
sub { |
25 |
sub { |
Lines 108-117
subtest 'Configuration 1: 0 0' => sub {
Link Here
|
108 |
field => 'totalgste' |
108 |
field => 'totalgste' |
109 |
} |
109 |
} |
110 |
); |
110 |
); |
|
|
111 |
|
112 |
$order_0_0 = C4::Acquisition::populate_order_with_prices( |
113 |
{ |
114 |
order => $order_0_0, |
115 |
booksellerid => 'just_something', |
116 |
receiving => 1, |
117 |
} |
118 |
); |
119 |
# Note that this configuration is *not* correct! |
120 |
# unitpricegsti should be 75.28 |
121 |
# totalgst should be 150.56 |
122 |
compare( |
123 |
{ |
124 |
got => $order_0_0->{unitpricegsti}, |
125 |
expected => 77.49, |
126 |
conf => '0 0', |
127 |
field => 'unitpricegsti' |
128 |
} |
129 |
); |
130 |
compare( |
131 |
{ |
132 |
got => $order_0_0->{unitpricegste}, |
133 |
expected => 73.80, |
134 |
conf => '0 0', |
135 |
field => 'unitpricegste' |
136 |
} |
137 |
); |
138 |
compare( |
139 |
{ |
140 |
got => $order_0_0->{gstvalue}, |
141 |
expected => 7.38, |
142 |
conf => '0 0', |
143 |
field => 'gstvalue' |
144 |
} |
145 |
); |
146 |
compare( |
147 |
{ |
148 |
got => $order_0_0->{totalgsti}, |
149 |
expected => 154.98, |
150 |
conf => '0 0', |
151 |
field => 'totalgsti' |
152 |
} |
153 |
); |
154 |
compare( |
155 |
{ |
156 |
got => $order_0_0->{totalgste}, |
157 |
expected => 147.60, |
158 |
conf => '0 0', |
159 |
field => 'totalgste' |
160 |
} |
161 |
); |
111 |
}; |
162 |
}; |
112 |
|
163 |
|
113 |
subtest 'Configuration 1: 1 1' => sub { |
164 |
subtest 'Configuration 1: 1 1' => sub { |
114 |
plan tests => 7; |
165 |
plan tests => 12; |
115 |
$bookseller_module->mock( |
166 |
$bookseller_module->mock( |
116 |
'fetch', |
167 |
'fetch', |
117 |
sub { |
168 |
sub { |
Lines 142-148
subtest 'Configuration 1: 1 1' => sub {
Link Here
|
142 |
ordering => 1, |
193 |
ordering => 1, |
143 |
} |
194 |
} |
144 |
); |
195 |
); |
145 |
|
|
|
146 |
# Note that this configuration is *not* correct |
196 |
# Note that this configuration is *not* correct |
147 |
# gstvalue should be 7.03 instead of 7.02 |
197 |
# gstvalue should be 7.03 instead of 7.02 |
148 |
compare( |
198 |
compare( |
Lines 201-210
subtest 'Configuration 1: 1 1' => sub {
Link Here
|
201 |
field => 'totalgste' |
251 |
field => 'totalgste' |
202 |
} |
252 |
} |
203 |
); |
253 |
); |
|
|
254 |
|
255 |
$order_1_1 = C4::Acquisition::populate_order_with_prices( |
256 |
{ |
257 |
order => $order_1_1, |
258 |
booksellerid => 'just_something', |
259 |
receiving => 1, |
260 |
} |
261 |
); |
262 |
# Note that this configuration is *not* correct! |
263 |
# gstvalue should be 7.03 |
264 |
compare( |
265 |
{ |
266 |
got => $order_1_1->{unitpricegsti}, |
267 |
expected => 73.80, |
268 |
conf => '1 1', |
269 |
field => 'unitpricegsti' |
270 |
} |
271 |
); |
272 |
compare( |
273 |
{ |
274 |
got => $order_1_1->{unitpricegste}, |
275 |
expected => 70.29, |
276 |
conf => '1 1', |
277 |
field => 'unitpricegste' |
278 |
} |
279 |
); |
280 |
compare( |
281 |
{ |
282 |
got => $order_1_1->{gstvalue}, |
283 |
expected => 7.02, |
284 |
conf => '1 1', |
285 |
field => 'gstvalue' |
286 |
} |
287 |
); |
288 |
compare( |
289 |
{ |
290 |
got => $order_1_1->{totalgsti}, |
291 |
expected => 147.60, |
292 |
conf => '1 1', |
293 |
field => 'totalgsti' |
294 |
} |
295 |
); |
296 |
compare( |
297 |
{ |
298 |
got => $order_1_1->{totalgste}, |
299 |
expected => 140.58, |
300 |
conf => '1 1', |
301 |
field => 'totalgste' |
302 |
} |
303 |
); |
204 |
}; |
304 |
}; |
205 |
|
305 |
|
206 |
subtest 'Configuration 1: 1 0' => sub { |
306 |
subtest 'Configuration 1: 1 0' => sub { |
207 |
plan tests => 7; |
307 |
plan tests => 12; |
208 |
$bookseller_module->mock( |
308 |
$bookseller_module->mock( |
209 |
'fetch', |
309 |
'fetch', |
210 |
sub { |
310 |
sub { |
Lines 235-245
subtest 'Configuration 1: 1 0' => sub {
Link Here
|
235 |
ordering => 1, |
335 |
ordering => 1, |
236 |
} |
336 |
} |
237 |
); |
337 |
); |
238 |
|
|
|
239 |
# Note that this configuration is *not* correct! |
338 |
# Note that this configuration is *not* correct! |
240 |
# rrp gsti should be 82 (what we inserted!) |
339 |
# rrp gsti should be 82 (what we inserted!) |
241 |
# gstvalue should be 7.03 instead of 7.02 |
340 |
# gstvalue should be 7.03 instead of 7.02 |
242 |
|
|
|
243 |
compare( |
341 |
compare( |
244 |
{ |
342 |
{ |
245 |
got => $order_1_0->{rrpgsti}, |
343 |
got => $order_1_0->{rrpgsti}, |
Lines 296-305
subtest 'Configuration 1: 1 0' => sub {
Link Here
|
296 |
field => 'totalgste' |
394 |
field => 'totalgste' |
297 |
} |
395 |
} |
298 |
); |
396 |
); |
|
|
397 |
|
398 |
$order_1_0 = C4::Acquisition::populate_order_with_prices( |
399 |
{ |
400 |
order => $order_1_0, |
401 |
booksellerid => 'just_something', |
402 |
receiving => 1, |
403 |
} |
404 |
); |
405 |
# Note that this configuration is *not* correct! |
406 |
# unitpricegsti should be 71.69 |
407 |
# totalgsti should be 143.38 |
408 |
# gstvalue should be 7.03 |
409 |
compare( |
410 |
{ |
411 |
got => $order_1_0->{unitpricegsti}, |
412 |
expected => 73.80, |
413 |
conf => '1 0', |
414 |
field => 'unitpricegsti' |
415 |
} |
416 |
); |
417 |
compare( |
418 |
{ |
419 |
got => $order_1_0->{unitpricegste}, |
420 |
expected => 70.29, |
421 |
conf => '1 0', |
422 |
field => 'unitpricegste' |
423 |
} |
424 |
); |
425 |
compare( |
426 |
{ |
427 |
got => $order_1_0->{gstvalue}, |
428 |
expected => 7.02, |
429 |
conf => '1 0', |
430 |
field => 'gstvalue' |
431 |
} |
432 |
); |
433 |
compare( |
434 |
{ |
435 |
got => $order_1_0->{totalgsti}, |
436 |
expected => 147.60, |
437 |
conf => '1 0', |
438 |
field => 'totalgsti' |
439 |
} |
440 |
); |
441 |
compare( |
442 |
{ |
443 |
got => $order_1_0->{totalgste}, |
444 |
expected => 140.58, |
445 |
conf => '1 0', |
446 |
field => 'totalgste' |
447 |
} |
448 |
); |
299 |
}; |
449 |
}; |
300 |
|
450 |
|
301 |
subtest 'Configuration 1: 0 1' => sub { |
451 |
subtest 'Configuration 1: 0 1' => sub { |
302 |
plan tests => 7; |
452 |
plan tests => 12; |
303 |
$bookseller_module->mock( |
453 |
$bookseller_module->mock( |
304 |
'fetch', |
454 |
'fetch', |
305 |
sub { |
455 |
sub { |
Lines 388-393
subtest 'Configuration 1: 0 1' => sub {
Link Here
|
388 |
field => 'totalgste' |
538 |
field => 'totalgste' |
389 |
} |
539 |
} |
390 |
); |
540 |
); |
|
|
541 |
|
542 |
$order_0_1 = C4::Acquisition::populate_order_with_prices( |
543 |
{ |
544 |
order => $order_0_1, |
545 |
booksellerid => 'just_something', |
546 |
receiving => 1, |
547 |
} |
548 |
); |
549 |
# Note that this configuration is correct |
550 |
compare( |
551 |
{ |
552 |
got => $order_0_1->{unitpricegsti}, |
553 |
expected => 77.49, |
554 |
conf => '0 1', |
555 |
field => 'unitpricegsti' |
556 |
} |
557 |
); |
558 |
compare( |
559 |
{ |
560 |
got => $order_0_1->{unitpricegste}, |
561 |
expected => 73.80, |
562 |
conf => '0 1', |
563 |
field => 'unitpricegste' |
564 |
} |
565 |
); |
566 |
compare( |
567 |
{ |
568 |
got => $order_0_1->{gstvalue}, |
569 |
expected => 7.38, |
570 |
conf => '0 1', |
571 |
field => 'gstvalue' |
572 |
} |
573 |
); |
574 |
compare( |
575 |
{ |
576 |
got => $order_0_1->{totalgsti}, |
577 |
expected => 154.98, |
578 |
conf => '0 1', |
579 |
field => 'totalgsti' |
580 |
} |
581 |
); |
582 |
compare( |
583 |
{ |
584 |
got => $order_0_1->{totalgste}, |
585 |
expected => 147.60, |
586 |
conf => '0 1', |
587 |
field => 'totalgste' |
588 |
} |
589 |
); |
391 |
}; |
590 |
}; |
392 |
|
591 |
|
393 |
sub compare { |
592 |
sub compare { |
394 |
- |
|
|