[Koha-bugs] [Bug 34077] writeoff_debts without --confirm doesn't show which accountline records it would have been written off

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Dec 5 23:50:27 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34077

--- Comment #6 from David Nind <david at davidnind.com> ---
I'm now getting an error when I confirm. Am I testing this correctly?

 ./misc/cronjobs/writeoff_debts.pl --added_after 2023-12-04 --category-code PT
--confirm
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Data truncated for column 'type' at row 1 at
/kohadevbox/koha/Koha/Object.pm line 170
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Data truncated for column 'type' at row 1 at
/kohadevbox/koha/Koha/Object.pm line 170

or

./misc/cronjobs/writeoff_debts.pl --added_after 2023-12-04 --confirm
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Data truncated for column 'type' at row 1 at
/kohadevbox/koha/Koha/Object.pm line 170
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Data truncated for column 'type' at row 1 at
/kohadevbox/koha/Koha/Object.pm line 170


This is the test plan I used:

1. Add two fees in a patron account (I used Mary Burton, borrower number = 49):
   1.1. Go into a patron record > Accounting tab
   1.2. Go to the Create a manual invoice tab
   1.3. Fill out the form (use manual fee)
   1.4. Click 'Save'
   1.5. Redo steps 1.2 to 1.4 to add a second fee

2. Manually change the date for one transaction in the database:
   2.1. There should be two transactions in the accountlines and
account_offsets tables (koha-mysql kohadev + select * from accountlines; +
select * from account_offsets;)
   2.2. Update the date for one of the fees using the accountlines_id:
        update accountlines set date = '2023-06-01 09:34:05' where
accountlines_id = 1;
        update account_offsets set created_on = '2023-06-01 09:34:05' where
debit_id = '1';
   => If you look at the patron record in the staff interface, you should now
have two fees with different date: one fee on 1 June 2023 and one with today's
date (the account_offset is also modified - not sure if that last part is
necessary).

3. Run writeoff_debts.pl with various options to make sure it works as expected
(to use --added_after, the date should be after the first fee but before the
second):
   3.1. Without any options it should return the help:
./misc/cronjobs/writeoff_debts.pl
   3.2. Without --confirm and one option it should show what it would change:
./misc/cronjobs/writeoff_debts.pl --added_after 2023-12-04 
      ==> With --confirm we would write off 1 debts added after 2023-12-04
          Accountline 2 will be written of
   3.3. Without --confirm and with two or more options - it should show what it
would change: ./misc/cronjobs/writeoff_debts.pl --added-after 2023-06-20
--category-code PT
      ==> With --confirm we would write off 1 debts of type MANUAL added after
2023-06-20
          Accountline 2 will be written off
   3.4. With --confirm it should correctly write off one amount:
./misc/cronjobs/writeoff_debts.pl --added_after 2023-12-04 --confirm

4. Check the patron record
   ==> The fee with the date after should be written off

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list