|
Lines 293-309
is( Check_Userid( C4::Context->config('user'), '' ), 0,
Link Here
|
| 293 |
|
293 |
|
| 294 |
subtest 'GetMemberAccountBalance' => sub { |
294 |
subtest 'GetMemberAccountBalance' => sub { |
| 295 |
|
295 |
|
| 296 |
plan tests => 6; |
296 |
plan tests => 10; |
| 297 |
|
297 |
|
| 298 |
my $members_mock = new Test::MockModule('C4::Members'); |
298 |
my $members_mock = new Test::MockModule('C4::Members'); |
| 299 |
$members_mock->mock( 'GetMemberAccountRecords', sub { |
299 |
$members_mock->mock( 'GetMemberAccountRecords', sub { |
| 300 |
my @accountlines = ( |
300 |
my ($borrowernumber) = @_; |
|
|
301 |
if ($borrowernumber) { |
| 302 |
my @accountlines = ( |
| 301 |
{ amountoutstanding => '7', accounttype => 'Rent' }, |
303 |
{ amountoutstanding => '7', accounttype => 'Rent' }, |
| 302 |
{ amountoutstanding => '5', accounttype => 'Res' }, |
304 |
{ amountoutstanding => '5', accounttype => 'Res' }, |
| 303 |
{ amountoutstanding => '3', accounttype => 'Pay' } ); |
305 |
{ amountoutstanding => '3', accounttype => 'Pay' } ); |
| 304 |
return ( 15, \@accountlines ); |
306 |
return ( 15, \@accountlines ); |
|
|
307 |
} |
| 308 |
else { |
| 309 |
my @accountlines; |
| 310 |
return ( 0, \@accountlines ); |
| 311 |
} |
| 305 |
}); |
312 |
}); |
| 306 |
|
313 |
|
|
|
314 |
my $person = GetMemberDetails(undef,undef); |
| 315 |
ok( !$person , 'Expected no member details from undef,undef' ); |
| 316 |
$person = GetMemberDetails(undef,'987654321'); |
| 317 |
is( $person->{amountoutstanding}, 15, |
| 318 |
'Expected 15 outstanding for cardnumber.'); |
| 319 |
$borrowernumber = $person->{borrowernumber}; |
| 320 |
$person = GetMemberDetails($borrowernumber,undef); |
| 321 |
is( $person->{amountoutstanding}, 15, |
| 322 |
'Expected 15 outstanding for borrowernumber.'); |
| 323 |
$person = GetMemberDetails($borrowernumber,'987654321'); |
| 324 |
is( $person->{amountoutstanding}, 15, |
| 325 |
'Expected 15 outstanding for both borrowernumber and cardnumber.'); |
| 326 |
|
| 307 |
# do not count holds charges |
327 |
# do not count holds charges |
| 308 |
C4::Context->set_preference( 'HoldsInNoissuesCharge', '1' ); |
328 |
C4::Context->set_preference( 'HoldsInNoissuesCharge', '1' ); |
| 309 |
C4::Context->set_preference( 'ManInvInNoissuesCharge', '0' ); |
329 |
C4::Context->set_preference( 'ManInvInNoissuesCharge', '0' ); |
| 310 |
- |
|
|