|
Lines 276-282
$schema->storage->txn_rollback;
Link Here
|
| 276 |
|
276 |
|
| 277 |
subtest "NoIssuesChargeGuarantees tests" => sub { |
277 |
subtest "NoIssuesChargeGuarantees tests" => sub { |
| 278 |
|
278 |
|
| 279 |
plan tests => 4; |
279 |
plan tests => 5; |
| 280 |
|
280 |
|
| 281 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
281 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
| 282 |
|
282 |
|
|
Lines 286-292
subtest "NoIssuesChargeGuarantees tests" => sub {
Link Here
|
| 286 |
my $child = $builder->build_object({ class => 'Koha::Patrons' }); |
286 |
my $child = $builder->build_object({ class => 'Koha::Patrons' }); |
| 287 |
$child->add_guarantor({ guarantor_id => $patron->borrowernumber, relationship => 'parent' }); |
287 |
$child->add_guarantor({ guarantor_id => $patron->borrowernumber, relationship => 'parent' }); |
| 288 |
|
288 |
|
| 289 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantees', 1); |
289 |
t::lib::Mocks::mock_preference('noissuescharge', 50); |
|
|
290 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantees', 11.01); |
| 290 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantorsWithGuarantees', undef); |
291 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantorsWithGuarantees', undef); |
| 291 |
|
292 |
|
| 292 |
my $fee1 = $builder->build_object( |
293 |
my $fee1 = $builder->build_object( |
|
Lines 311-318
subtest "NoIssuesChargeGuarantees tests" => sub {
Link Here
|
| 311 |
|
312 |
|
| 312 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
313 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
| 313 |
|
314 |
|
| 314 |
is( $sip_patron->fines_amount, 11.11,"Guarantor fines correctly included"); |
315 |
is( $sip_patron->fines_amount, 11, "Only patron's fines are reported in total"); |
| 315 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
316 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
|
|
317 |
like( $sip_patron->screen_msg, qr/Patron blocked by fines \(11\.11\) on guaranteed accounts/,"Screen message includes related fines total"); |
| 316 |
|
318 |
|
| 317 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
319 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
| 318 |
|
320 |
|
|
Lines 324-330
subtest "NoIssuesChargeGuarantees tests" => sub {
Link Here
|
| 324 |
|
326 |
|
| 325 |
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { |
327 |
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { |
| 326 |
|
328 |
|
| 327 |
plan tests => 4; |
329 |
plan tests => 6; |
| 328 |
|
330 |
|
| 329 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
331 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); |
| 330 |
|
332 |
|
|
Lines 334-340
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
Link Here
|
| 334 |
my $child = $builder->build_object({ class => 'Koha::Patrons' }); |
336 |
my $child = $builder->build_object({ class => 'Koha::Patrons' }); |
| 335 |
$child->add_guarantor({ guarantor_id => $patron->borrowernumber, relationship => 'parent' }); |
337 |
$child->add_guarantor({ guarantor_id => $patron->borrowernumber, relationship => 'parent' }); |
| 336 |
|
338 |
|
| 337 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantorsWithGuarantees', 1); |
339 |
t::lib::Mocks::mock_preference('noissuescharge', 50); |
|
|
340 |
t::lib::Mocks::mock_preference('NoIssuesChargeGuarantorsWithGuarantees', 11.01); |
| 338 |
|
341 |
|
| 339 |
my $fee1 = $builder->build_object( |
342 |
my $fee1 = $builder->build_object( |
| 340 |
{ |
343 |
{ |
|
Lines 358-370
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
Link Here
|
| 358 |
|
361 |
|
| 359 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
362 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
| 360 |
|
363 |
|
| 361 |
is( $sip_patron->fines_amount, 11.11,"Guarantee fines correctly included"); |
364 |
is( $sip_patron->fines_amount, 11, "Guarantee fines correctly included"); |
| 362 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
365 |
ok( !$sip_patron->charge_ok, "Guarantor blocked"); |
|
|
366 |
like( $sip_patron->screen_msg, qr/Patron blocked by fines \(11\.11\) on related accounts/,"Screen message includes related fines total"); |
| 363 |
|
367 |
|
| 364 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
368 |
$sip_patron = C4::SIP::ILS::Patron->new( $child->cardnumber ); |
| 365 |
|
369 |
|
| 366 |
is( $sip_patron->fines_amount, 11.11,"Guarantor fines correctly included"); |
370 |
is( $sip_patron->fines_amount, 0.11, "Guarantor fines correctly included"); |
| 367 |
ok( !$sip_patron->charge_ok, "Guarantee blocked"); |
371 |
ok( !$sip_patron->charge_ok, "Guarantee blocked"); |
|
|
372 |
like( $sip_patron->screen_msg, qr/Patron blocked by fines \(11\.11\) on related accounts/,"Screen message includes related fines total"); |
| 368 |
|
373 |
|
| 369 |
$schema->storage->txn_rollback; |
374 |
$schema->storage->txn_rollback; |
| 370 |
}; |
375 |
}; |
| 371 |
- |
|
|