|
Lines 51-56
Koha::ItemType->new(
Link Here
|
| 51 |
summary => 'summary', |
51 |
summary => 'summary', |
| 52 |
checkinmsg => 'checkinmsg', |
52 |
checkinmsg => 'checkinmsg', |
| 53 |
checkinmsgtype => 'checkinmsgtype', |
53 |
checkinmsgtype => 'checkinmsgtype', |
|
|
54 |
processfee => '0.00', |
| 55 |
defaultreplacecost => '0.00', |
| 54 |
} |
56 |
} |
| 55 |
)->store; |
57 |
)->store; |
| 56 |
|
58 |
|
|
Lines 63-68
Koha::ItemType->new(
Link Here
|
| 63 |
summary => 'summary', |
65 |
summary => 'summary', |
| 64 |
checkinmsg => 'checkinmsg', |
66 |
checkinmsg => 'checkinmsg', |
| 65 |
checkinmsgtype => 'checkinmsgtype', |
67 |
checkinmsgtype => 'checkinmsgtype', |
|
|
68 |
processfee => '0.00', |
| 69 |
defaultreplacecost => '0.00', |
| 66 |
} |
70 |
} |
| 67 |
)->store; |
71 |
)->store; |
| 68 |
|
72 |
|
|
Lines 75-80
Koha::ItemType->new(
Link Here
|
| 75 |
summary => 'summary', |
79 |
summary => 'summary', |
| 76 |
checkinmsg => 'checkinmsg', |
80 |
checkinmsg => 'checkinmsg', |
| 77 |
checkinmsgtype => 'checkinmsgtype', |
81 |
checkinmsgtype => 'checkinmsgtype', |
|
|
82 |
processfee => '0.00', |
| 83 |
defaultreplacecost => '0.00', |
| 78 |
} |
84 |
} |
| 79 |
)->store; |
85 |
)->store; |
| 80 |
|
86 |
|
|
Lines 161-181
subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub {
Link Here
|
| 161 |
itemtype => 'type4', |
167 |
itemtype => 'type4', |
| 162 |
description => 'description', |
168 |
description => 'description', |
| 163 |
rental_charge_daily => 1.00, |
169 |
rental_charge_daily => 1.00, |
|
|
170 |
rentalcharge => '0.00', |
| 171 |
processfee => '0.00', |
| 172 |
defaultreplacecost => '0.00', |
| 164 |
} |
173 |
} |
| 165 |
)->store; |
174 |
)->store; |
| 166 |
|
175 |
|
| 167 |
is( $itemtype->rental_charge_daily, 1.00, 'Daily rental charge stored and retreived correctly' ); |
176 |
is( $itemtype->rental_charge_daily, 1.00, 'Daily rental charge stored and retreived correctly' ); |
| 168 |
|
177 |
|
| 169 |
my $dt_from = dt_from_string(); |
178 |
my $dt_from = dt_from_string(); |
| 170 |
my $dt_to = dt_from_string()->add( days => 7 ); |
179 |
my $dt_to = dt_from_string()->add( days => 6 ); |
| 171 |
|
180 |
|
| 172 |
t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar'); |
181 |
t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar'); |
| 173 |
my $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
182 |
my $charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
| 174 |
is( $charge, 7.00, "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" ); |
183 |
is( $charge, 6.00, "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" ); |
| 175 |
|
184 |
|
| 176 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
185 |
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); |
| 177 |
$charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
186 |
$charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
| 178 |
is( $charge, 7.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" ); |
187 |
is( $charge, 6.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" ); |
| 179 |
|
188 |
|
| 180 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
189 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
| 181 |
$calendar->insert_week_day_holiday( |
190 |
$calendar->insert_week_day_holiday( |
|
Lines 184-190
subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub {
Link Here
|
| 184 |
description => 'Test holiday' |
193 |
description => 'Test holiday' |
| 185 |
); |
194 |
); |
| 186 |
$charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
195 |
$charge = $itemtype->calc_rental_charge_daily( { from => $dt_from, to => $dt_to } ); |
| 187 |
is( $charge, 6.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" ); |
196 |
is( $charge, 5.00, "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" ); |
| 188 |
|
197 |
|
| 189 |
}; |
198 |
}; |
| 190 |
|
199 |
|
| 191 |
- |
|
|