Lines 2746-2752
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
2746 |
); |
2746 |
); |
2747 |
$credit->apply( { debits => [ $debts->as_list ], offset_type => 'Writeoff' } ); |
2747 |
$credit->apply( { debits => [ $debts->as_list ], offset_type => 'Writeoff' } ); |
2748 |
|
2748 |
|
2749 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); |
2749 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
2750 |
is( $credit_return_id, undef, 'No LOST_FOUND account line added' ); |
2750 |
is( $credit_return_id, undef, 'No LOST_FOUND account line added' ); |
2751 |
|
2751 |
|
2752 |
$lost_fee_line->discard_changes; # reload from DB |
2752 |
$lost_fee_line->discard_changes; # reload from DB |
Lines 2808-2814
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
2808 |
); |
2808 |
); |
2809 |
$credit->apply( { debits => [ $debts->as_list ], offset_type => 'Payment' } ); |
2809 |
$credit->apply( { debits => [ $debts->as_list ], offset_type => 'Payment' } ); |
2810 |
|
2810 |
|
2811 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); |
2811 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
2812 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2812 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2813 |
|
2813 |
|
2814 |
is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); |
2814 |
is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); |
Lines 2866-2872
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
2866 |
is( $lost_fee_line->amountoutstanding + 0, |
2866 |
is( $lost_fee_line->amountoutstanding + 0, |
2867 |
$replacement_amount, 'The right LOST amountountstanding is generated' ); |
2867 |
$replacement_amount, 'The right LOST amountountstanding is generated' ); |
2868 |
|
2868 |
|
2869 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); |
2869 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
2870 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2870 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2871 |
|
2871 |
|
2872 |
is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); |
2872 |
is( $credit_return->credit_type_code, 'LOST_FOUND', 'An account line of type LOST_FOUND is added' ); |
Lines 2952-2958
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
2952 |
$lost_fee_line->discard_changes; |
2952 |
$lost_fee_line->discard_changes; |
2953 |
my $outstanding = $lost_fee_line->amountoutstanding; |
2953 |
my $outstanding = $lost_fee_line->amountoutstanding; |
2954 |
|
2954 |
|
2955 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); |
2955 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
2956 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2956 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
2957 |
|
2957 |
|
2958 |
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PROCESSING - PAYMENT (LOST_FOUND)' ); |
2958 |
is( $account->balance, $processfee_amount - $payment_amount, 'Balance is PROCESSING - PAYMENT (LOST_FOUND)' ); |
Lines 3049-3055
subtest '_FixAccountForLostAndFound' => sub {
Link Here
|
3049 |
|
3049 |
|
3050 |
t::lib::Mocks::mock_preference( 'AccountAutoReconcile', 1 ); |
3050 |
t::lib::Mocks::mock_preference( 'AccountAutoReconcile', 1 ); |
3051 |
|
3051 |
|
3052 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber, $patron->id ); |
3052 |
my $credit_return_id = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
3053 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
3053 |
my $credit_return = Koha::Account::Lines->find($credit_return_id); |
3054 |
|
3054 |
|
3055 |
is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PROCESSING - payment (LOST_FOUND)' ); |
3055 |
is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PROCESSING - payment (LOST_FOUND)' ); |
Lines 3180-3186
subtest '_FixAccountForLostAndFound returns undef if patron is deleted' => sub {
Link Here
|
3180 |
|
3180 |
|
3181 |
$patron->delete(); |
3181 |
$patron->delete(); |
3182 |
|
3182 |
|
3183 |
my $return_value = C4::Circulation::_FixAccountForLostAndFound( $patron->id, $item->itemnumber ); |
3183 |
my $return_value = C4::Circulation::_FixAccountForLostAndFound( $item->itemnumber ); |
3184 |
|
3184 |
|
3185 |
is( $return_value, undef, "_FixAccountForLostAndFound returns undef if patron is deleted" ); |
3185 |
is( $return_value, undef, "_FixAccountForLostAndFound returns undef if patron is deleted" ); |
3186 |
|
3186 |
|
3187 |
- |
|
|