Lines 246-258
subtest "Test patron_status_string" => sub {
Link Here
|
246 |
|
246 |
|
247 |
my $builder = t::lib::TestBuilder->new(); |
247 |
my $builder = t::lib::TestBuilder->new(); |
248 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
248 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
249 |
my $patron = $builder->build({ |
249 |
my $patron = $builder->build_object({ |
250 |
source => 'Borrower', |
250 |
class => 'Koha::Patrons', |
251 |
value => { |
251 |
value => { |
252 |
branchcode => $branchcode, |
252 |
branchcode => $branchcode, |
253 |
}, |
253 |
}, |
254 |
}); |
254 |
}); |
255 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->{cardnumber} ); |
255 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
256 |
|
256 |
|
257 |
t::lib::Mocks::mock_userenv({ branchcode => $branchcode }); |
257 |
t::lib::Mocks::mock_userenv({ branchcode => $branchcode }); |
258 |
|
258 |
|
Lines 282-293
subtest "Test patron_status_string" => sub {
Link Here
|
282 |
); |
282 |
); |
283 |
AddIssue( $patron, $item2->barcode ); |
283 |
AddIssue( $patron, $item2->barcode ); |
284 |
|
284 |
|
285 |
is( Koha::Checkouts->search({ borrowernumber => $patron->{borrowernumber} })->count, 2, "Found 2 checkouts for this patron" ); |
285 |
is( |
|
|
286 |
Koha::Checkouts->search( { borrowernumber => $patron->borrowernumber } )->count, 2, |
287 |
"Found 2 checkouts for this patron" |
288 |
); |
286 |
|
289 |
|
287 |
$item1->itemlost(1)->store(); |
290 |
$item1->itemlost(1)->store(); |
288 |
$item2->itemlost(2)->store(); |
291 |
$item2->itemlost(2)->store(); |
289 |
|
292 |
|
290 |
is( Koha::Checkouts->search({ borrowernumber => $patron->{borrowernumber}, 'itemlost' => { '>', 0 } }, { join => 'item'} )->count, 2, "Found 2 lost checkouts for this patron" ); |
293 |
is( |
|
|
294 |
Koha::Checkouts->search( |
295 |
{ borrowernumber => $patron->borrowernumber, 'itemlost' => { '>', 0 } }, { join => 'item' } |
296 |
)->count, |
297 |
2, |
298 |
"Found 2 lost checkouts for this patron" |
299 |
); |
291 |
|
300 |
|
292 |
my $server->{account}->{lost_block_checkout} = undef; |
301 |
my $server->{account}->{lost_block_checkout} = undef; |
293 |
my $patron_status_string = C4::SIP::Sip::MsgType::patron_status_string( $sip_patron, $server ); |
302 |
my $patron_status_string = C4::SIP::Sip::MsgType::patron_status_string( $sip_patron, $server ); |
294 |
- |
|
|