Lines 15-20
use C4::Members;
Link Here
|
15 |
use C4::Calendar; |
15 |
use C4::Calendar; |
16 |
use Koha::Database; |
16 |
use Koha::Database; |
17 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
17 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
|
|
18 |
use Koha::Biblios; |
18 |
use Koha::Holds; |
19 |
use Koha::Holds; |
19 |
|
20 |
|
20 |
BEGIN { |
21 |
BEGIN { |
Lines 84-97
foreach my $borrowernumber ( @borrowernumbers ) {
Link Here
|
84 |
); |
85 |
); |
85 |
} |
86 |
} |
86 |
|
87 |
|
87 |
my $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber }); |
88 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
88 |
is( scalar(@$reserves), $borrowers_count, "Test GetReserves()" ); |
89 |
my $holds = $biblio->holds; |
89 |
|
90 |
is( $holds->count, $borrowers_count, 'Test GetReserves()' ); |
90 |
is( $reserves->[0]->{priority}, 1, "Reserve 1 has a priority of 1" ); |
91 |
is( $holds->next->priority, 1, "Reserve 1 has a priority of 1" ); |
91 |
is( $reserves->[1]->{priority}, 2, "Reserve 2 has a priority of 2" ); |
92 |
is( $holds->next->priority, 2, "Reserve 2 has a priority of 2" ); |
92 |
is( $reserves->[2]->{priority}, 3, "Reserve 3 has a priority of 3" ); |
93 |
is( $holds->next->priority, 3, "Reserve 3 has a priority of 3" ); |
93 |
is( $reserves->[3]->{priority}, 4, "Reserve 4 has a priority of 4" ); |
94 |
is( $holds->next->priority, 4, "Reserve 4 has a priority of 4" ); |
94 |
is( $reserves->[4]->{priority}, 5, "Reserve 5 has a priority of 5" ); |
95 |
is( $holds->next->priority, 5, "Reserve 5 has a priority of 5" ); |
95 |
|
96 |
|
96 |
my ( $reservedate, $borrowernumber, $branch_1code, $reserve_id ) = GetReservesFromItemnumber($itemnumber); |
97 |
my ( $reservedate, $borrowernumber, $branch_1code, $reserve_id ) = GetReservesFromItemnumber($itemnumber); |
97 |
is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "GetReservesFromItemnumber should return a valid reserve date"); |
98 |
is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "GetReservesFromItemnumber should return a valid reserve date"); |
Lines 122-129
ok( GetReserveCount( $borrowernumbers[0] ), "Test GetReserveCount()" );
Link Here
|
122 |
|
123 |
|
123 |
|
124 |
|
124 |
CancelReserve({ 'reserve_id' => $reserve_id }); |
125 |
CancelReserve({ 'reserve_id' => $reserve_id }); |
125 |
$reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber }); |
126 |
$holds = $biblio->holds; |
126 |
is( scalar(@$reserves), $borrowers_count - 1, "Test CancelReserve()" ); |
127 |
is( $holds->count, $borrowers_count - 1, "Test CancelReserve()" ); |
127 |
|
128 |
|
128 |
|
129 |
|
129 |
( $reservedate, $borrowernumber, $branch_1code, $reserve_id ) = GetReservesFromItemnumber($itemnumber); |
130 |
( $reservedate, $borrowernumber, $branch_1code, $reserve_id ) = GetReservesFromItemnumber($itemnumber); |
Lines 202-210
my $reserve2 = GetReserveInfo( $reserve->{'reserve_id'} );
Link Here
|
202 |
ok( $reserve->{'reserve_id'} eq $reserve2->{'reserve_id'}, "Test GetReserveInfo()" ); |
203 |
ok( $reserve->{'reserve_id'} eq $reserve2->{'reserve_id'}, "Test GetReserveInfo()" ); |
203 |
|
204 |
|
204 |
|
205 |
|
205 |
$reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 }); |
206 |
$holds = $biblio->holds; |
206 |
$reserve = $reserves->[1]; |
207 |
my $hold = $holds->next; |
207 |
AlterPriority( 'top', $reserve->{'reserve_id'} ); |
208 |
AlterPriority( 'top', $hold->reserve_id ); |
208 |
$reserve = GetReserve( $reserve->{'reserve_id'} ); |
209 |
$reserve = GetReserve( $reserve->{'reserve_id'} ); |
209 |
is( $reserve->{'priority'}, '1', "Test AlterPriority(), move to top" ); |
210 |
is( $reserve->{'priority'}, '1', "Test AlterPriority(), move to top" ); |
210 |
|
211 |
|
Lines 429-435
t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', 1);
Link Here
|
429 |
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); |
430 |
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); |
430 |
$year += 1900; |
431 |
$year += 1900; |
431 |
$mon += 1; |
432 |
$mon += 1; |
432 |
$reserves = $dbh->selectall_arrayref('SELECT * FROM reserves', { Slice => {} }); |
433 |
my $reserves = $dbh->selectall_arrayref('SELECT * FROM reserves', { Slice => {} }); |
433 |
$reserve = $reserves->[0]; |
434 |
$reserve = $reserves->[0]; |
434 |
my $calendar = C4::Calendar->new(branchcode => $reserve->{branchcode}); |
435 |
my $calendar = C4::Calendar->new(branchcode => $reserve->{branchcode}); |
435 |
$calendar->insert_single_holiday( |
436 |
$calendar->insert_single_holiday( |