Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 125; |
21 |
use Test::More tests => 126; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
|
23 |
|
24 |
use Data::Dumper; |
24 |
use Data::Dumper; |
Lines 75-81
my $itemtype = $builder->build(
Link Here
|
75 |
value => { |
75 |
value => { |
76 |
notforloan => undef, |
76 |
notforloan => undef, |
77 |
rentalcharge => 0, |
77 |
rentalcharge => 0, |
78 |
rental_charge_daily => 0, |
78 |
rentalcharge_daily => 0, |
79 |
defaultreplacecost => undef, |
79 |
defaultreplacecost => undef, |
80 |
processfee => undef |
80 |
processfee => undef |
81 |
} |
81 |
} |
Lines 1962-1968
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
1962 |
rentalcharge => 0, |
1962 |
rentalcharge => 0, |
1963 |
defaultreplacecost => undef, |
1963 |
defaultreplacecost => undef, |
1964 |
processfee => $processfee_amount, |
1964 |
processfee => $processfee_amount, |
1965 |
rental_charge_daily => 0, |
1965 |
rentalcharge_daily => 0, |
1966 |
} |
1966 |
} |
1967 |
} |
1967 |
} |
1968 |
); |
1968 |
); |
Lines 2260-2266
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2260 |
rentalcharge => 0, |
2260 |
rentalcharge => 0, |
2261 |
defaultreplacecost => undef, |
2261 |
defaultreplacecost => undef, |
2262 |
processfee => 0, |
2262 |
processfee => 0, |
2263 |
rental_charge_daily => 0, |
2263 |
rentalcharge_daily => 0, |
2264 |
} |
2264 |
} |
2265 |
} |
2265 |
} |
2266 |
); |
2266 |
); |
Lines 2864-2870
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
Link Here
|
2864 |
); |
2864 |
); |
2865 |
|
2865 |
|
2866 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2866 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2867 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { rental_charge_daily => 0.00 }}); |
2867 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { rentalcharge_daily => 0.00 }}); |
2868 |
my $patron = $builder->build_object({ |
2868 |
my $patron = $builder->build_object({ |
2869 |
class => 'Koha::Patrons', |
2869 |
class => 'Koha::Patrons', |
2870 |
value => { branchcode => $library->id } |
2870 |
value => { branchcode => $library->id } |
Lines 3029-3035
subtest 'Incremented fee tests' => sub {
Link Here
|
3029 |
value => { |
3029 |
value => { |
3030 |
notforloan => undef, |
3030 |
notforloan => undef, |
3031 |
rentalcharge => 0, |
3031 |
rentalcharge => 0, |
3032 |
rental_charge_daily => 1.000000 |
3032 |
rentalcharge_daily => 1.000000 |
3033 |
} |
3033 |
} |
3034 |
} |
3034 |
} |
3035 |
)->store; |
3035 |
)->store; |
Lines 3051-3057
subtest 'Incremented fee tests' => sub {
Link Here
|
3051 |
} |
3051 |
} |
3052 |
)->store; |
3052 |
)->store; |
3053 |
|
3053 |
|
3054 |
is( $itemtype->rental_charge_daily, '1.000000', 'Daily rental charge stored and retreived correctly' ); |
3054 |
is( $itemtype->rentalcharge_daily, '1.000000', 'Daily rental charge stored and retreived correctly' ); |
3055 |
is( $item->effective_itemtype, $itemtype->id, "Itemtype set correctly for item"); |
3055 |
is( $item->effective_itemtype, $itemtype->id, "Itemtype set correctly for item"); |
3056 |
|
3056 |
|
3057 |
my $dt_from = dt_from_string(); |
3057 |
my $dt_from = dt_from_string(); |
Lines 3108-3110
subtest 'Incremented fee tests' => sub {
Link Here
|
3108 |
$accountlines->delete(); |
3108 |
$accountlines->delete(); |
3109 |
$issue->delete(); |
3109 |
$issue->delete(); |
3110 |
}; |
3110 |
}; |
|
|
3111 |
|
3112 |
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { |
3113 |
plan tests => 2; |
3114 |
|
3115 |
t::lib::Mocks::mock_preference('RentalFeesCheckoutConfirmation', 1); |
3116 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
3117 |
|
3118 |
my $library = |
3119 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3120 |
my $patron = $builder->build_object( |
3121 |
{ |
3122 |
class => 'Koha::Patrons', |
3123 |
value => { categorycode => $patron_category->{categorycode} } |
3124 |
} |
3125 |
)->store; |
3126 |
|
3127 |
my $itemtype = $builder->build_object( |
3128 |
{ |
3129 |
class => 'Koha::ItemTypes', |
3130 |
value => { |
3131 |
notforloan => 0, |
3132 |
rentalcharge => 0, |
3133 |
rentalcharge_daily => 0 |
3134 |
} |
3135 |
} |
3136 |
); |
3137 |
|
3138 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
3139 |
my $item = $builder->build_object( |
3140 |
{ |
3141 |
class => 'Koha::Items', |
3142 |
value => { |
3143 |
homebranch => $library->id, |
3144 |
holdingbranch => $library->id, |
3145 |
notforloan => 0, |
3146 |
itemlost => 0, |
3147 |
withdrawn => 0, |
3148 |
itype => $itemtype->id, |
3149 |
biblionumber => $biblioitem->{biblionumber}, |
3150 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
3151 |
} |
3152 |
} |
3153 |
)->store; |
3154 |
|
3155 |
my ( $issuingimpossible, $needsconfirmation ); |
3156 |
my $dt_from = dt_from_string(); |
3157 |
my $dt_due = dt_from_string()->add( days => 3 ); |
3158 |
|
3159 |
$itemtype->rentalcharge('1.000000')->store; |
3160 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); |
3161 |
is_deeply( $needsconfirmation, { RENTALCHARGE => '1' }, 'Item needs rentalcharge confirmation to be issued' ); |
3162 |
$itemtype->rentalcharge('0')->store; |
3163 |
$itemtype->rentalcharge_daily('1.000000')->store; |
3164 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); |
3165 |
is_deeply( $needsconfirmation, { RENTALCHARGE => '3' }, 'Item needs rentalcharge confirmation to be issued, increment' ); |
3166 |
$itemtype->rentalcharge_daily('0')->store; |
3167 |
}; |