Lines 52-57
$builder->build({
Link Here
|
52 |
reservefee => 2, |
52 |
reservefee => 2, |
53 |
}, |
53 |
}, |
54 |
}); |
54 |
}); |
|
|
55 |
$builder->build({ |
56 |
source => 'Category', |
57 |
value => { |
58 |
categorycode => 'XYZ2', |
59 |
reservefee => 0, |
60 |
}, |
61 |
}); |
55 |
my $patron1 = $builder->build({ |
62 |
my $patron1 = $builder->build({ |
56 |
source => 'Borrower', |
63 |
source => 'Borrower', |
57 |
value => { |
64 |
value => { |
Lines 67-72
my $patron2 = $builder->build({
Link Here
|
67 |
my $patron3 = $builder->build({ |
74 |
my $patron3 = $builder->build({ |
68 |
source => 'Borrower', |
75 |
source => 'Borrower', |
69 |
}); |
76 |
}); |
|
|
77 |
my $patron4 = $builder->build({ |
78 |
source => 'Borrower', |
79 |
value => { |
80 |
categorycode => 'XYZ2', |
81 |
}, |
82 |
}); |
70 |
|
83 |
|
71 |
# One biblio and two items |
84 |
# One biblio and two items |
72 |
my $biblio = $builder->build_sample_biblio; |
85 |
my $biblio = $builder->build_sample_biblio; |
Lines 84-90
my $item2 = $builder->build_sample_item(
Link Here
|
84 |
); |
97 |
); |
85 |
|
98 |
|
86 |
subtest 'GetReserveFee' => sub { |
99 |
subtest 'GetReserveFee' => sub { |
87 |
plan tests => 5; |
100 |
plan tests => 6; |
88 |
|
101 |
|
89 |
C4::Circulation::AddIssue( $patron1, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
102 |
C4::Circulation::AddIssue( $patron1, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
90 |
C4::Circulation::AddIssue( $patron3, $item2->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
103 |
C4::Circulation::AddIssue( $patron3, $item2->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
Lines 109-114
subtest 'GetReserveFee' => sub {
Link Here
|
109 |
t::lib::Mocks::mock_preference('HoldFeeMode', 'any_time_is_collected'); |
122 |
t::lib::Mocks::mock_preference('HoldFeeMode', 'any_time_is_collected'); |
110 |
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->biblionumber ); |
123 |
$fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->biblionumber ); |
111 |
is( int($fee), 2, 'HoldFeeMode=any_time_is_collected, Patron 2 should be charged' ); |
124 |
is( int($fee), 2, 'HoldFeeMode=any_time_is_collected, Patron 2 should be charged' ); |
|
|
125 |
|
126 |
t::lib::Mocks::mock_preference('HoldFeeMode', 'any_time_is_placed'); |
127 |
$fee = C4::Reserves::GetReserveFee( $patron4->{borrowernumber}, $biblio->biblionumber ); |
128 |
is( $fee, 0, 'HoldFeeMode=any_time_is_placed ; fee == 0, Patron 4 should not be charged' ); |
112 |
}; |
129 |
}; |
113 |
|
130 |
|
114 |
subtest 'Integration with AddReserve' => sub { |
131 |
subtest 'Integration with AddReserve' => sub { |
115 |
- |
|
|