To recreate:
1 - Assign a charge to an item type
2 - Checkout an item of that type to a patron
3 - View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
4 - Note there is no issue_id

Created attachment 74019[details][review]Bug 20562: issue_id is not stored in accountlines for rental fees
To recreate:
1 - Assign a charge to an item type
2 - Checkout an item of that type to a patron
3 - View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
4 - Note there is no issue_id
Test Plan:
1) Apply this patch
2) prove t/db_dependent/Circulation/issue.t

Created attachment 74020[details][review]Bug 20562: issue_id is not stored in accountlines for rental fees
To recreate:
1 - Assign a charge to an item type
2 - Checkout an item of that type to a patron
3 - View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
4 - Note there is no issue_id
Test Plan:
1) Apply this patch
2) prove t/db_dependent/Circulation/issue.t

Created attachment 74021[details][review]Bug 20562: issue_id is not stored in accountlines for rental fees
Test Plan:
1) Apply this patch
2) Assign a charge to an item type
3) Checkout an item of that type to a patron
4) View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
5) Note there is an issue_id
Or
1) Apply this patch
2) prove t/db_dependent/Circulation/issue.t

Created attachment 74102[details][review]Bug 20562: issue_id is not stored in accountlines for rental fees
Test Plan:
1) Apply this patch
2) Assign a charge to an item type
3) Checkout an item of that type to a patron
4) View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
5) Note there is an issue_id
Or
1) Apply this patch
2) prove t/db_dependent/Circulation/issue.t
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Created attachment 74240[details][review]Bug 20562: issue_id is not stored in accountlines for rental fees
Test Plan:
1) Apply this patch
2) Assign a charge to an item type
3) Checkout an item of that type to a patron
4) View the accountlines table for that patron
SELECT * FROM accountlines WHERE accounttype='Rent' and borrowernumber=##;
5) Note there is an issue_id
Or
1) Apply this patch
2) prove t/db_dependent/Circulation/issue.t
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Comment on attachment 74250[details][review]Bug 20562: Pass the Koha::Checkout object to AddIssuingCharge
Review of attachment 74250[details][review]:
-----------------------------------------------------------------
Reading the code - does make sense.
Testing - does work.
Thanks Jonathan!
::: C4/Circulation.pm
@@ +3174,2 @@
>
> + # FIXME What if checkout does not exist?
Then we should throw an exception. I think this will need some refactoring during the move to Koha::Objects in future.

Ah, the unit test assumed that his was implemented already! That still doesn't explain the expected behavior of the test. It seems like that particular test should expect an accountline to exist and *not* for none to exist!