|
Lines 6180-6200
subtest 'Tests for transfer not in transit' => sub {
Link Here
|
| 6180 |
|
6180 |
|
| 6181 |
subtest 'Tests for RecordLocalUseOnReturn' => sub { |
6181 |
subtest 'Tests for RecordLocalUseOnReturn' => sub { |
| 6182 |
|
6182 |
|
| 6183 |
plan tests => 2; |
6183 |
plan tests => 5; |
| 6184 |
|
6184 |
|
| 6185 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); |
6185 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); |
| 6186 |
my $item = $builder->build_sample_item(); |
6186 |
my $item = $builder->build_sample_item(); |
|
|
6187 |
|
| 6188 |
my $item_2 = $builder->build_sample_item( |
| 6189 |
{ |
| 6190 |
onloan => undef, |
| 6191 |
} |
| 6192 |
); |
| 6193 |
|
| 6187 |
$item->withdrawn(1)->itemlost(1)->store; |
6194 |
$item->withdrawn(1)->itemlost(1)->store; |
| 6188 |
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
6195 |
my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
| 6189 |
is_deeply( |
6196 |
is_deeply( |
| 6190 |
\@return, |
6197 |
\@return, |
| 6191 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded"); |
6198 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded"); |
| 6192 |
|
6199 |
|
|
|
6200 |
AddReturn( $item_2->barcode, $item_2->homebranch ); |
| 6201 |
$item_2->discard_changes; # refresh |
| 6202 |
is( $item_2->localuse, undef , 'Without RecordLocalUseOnReturn no localuse is recorded.'); |
| 6203 |
|
| 6193 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1); |
6204 |
t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1); |
| 6194 |
my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
6205 |
my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef ); |
| 6195 |
is_deeply( |
6206 |
is_deeply( |
| 6196 |
\@return2, |
6207 |
\@return2, |
| 6197 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); |
6208 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); |
|
|
6209 |
|
| 6210 |
AddReturn( $item_2->barcode, $item_2->homebranch ); |
| 6211 |
$item_2->discard_changes; # refresh |
| 6212 |
is( $item_2->localuse, 1 , 'With RecordLocalUseOnReturn localuse is recorded.'); |
| 6213 |
|
| 6214 |
AddReturn( $item_2->barcode, $item_2->homebranch ); |
| 6215 |
$item_2->discard_changes; # refresh |
| 6216 |
is( $item_2->localuse, 2 , 'With RecordLocalUseOnReturn localuse is recorded.'); |
| 6198 |
}; |
6217 |
}; |
| 6199 |
|
6218 |
|
| 6200 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
6219 |
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { |
| 6201 |
- |
|
|