|
Lines 1-5
Link Here
|
| 1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
| 2 |
use Test::More tests => 2; |
2 |
use Test::More tests => 4; |
| 3 |
|
3 |
|
| 4 |
use MARC::Record; |
4 |
use MARC::Record; |
| 5 |
use MARC::Field; |
5 |
use MARC::Field; |
|
Lines 101-104
is(
Link Here
|
| 101 |
); |
101 |
); |
| 102 |
DelDebarment( $debarments->[0]->{borrower_debarment_id} ); |
102 |
DelDebarment( $debarments->[0]->{borrower_debarment_id} ); |
| 103 |
|
103 |
|
|
|
104 |
subtest "suspension_chargeperiod" => sub { |
| 105 |
Koha::IssuingRules->search->delete; |
| 106 |
$builder->build( |
| 107 |
{ |
| 108 |
source => 'Issuingrule', |
| 109 |
value => { |
| 110 |
categorycode => '*', |
| 111 |
itemtype => '*', |
| 112 |
branchcode => '*', |
| 113 |
firstremind => 0, |
| 114 |
finedays => 7, |
| 115 |
lengthunit => 'days', |
| 116 |
suspension_chargeperiod => 15, |
| 117 |
maxsuspensiondays => 333, |
| 118 |
} |
| 119 |
} |
| 120 |
); |
| 121 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 122 |
my $item = $builder->build_sample_item; |
| 123 |
|
| 124 |
my $last_year = dt_from_string->clone->subtract( years => 1 ); |
| 125 |
my $today = dt_from_string; |
| 126 |
my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, $last_year, $today ); |
| 127 |
is( $new_debar_dt->truncate( to => 'day' ), |
| 128 |
$today->clone->add( days => 365 / 15 * 7 )->truncate( to => 'day' ) ); |
| 129 |
|
| 130 |
}; |
| 131 |
|
| 132 |
subtest "maxsuspensiondays" => sub { |
| 133 |
Koha::IssuingRules->search->delete; |
| 134 |
$builder->build( |
| 135 |
{ |
| 136 |
source => 'Issuingrule', |
| 137 |
value => { |
| 138 |
categorycode => '*', |
| 139 |
itemtype => '*', |
| 140 |
branchcode => '*', |
| 141 |
firstremind => 0, |
| 142 |
finedays => 15, |
| 143 |
lengthunit => 'days', |
| 144 |
suspension_chargeperiod => 7, |
| 145 |
maxsuspensiondays => 333, |
| 146 |
} |
| 147 |
} |
| 148 |
); |
| 149 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 150 |
my $item = $builder->build_sample_item; |
| 151 |
|
| 152 |
my $last_year = dt_from_string->clone->subtract( years => 1 ); |
| 153 |
my $today = dt_from_string; |
| 154 |
my $new_debar_dt = C4::Circulation::_calculate_new_debar_dt( $patron->unblessed, $item->unblessed, $last_year, $today ); |
| 155 |
is( $new_debar_dt->truncate( to => 'day' ), |
| 156 |
$today->clone->add( days => 333 )->truncate( to => 'day' ) ); |
| 157 |
}; |
| 158 |
|
| 104 |
$schema->storage->txn_rollback; |
159 |
$schema->storage->txn_rollback; |
| 105 |
- |
|
|