Bug 21999

Summary: C4::Circulation::AddIssue uses DBIx::Class directly
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Architecture, internals, and plumbingAssignee: Martin Renvoize <martin.renvoize>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: josef.moravec, nick, pierre-marc.thibault, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 21720    
Attachments: Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue
Bug 21999: Update Tests to reflect new return value of AddIssue
Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue
Bug 21999: Update Tests to reflect new return value of AddIssue
Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue
Bug 21999: Update Tests to reflect new return value of AddIssue
Bug 21999: FIXMEs are fixed!
Bug 21999: Move attributes to a variable to not dup them

Description Martin Renvoize 2018-12-14 10:17:13 UTC
This should now call Koha::Checkouts instead.
Comment 1 Martin Renvoize 2018-12-14 15:07:33 UTC
Created attachment 83215 [details] [review]
Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue
Comment 2 Martin Renvoize 2018-12-14 15:07:36 UTC
Created attachment 83216 [details] [review]
Bug 21999: Update Tests to reflect new return value of AddIssue
Comment 3 Martin Renvoize 2018-12-14 15:22:52 UTC
So.. this is a bit of a 'quick fix'.. the long term we will likely want to deprecate AddIssue and move it into Koha::*.. but, some places already expect the returned value to be a Koha::Checkout so this is the patch I've come up with.

Test plan.. the majority of places that call AddIssue do so in VOID context and so this change of return value should not affect them.  Most cases where the return value is used were in the tests and those have been updated in the second patch... that just leaves `circ/circulation.pl` where the return is passed into the template (and the Koha::Object should be seamless there).

Finally, SIP uses the returned value too but in such a way that the Koha::Checkout being returned instead is also fine (as we only ever look at the date_due field).

To Test.. apply patches.. run the full test suit and everything should pass.
Comment 4 Pierre-Marc Thibault 2018-12-14 19:43:11 UTC
Created attachment 83244 [details] [review]
Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 5 Pierre-Marc Thibault 2018-12-14 19:43:14 UTC
Created attachment 83245 [details] [review]
Bug 21999: Update Tests to reflect new return value of AddIssue

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 6 Jonathan Druart 2018-12-17 21:29:35 UTC
Created attachment 83327 [details] [review]
Bug 21999: Use Koha::Checkout in C4::Circulation::AddIssue

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2018-12-17 21:29:40 UTC
Created attachment 83328 [details] [review]
Bug 21999: Update Tests to reflect new return value of AddIssue

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2018-12-17 21:29:47 UTC
Created attachment 83329 [details] [review]
Bug 21999: FIXMEs are fixed!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2018-12-17 21:29:54 UTC
Created attachment 83330 [details] [review]
Bug 21999: Move attributes to a variable to not dup them

Avoid c/p as much as possible :)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Nick Clemens (kidclamp) 2019-01-11 13:34:32 UTC
Awesome work all!

Pushed to master for 19.05
Comment 11 Martin Renvoize 2019-01-14 14:11:59 UTC
Enhancement, will not be backported to 18.11.x series