[Koha-bugs] [Bug 28995] Add --added_after to writeoff_debts.pl
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Jun 21 16:06:57 CEST 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28995
Caroline Cyr La Rose <caroline.cyr-la-rose at inlibro.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |caroline.cyr-la-rose at inlibr
| |o.com
--- Comment #10 from Caroline Cyr La Rose <caroline.cyr-la-rose at inlibro.com> ---
I wrote what I did as a test plan, I hope it helps
1. Add two fees in a patron account
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
1.4. Click 'Save'
1.5. Redo steps 1.2 to 1.4 to add a second fee
2. Manually change the date in the database
2.1. In the database, find the accountlines_id for the two fees
Here's what I did
select * from accountlines where borrowernumber = 21 and amountoutstanding >
0;
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
| accountlines_id | issue_id | borrowernumber | itemnumber | date
| amount | description | credit_type_code | debit_type_code | credit_number
| status | payment_type | amountoutstanding | timestamp | note |
manager_id | register_id | interface | branchcode |
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
| 652 | NULL | 21 | NULL | 2023-06-21
09:34:05 | 10.000000 | Lost item | NULL | LOST | NULL
| NULL | NULL | 10.000000 | 2023-06-21 09:34:05 |
| 51 | NULL | intranet | CPL |
| 653 | NULL | 21 | NULL | 2023-06-21
09:35:44 | 2.000000 | Lost item | NULL | LOST | NULL
| NULL | NULL | 2.000000 | 2023-06-21 09:35:44 |
| 51 | NULL | intranet | CPL |
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
2 rows in set (0.001 sec)
select * from account_offsets where debit_id = '652';
+-----+-----------+----------+--------+-----------+---------------------+
| id | credit_id | debit_id | type | amount | created_on |
+-----+-----------+----------+--------+-----------+---------------------+
| 799 | NULL | 652 | CREATE | 10.000000 | 2023-06-21 09:34:05 |
+-----+-----------+----------+--------+-----------+---------------------+
1 row in set (0.001 sec)
2.2. Update the date for one of the fees using the accountlines_id
Here's what I did
update accountlines set date = '2023-06-01 09:34:05' where accountlines_id =
652;
update account_offsets set created_on = '2023-06-01 09:34:05' where debit_id
= '652';
I now have one fee on June 1st and one fee on June 21st, the account_offset
is also modified (not sure if that last part is necessary).
select * from accountlines where borrowernumber = 21 and amountoutstanding >
0;
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
| accountlines_id | issue_id | borrowernumber | itemnumber | date
| amount | description | credit_type_code | debit_type_code | credit_number
| status | payment_type | amountoutstanding | timestamp | note |
manager_id | register_id | interface | branchcode |
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
| 652 | NULL | 21 | NULL | 2023-06-01
09:34:05 | 10.000000 | Lost item | NULL | LOST | NULL
| NULL | NULL | 10.000000 | 2023-06-21 09:40:46 |
| 51 | NULL | intranet | CPL |
| 653 | NULL | 21 | NULL | 2023-06-21
09:35:44 | 2.000000 | Lost item | NULL | LOST | NULL
| NULL | NULL | 2.000000 | 2023-06-21 09:35:44 |
| 51 | NULL | intranet | CPL |
+-----------------+----------+----------------+------------+---------------------+-----------+-------------+------------------+-----------------+---------------+--------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
2 rows in set (0.001 sec)
select * from account_offsets where debit_id = '652';
+-----+-----------+----------+--------+-----------+---------------------+
| id | credit_id | debit_id | type | amount | created_on |
+-----+-----------+----------+--------+-----------+---------------------+
| 799 | NULL | 652 | CREATE | 10.000000 | 2023-06-01 09:34:05 |
+-----+-----------+----------+--------+-----------+---------------------+
1 row in set (0.001 sec)
3. Run writeoff_debts.pl with --added_after with a date after the first fee but
before the second
3.1. In the terminal, run (for example)
./misc/cronjobs/writeoff_debts.pl --added_after 2023-06-20 --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