Lines 27-33
use Koha::Item;
Link Here
|
27 |
use Koha::Holds; |
27 |
use Koha::Holds; |
28 |
use Koha::Hold; |
28 |
use Koha::Hold; |
29 |
|
29 |
|
30 |
use Test::More tests => 12; |
30 |
use Test::More tests => 14; |
31 |
|
31 |
|
32 |
my $dbh = C4::Context->dbh; |
32 |
my $dbh = C4::Context->dbh; |
33 |
my $schema = Koha::Database->new()->schema(); |
33 |
my $schema = Koha::Database->new()->schema(); |
Lines 60-66
my $biblioitem =
Link Here
|
60 |
|
60 |
|
61 |
my @items; |
61 |
my @items; |
62 |
for my $i ( 1 .. 10 ) { |
62 |
for my $i ( 1 .. 10 ) { |
63 |
my $item = Koha::Item->new( { biblionumber => $biblio->id(), biblioitemnumber => $biblioitem->id(), } )->store(); |
63 |
my $item = Koha::Item->new( |
|
|
64 |
{ |
65 |
biblionumber => $biblio->id(), |
66 |
biblioitemnumber => $biblioitem->id(), |
67 |
barcode => $i, |
68 |
} |
69 |
)->store(); |
64 |
push( @items, $item ); |
70 |
push( @items, $item ); |
65 |
} |
71 |
} |
66 |
|
72 |
|
Lines 88-94
C4::Context->set_preference( 'decreaseLoanHighHoldsValue', 1 );
Link Here
|
88 |
C4::Context->set_preference( 'decreaseLoanHighHoldsControl', 'static' ); |
94 |
C4::Context->set_preference( 'decreaseLoanHighHoldsControl', 'static' ); |
89 |
C4::Context->set_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' ); |
95 |
C4::Context->set_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' ); |
90 |
|
96 |
|
91 |
my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL' }; |
97 |
my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL', barcode => $item->barcode }; |
92 |
my $patron_hr = { borrower => $patron->id, branchcode => 'MPL' }; |
98 |
my $patron_hr = { borrower => $patron->id, branchcode => 'MPL' }; |
93 |
|
99 |
|
94 |
my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
100 |
my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
Lines 101-107
C4::Context->set_preference( 'decreaseLoanHighHoldsControl', 'dynamic' );
Link Here
|
101 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
107 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
102 |
is( $data->{exceeded}, 0, "Should not exceed threshold" ); |
108 |
is( $data->{exceeded}, 0, "Should not exceed threshold" ); |
103 |
|
109 |
|
104 |
for my $i ( 5 .. 10 ) { |
110 |
for my $i ( 5 .. 11 ) { |
105 |
my $patron = $patrons[$i]; |
111 |
my $patron = $patrons[$i]; |
106 |
my $hold = Koha::Hold->new( |
112 |
my $hold = Koha::Hold->new( |
107 |
{ |
113 |
{ |
Lines 147-151
$unholdable->store();
Link Here
|
147 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
153 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
148 |
is( $data->{exceeded}, 1, "Should exceed threshold" ); |
154 |
is( $data->{exceeded}, 1, "Should exceed threshold" ); |
149 |
|
155 |
|
|
|
156 |
C4::Context->set_preference('CircControl', 'PatronLibrary'); |
157 |
|
158 |
my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode ); |
159 |
ok( $needsconfirmation->{HIGHHOLDS}, "High holds checkout needs confirmation" ); |
160 |
|
161 |
( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode, undef, undef, undef, { override_high_holds => 1 } ); |
162 |
ok( !$needsconfirmation->{HIGHHOLDS}, "High holds checkout does not need confirmation" ); |
163 |
|
150 |
$schema->storage->txn_rollback(); |
164 |
$schema->storage->txn_rollback(); |
151 |
1; |
165 |
1; |
152 |
- |
|
|