Browse Source

Bug 23049: Update 'PF' to 'PROCESSING' for consistency

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 3 years ago
parent
commit
11bc809228
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 2
      C4/Accounts.pm
  2. 6
      Koha/Account.pm
  3. 2
      installer/data/mysql/account_debit_types.sql
  4. 9
      installer/data/mysql/atomicupdate/bug_23049_debit.perl
  5. 2
      installer/data/mysql/en/mandatory/account_debit_types.sql
  6. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
  7. 2
      koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
  8. 42
      t/db_dependent/Accounts.t
  9. 32
      t/db_dependent/Circulation.t

2
C4/Accounts.pm

@ -108,7 +108,7 @@ sub chargelostitem {
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
type => 'processing',
type => 'PROCESSING',
item_id => $itemnumber,
issue_id => $issue_id,
}

6
Koha/Account.pm

@ -451,7 +451,7 @@ $debit_type can be any of:
- sundry
- new_card
- overdue
- processing
- PROCESSING
- RENT
- RENT_DAILY
- RENT_RENEW
@ -712,7 +712,7 @@ our $offset_type = {
'account' => 'Account Fee',
'account_renew' => 'Account Fee',
'RESERVE' => 'Reserve Fee',
'processing' => 'Processing Fee',
'PROCESSING' => 'Processing Fee',
'lost_item' => 'Lost Item',
'RENT' => 'Rental Fee',
'RENT_DAILY' => 'Rental Fee',
@ -747,7 +747,7 @@ our $account_type_debit = {
'sundry' => 'M',
'new_card' => 'N',
'overdue' => 'OVERDUE',
'processing' => 'PF',
'PROCESSING' => 'PROCESSING',
'RENT' => 'RENT',
'RENT_DAILY' => 'RENT_DAILY',
'RENT_RENEW' => 'RENT_RENEW',

2
installer/data/mysql/account_debit_types.sql

@ -6,7 +6,7 @@ INSERT INTO account_debit_types ( code, description, can_be_added_manually, defa
('M', 'Manual fee', 1, NULL, 0),
('N', 'New card fee', 1, NULL, 1),
('OVERDUE', 'Overdue fine', 0, NULL, 1),
('PF', 'Lost item processing fee', 0, NULL, 1),
('PROCESSING', 'Lost item processing fee', 0, NULL, 1),
('RENT', 'Rental fee', 0, NULL, 1),
('RENT_DAILY', 'Daily rental fee', 0, NULL, 1),
('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1),

9
installer/data/mysql/atomicupdate/bug_23049_debit.perl

@ -45,7 +45,7 @@ if ( CheckVersion($DBversion) ) {
('M', 'Manual fee', 1, NULL, 0),
('N', 'New card fee', 1, NULL, 1),
('OVERDUE', 'Overdue fine', 0, NULL, 1),
('PF', 'Lost item processing fee', 0, NULL, 1),
('PROCESSING', 'Lost item processing fee', 0, NULL, 1),
('RENT', 'Rental fee', 0, NULL, 1),
('RENT_DAILY', 'Daily rental fee', 0, NULL, 1),
('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1),
@ -61,6 +61,13 @@ if ( CheckVersion($DBversion) ) {
}
);
# Update accountype 'PF' to 'PROCESSING'
$dbh->do(
qq{
UPDATE accountlines SET accounttype = 'PROCESSING' WHERE accounttype = 'PF'
}
);
# Moving MANUAL_INV to account_debit_types
$dbh->do(
qq{

2
installer/data/mysql/en/mandatory/account_debit_types.sql

@ -6,7 +6,7 @@ INSERT INTO account_debit_types ( code, description, can_be_added_manually, defa
('M', 'Manual fee', 1, NULL, 0),
('N', 'New card fee', 1, NULL, 1),
('OVERDUE', 'Overdue fine', 0, NULL, 1),
('PF', 'Lost item processing fee', 0, NULL, 1),
('PROCESSING', 'Lost item processing fee', 0, NULL, 1),
('RENT', 'Rental fee', 0, NULL, 1),
('RENT_DAILY', 'Daily rental fee', 0, NULL, 1),
('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1),

2
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc

@ -20,7 +20,7 @@
[%- CASE 'M' -%]Sundry
[%- CASE 'N' -%]New card
[%- CASE 'OVERDUE' -%]Fine
[%- CASE 'PF' -%]Lost item processing fee
[%- CASE 'PROCESSING' -%]Lost item processing fee
[%- CASE 'RENT' -%]Rental fee
[%- CASE 'RENT_DAILY' -%]Daily rental fee
[%- CASE 'RENT_RENEW' -%]Renewal of rental item

2
koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc

@ -191,7 +191,7 @@
[%- CASE 'M' -%]Sundry
[%- CASE 'N' -%]New card
[%- CASE 'OVERDUE' -%]Fine
[%- CASE 'PF' -%]Lost item processing fee
[%- CASE 'PROCESSING' -%]Lost item processing fee
[%- CASE 'RENT' -%]Rental fee
[%- CASE 'RENT_DAILY' -%]Daily rental fee
[%- CASE 'RENT_RENEW' -%]Renewal of rental item

42
t/db_dependent/Accounts.t

@ -585,38 +585,38 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' });
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off");
ok( $procfee->amount == 8.16, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set");
ok( $procfee->amount == 8.16, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
@ -625,14 +625,14 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
ok( $procfee->amount == 2.04, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
ok( $procfee->amount == 2.04, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
@ -643,44 +643,44 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PROCESSING' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' });
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PROCESSING' });
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' });
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on");
is( $procfee->amount, "8.160000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PROCESSING' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
is( $procfee->amount, "8.160000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on");
is( $procfee->amount, "2.040000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
@ -688,20 +688,20 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set");
is( $procfee->amount, "2.040000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
my $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
ok( $lostfines->count == 1 , "Lost fine cannot be double charged for the same issue_id");
ok( $procfees->count == 1, "Processing fee cannot be double charged for the same issue_id");
MarkIssueReturned($cli_borrowernumber, $cli_itemnumber4);
$cli_issue_id_4X = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id};
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
$lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
ok( $lostfines->count == 2 , "Lost fine can be charged twice for the same item if they are distinct issue_id's");
ok( $procfees->count == 2, "Processing fee can be charged twice for the same item if they are distinct issue_id's");
$lostfines->delete();
@ -724,7 +724,7 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
is($lostfine->branchcode, $branchcode, "Lost fine branchcode set correctly");
# Processing Fee
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
ok($procfee, "Processing fee created");
is($procfee->manager_id, $staff_id, "Processing fee manager_id set correctly");
is($procfee->issue_id, $cli_issue_id_4X, "Processing fee issue_id set correctly");
@ -743,7 +743,7 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
t::lib::Mocks::mock_preference( 'FinesLog', 0 );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' );
$lostfine->delete();
$procfee->delete();
@ -751,7 +751,7 @@ subtest "C4::Accounts::chargelostitem tests" => sub {
t::lib::Mocks::mock_preference( 'FinesLog', 1 );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
$lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
$procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PROCESSING' });
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' );
$lostfine->delete();
$procfee->delete();

32
t/db_dependent/Circulation.t

@ -2124,13 +2124,13 @@ subtest '_FixAccountForLostAndReturned' => sub {
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PROCESSING' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amount is generated' );
$processfee_amount, 'The right PROCESSING amount is generated' );
is( $processing_fee_line->amountoutstanding + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
$processfee_amount, 'The right PROCESSING amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
@ -2188,13 +2188,13 @@ subtest '_FixAccountForLostAndReturned' => sub {
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PROCESSING' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amount is generated' );
$processfee_amount, 'The right PROCESSING amount is generated' );
is( $processing_fee_line->amountoutstanding + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
$processfee_amount, 'The right PROCESSING amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
@ -2258,13 +2258,13 @@ subtest '_FixAccountForLostAndReturned' => sub {
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PROCESSING' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amount is generated' );
$processfee_amount, 'The right PROCESSING amount is generated' );
is( $processing_fee_line->amountoutstanding + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
$processfee_amount, 'The right PROCESSING amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
@ -2311,13 +2311,13 @@ subtest '_FixAccountForLostAndReturned' => sub {
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PROCESSING' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amount is generated' );
$processfee_amount, 'The right PROCESSING amount is generated' );
is( $processing_fee_line->amountoutstanding + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
$processfee_amount, 'The right PROCESSING amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
{ borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
@ -2328,7 +2328,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
$replacement_amount, 'The right LOST amountountstanding is generated' );
my $account = $patron->account;
is( $account->balance, $processfee_amount + $replacement_amount, 'Balance is PF + L' );
is( $account->balance, $processfee_amount + $replacement_amount, 'Balance is PROCESSING + L' );
# Partially pay fee
my $payment_amount = 27;
@ -2363,7 +2363,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item->itemnumber, $patron->id );
my $credit_return = Koha::Account::Lines->find($credit_return_id);
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PF - payment (LOST_RETURN)' );
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PROCESSING - payment (LOST_RETURN)' );
$lost_fee_line->discard_changes;
is( $lost_fee_line->amountoutstanding + 0, 0, 'Lost fee has no outstanding amount' );
@ -2383,7 +2383,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
is( $account->balance,
$processfee_amount - $payment_amount,
'The patron balance is the difference between the PF and the credit'
'The patron balance is the difference between the PROCESSING and the credit'
);
};
@ -2459,7 +2459,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
my $credit_return_id = C4::Circulation::_FixAccountForLostAndReturned( $item_id, $patron->id );
my $credit_return = Koha::Account::Lines->find($credit_return_id);
is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (LOST_RETURN)' );
is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PROCESSING - payment (LOST_RETURN)' );
my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, debit_type_code => 'OVERDUE', status => 'UNRETURNED' })->next;
is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );

Loading…
Cancel
Save