|
Lines 20-25
use Koha::DateUtils qw( dt_from_string );
Link Here
|
| 20 |
use Koha::Items; |
20 |
use Koha::Items; |
| 21 |
use Koha::Holds; |
21 |
use Koha::Holds; |
| 22 |
use Koha::CirculationRules; |
22 |
use Koha::CirculationRules; |
|
|
23 |
use Koha::Cache::Memory::Lite; |
| 23 |
|
24 |
|
| 24 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
| 25 |
use t::lib::Mocks; |
26 |
use t::lib::Mocks; |
|
Lines 35-40
my $schema = Koha::Database->schema;
Link Here
|
| 35 |
$schema->storage->txn_begin; |
36 |
$schema->storage->txn_begin; |
| 36 |
my $dbh = C4::Context->dbh; |
37 |
my $dbh = C4::Context->dbh; |
| 37 |
$dbh->do("DELETE FROM circulation_rules"); |
38 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
39 |
Koha::Cache::Memory::Lite->flush(); |
| 38 |
|
40 |
|
| 39 |
my $builder = t::lib::TestBuilder->new; |
41 |
my $builder = t::lib::TestBuilder->new; |
| 40 |
|
42 |
|
|
Lines 186-191
$schema->txn_begin;
Link Here
|
| 186 |
|
188 |
|
| 187 |
# Clear out existing rules relating to holdallowed |
189 |
# Clear out existing rules relating to holdallowed |
| 188 |
$dbh->do("DELETE FROM circulation_rules"); |
190 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
191 |
Koha::Cache::Memory::Lite->flush(); |
| 189 |
|
192 |
|
| 190 |
t::lib::Mocks::mock_preference('UseTransportCostMatrix', 0); |
193 |
t::lib::Mocks::mock_preference('UseTransportCostMatrix', 0); |
| 191 |
|
194 |
|
|
Lines 306-311
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[0], 3 )
Link Here
|
| 306 |
my $holds_queue; |
309 |
my $holds_queue; |
| 307 |
|
310 |
|
| 308 |
$dbh->do("DELETE FROM circulation_rules"); |
311 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
312 |
Koha::Cache::Memory::Lite->flush(); |
| 309 |
Koha::CirculationRules->set_rule( |
313 |
Koha::CirculationRules->set_rule( |
| 310 |
{ |
314 |
{ |
| 311 |
rule_name => 'holdallowed', |
315 |
rule_name => 'holdallowed', |
|
Lines 343-348
is( scalar( @$holds_queue ), 1, "Holds not filled with items from closed librari
Link Here
|
| 343 |
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0); |
347 |
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0); |
| 344 |
|
348 |
|
| 345 |
$dbh->do("DELETE FROM circulation_rules"); |
349 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
350 |
Koha::Cache::Memory::Lite->flush(); |
| 346 |
Koha::CirculationRules->set_rule( |
351 |
Koha::CirculationRules->set_rule( |
| 347 |
{ |
352 |
{ |
| 348 |
rule_name => 'holdallowed', |
353 |
rule_name => 'holdallowed', |
|
Lines 370-375
t::lib::Mocks::mock_preference( 'HoldsQueueSkipClosed', 0 );
Link Here
|
| 370 |
t::lib::Mocks::mock_preference('LocalHoldsPriority', 1); |
375 |
t::lib::Mocks::mock_preference('LocalHoldsPriority', 1); |
| 371 |
|
376 |
|
| 372 |
$dbh->do("DELETE FROM circulation_rules"); |
377 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
378 |
Koha::Cache::Memory::Lite->flush(); |
| 373 |
Koha::CirculationRules->set_rule( |
379 |
Koha::CirculationRules->set_rule( |
| 374 |
{ |
380 |
{ |
| 375 |
rule_name => 'holdallowed', |
381 |
rule_name => 'holdallowed', |
|
Lines 646-651
$dbh->do("
Link Here
|
| 646 |
|
652 |
|
| 647 |
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch |
653 |
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch |
| 648 |
$dbh->do("DELETE FROM circulation_rules"); |
654 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
655 |
Koha::Cache::Memory::Lite->flush(); |
| 649 |
Koha::CirculationRules->set_rules( |
656 |
Koha::CirculationRules->set_rules( |
| 650 |
{ |
657 |
{ |
| 651 |
branchcode => undef, |
658 |
branchcode => undef, |
|
Lines 707-712
Koha::Holds->find( $reserve_id )->cancel;
Link Here
|
| 707 |
|
714 |
|
| 708 |
# With hold_fulfillment_policy = holdingbranch, hold should only be picked up if pickup branch = holdingbranch |
715 |
# With hold_fulfillment_policy = holdingbranch, hold should only be picked up if pickup branch = holdingbranch |
| 709 |
$dbh->do("DELETE FROM circulation_rules"); |
716 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
717 |
Koha::Cache::Memory::Lite->flush(); |
| 710 |
Koha::CirculationRules->set_rules( |
718 |
Koha::CirculationRules->set_rules( |
| 711 |
{ |
719 |
{ |
| 712 |
branchcode => undef, |
720 |
branchcode => undef, |
|
Lines 765-770
Koha::Holds->find( $reserve_id )->cancel;
Link Here
|
| 765 |
|
773 |
|
| 766 |
# With hold_fulfillment_policy = any, hold should be pikcup up reguardless of matching home or holding branch |
774 |
# With hold_fulfillment_policy = any, hold should be pikcup up reguardless of matching home or holding branch |
| 767 |
$dbh->do("DELETE FROM circulation_rules"); |
775 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
776 |
Koha::Cache::Memory::Lite->flush(); |
| 768 |
Koha::CirculationRules->set_rules( |
777 |
Koha::CirculationRules->set_rules( |
| 769 |
{ |
778 |
{ |
| 770 |
branchcode => undef, |
779 |
branchcode => undef, |
|
Lines 856-861
$dbh->do("
Link Here
|
| 856 |
|
865 |
|
| 857 |
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch |
866 |
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch |
| 858 |
$dbh->do("DELETE FROM circulation_rules"); |
867 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
868 |
Koha::Cache::Memory::Lite->flush(); |
| 859 |
Koha::CirculationRules->set_rules( |
869 |
Koha::CirculationRules->set_rules( |
| 860 |
{ |
870 |
{ |
| 861 |
branchcode => undef, |
871 |
branchcode => undef, |
|
Lines 1207-1212
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue
Link Here
|
| 1207 |
$dbh->do("DELETE FROM hold_fill_targets"); |
1217 |
$dbh->do("DELETE FROM hold_fill_targets"); |
| 1208 |
$dbh->do("DELETE FROM reserves"); |
1218 |
$dbh->do("DELETE FROM reserves"); |
| 1209 |
$dbh->do("DELETE FROM circulation_rules"); |
1219 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
1220 |
Koha::Cache::Memory::Lite->flush(); |
| 1210 |
Koha::Biblios->delete(); |
1221 |
Koha::Biblios->delete(); |
| 1211 |
|
1222 |
|
| 1212 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 ); |
1223 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 ); |
|
Lines 1274-1279
subtest "Item level holds info is preserved (Bug 25738)" => sub {
Link Here
|
| 1274 |
$dbh->do("DELETE FROM hold_fill_targets"); |
1285 |
$dbh->do("DELETE FROM hold_fill_targets"); |
| 1275 |
$dbh->do("DELETE FROM reserves"); |
1286 |
$dbh->do("DELETE FROM reserves"); |
| 1276 |
$dbh->do("DELETE FROM circulation_rules"); |
1287 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
1288 |
Koha::Cache::Memory::Lite->flush(); |
| 1277 |
|
1289 |
|
| 1278 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
1290 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 1279 |
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} }); |
1291 |
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} }); |
|
Lines 1482-1487
subtest "Test item group holds" => sub {
Link Here
|
| 1482 |
$dbh->do("DELETE FROM hold_fill_targets"); |
1494 |
$dbh->do("DELETE FROM hold_fill_targets"); |
| 1483 |
$dbh->do("DELETE FROM reserves"); |
1495 |
$dbh->do("DELETE FROM reserves"); |
| 1484 |
$dbh->do("DELETE FROM circulation_rules"); |
1496 |
$dbh->do("DELETE FROM circulation_rules"); |
|
|
1497 |
Koha::Cache::Memory::Lite->flush(); |
| 1485 |
|
1498 |
|
| 1486 |
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0); |
1499 |
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0); |
| 1487 |
t::lib::Mocks::mock_preference('LocalHoldsPriority', 0); |
1500 |
t::lib::Mocks::mock_preference('LocalHoldsPriority', 0); |
| 1488 |
- |
|
|