|
Lines 6133-6138
subtest 'Tests for RecordLocalUseOnReturn' => sub {
Link Here
|
| 6133 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); |
6133 |
[ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); |
| 6134 |
}; |
6134 |
}; |
| 6135 |
|
6135 |
|
|
|
6136 |
subtest 'Tests for GetOtherReserves' => sub { |
| 6137 |
plan tests => 4; |
| 6138 |
|
| 6139 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 6140 |
my $patron_1 = $builder->build_object( |
| 6141 |
{ |
| 6142 |
class => 'Koha::Patrons', |
| 6143 |
} |
| 6144 |
); |
| 6145 |
my $patron_2 = $builder->build_object( |
| 6146 |
{ |
| 6147 |
class => 'Koha::Patrons', |
| 6148 |
} |
| 6149 |
); |
| 6150 |
|
| 6151 |
# GetOtherReserves uses the ItemType object to check not-for-loan value |
| 6152 |
my $itype = $builder->build_object( |
| 6153 |
{ |
| 6154 |
class => 'Koha::ItemTypes', |
| 6155 |
value => { |
| 6156 |
notforloan => 0, |
| 6157 |
} |
| 6158 |
} |
| 6159 |
); |
| 6160 |
|
| 6161 |
my $item = $builder->build_object( |
| 6162 |
{ |
| 6163 |
class => 'Koha::Items', |
| 6164 |
value => { |
| 6165 |
itype => $itype->itemtype, |
| 6166 |
homebranch => $library->branchcode, |
| 6167 |
} |
| 6168 |
} |
| 6169 |
); |
| 6170 |
|
| 6171 |
t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); |
| 6172 |
|
| 6173 |
my $reserve_1_id = AddReserve( |
| 6174 |
{ |
| 6175 |
branchcode => $item->homebranch, |
| 6176 |
borrowernumber => $patron_1->borrowernumber, |
| 6177 |
biblionumber => $item->biblionumber, |
| 6178 |
} |
| 6179 |
); |
| 6180 |
|
| 6181 |
my $reserve_2_id = AddReserve( |
| 6182 |
{ |
| 6183 |
branchcode => $item->homebranch, |
| 6184 |
borrowernumber => $patron_2->borrowernumber, |
| 6185 |
biblionumber => $item->biblionumber, |
| 6186 |
} |
| 6187 |
); |
| 6188 |
|
| 6189 |
my $messages; |
| 6190 |
my $nextreservinfo; |
| 6191 |
( $messages, $nextreservinfo ) = GetOtherReserves( $item->itemnumber ); |
| 6192 |
|
| 6193 |
my $reserve_1 = Koha::Holds->search( { reserve_id => $reserve_1_id } )->next; |
| 6194 |
|
| 6195 |
is( |
| 6196 |
$nextreservinfo->{reserve_id}, $reserve_1->reserve_id, |
| 6197 |
'GetOtherReserves should return the next reserve in line' |
| 6198 |
); |
| 6199 |
is( $reserve_1->priority, 1, 'Next reserve in line should be priority 1' ); |
| 6200 |
ok( !$reserve_1->found, 'GetOtherReserves should not set found status' ); |
| 6201 |
ok( !$reserve_1->itemnumber, 'GetOtherReserves should not set itemnumber on a biblio-level hold' ); |
| 6202 |
}; |
| 6203 |
|
| 6136 |
$schema->storage->txn_rollback; |
6204 |
$schema->storage->txn_rollback; |
| 6137 |
C4::Context->clear_syspref_cache(); |
6205 |
C4::Context->clear_syspref_cache(); |
| 6138 |
$branches = Koha::Libraries->search(); |
6206 |
$branches = Koha::Libraries->search(); |
| 6139 |
- |
|
|