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 73-79
my $itemtype = $builder->build(
Link Here
|
73 |
value => { |
73 |
value => { |
74 |
notforloan => undef, |
74 |
notforloan => undef, |
75 |
rentalcharge => 0, |
75 |
rentalcharge => 0, |
76 |
rental_charge_daily => 0, |
76 |
rentalcharge_daily => 0, |
77 |
defaultreplacecost => undef, |
77 |
defaultreplacecost => undef, |
78 |
processfee => undef |
78 |
processfee => undef |
79 |
} |
79 |
} |
Lines 1951-1957
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
1951 |
rentalcharge => 0, |
1951 |
rentalcharge => 0, |
1952 |
defaultreplacecost => undef, |
1952 |
defaultreplacecost => undef, |
1953 |
processfee => $processfee_amount, |
1953 |
processfee => $processfee_amount, |
1954 |
rental_charge_daily => 0, |
1954 |
rentalcharge_daily => 0, |
1955 |
} |
1955 |
} |
1956 |
} |
1956 |
} |
1957 |
); |
1957 |
); |
Lines 2249-2255
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2249 |
rentalcharge => 0, |
2249 |
rentalcharge => 0, |
2250 |
defaultreplacecost => undef, |
2250 |
defaultreplacecost => undef, |
2251 |
processfee => 0, |
2251 |
processfee => 0, |
2252 |
rental_charge_daily => 0, |
2252 |
rentalcharge_daily => 0, |
2253 |
} |
2253 |
} |
2254 |
} |
2254 |
} |
2255 |
); |
2255 |
); |
Lines 2853-2859
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
Link Here
|
2853 |
); |
2853 |
); |
2854 |
|
2854 |
|
2855 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2855 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2856 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { rental_charge_daily => 0.00 }}); |
2856 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { rentalcharge_daily => 0.00 }}); |
2857 |
my $patron = $builder->build_object({ |
2857 |
my $patron = $builder->build_object({ |
2858 |
class => 'Koha::Patrons', |
2858 |
class => 'Koha::Patrons', |
2859 |
value => { branchcode => $library->id } |
2859 |
value => { branchcode => $library->id } |
Lines 3016-3022
subtest 'Incremented fee tests' => sub {
Link Here
|
3016 |
value => { |
3016 |
value => { |
3017 |
notforloan => undef, |
3017 |
notforloan => undef, |
3018 |
rentalcharge => 0, |
3018 |
rentalcharge => 0, |
3019 |
rental_charge_daily => 1.000000 |
3019 |
rentalcharge_daily => 1.000000 |
3020 |
} |
3020 |
} |
3021 |
} |
3021 |
} |
3022 |
)->store; |
3022 |
)->store; |
Lines 3038-3044
subtest 'Incremented fee tests' => sub {
Link Here
|
3038 |
} |
3038 |
} |
3039 |
)->store; |
3039 |
)->store; |
3040 |
|
3040 |
|
3041 |
is( $itemtype->rental_charge_daily, '1.000000', 'Daily rental charge stored and retreived correctly' ); |
3041 |
is( $itemtype->rentalcharge_daily, '1.000000', 'Daily rental charge stored and retreived correctly' ); |
3042 |
is( $item->effective_itemtype, $itemtype->id, "Itemtype set correctly for item"); |
3042 |
is( $item->effective_itemtype, $itemtype->id, "Itemtype set correctly for item"); |
3043 |
|
3043 |
|
3044 |
my $dt_from = dt_from_string(); |
3044 |
my $dt_from = dt_from_string(); |
Lines 3095-3097
subtest 'Incremented fee tests' => sub {
Link Here
|
3095 |
$accountlines->delete(); |
3095 |
$accountlines->delete(); |
3096 |
$issue->delete(); |
3096 |
$issue->delete(); |
3097 |
}; |
3097 |
}; |
|
|
3098 |
|
3099 |
subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { |
3100 |
plan tests => 2; |
3101 |
|
3102 |
t::lib::Mocks::mock_preference('RentalFeesCheckoutConfirmation', 1); |
3103 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
3104 |
|
3105 |
my $library = |
3106 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3107 |
my $patron = $builder->build_object( |
3108 |
{ |
3109 |
class => 'Koha::Patrons', |
3110 |
value => { categorycode => $patron_category->{categorycode} } |
3111 |
} |
3112 |
)->store; |
3113 |
|
3114 |
my $itemtype = $builder->build_object( |
3115 |
{ |
3116 |
class => 'Koha::ItemTypes', |
3117 |
value => { |
3118 |
notforloan => 0, |
3119 |
rentalcharge => 0, |
3120 |
rentalcharge_daily => 0 |
3121 |
} |
3122 |
} |
3123 |
); |
3124 |
|
3125 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
3126 |
my $item = $builder->build_object( |
3127 |
{ |
3128 |
class => 'Koha::Items', |
3129 |
value => { |
3130 |
homebranch => $library->id, |
3131 |
holdingbranch => $library->id, |
3132 |
notforloan => 0, |
3133 |
itemlost => 0, |
3134 |
withdrawn => 0, |
3135 |
itype => $itemtype->id, |
3136 |
biblionumber => $biblioitem->{biblionumber}, |
3137 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
3138 |
} |
3139 |
} |
3140 |
)->store; |
3141 |
|
3142 |
my ( $issuingimpossible, $needsconfirmation ); |
3143 |
my $dt_from = dt_from_string(); |
3144 |
my $dt_due = dt_from_string()->add( days => 3 ); |
3145 |
|
3146 |
$itemtype->rentalcharge('1.000000')->store; |
3147 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); |
3148 |
is_deeply( $needsconfirmation, { RENTALCHARGE => '1' }, 'Item needs rentalcharge confirmation to be issued' ); |
3149 |
$itemtype->rentalcharge('0')->store; |
3150 |
$itemtype->rentalcharge_daily('1.000000')->store; |
3151 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); |
3152 |
is_deeply( $needsconfirmation, { RENTALCHARGE => '3' }, 'Item needs rentalcharge confirmation to be issued, increment' ); |
3153 |
$itemtype->rentalcharge_daily('0')->store; |
3154 |
}; |