Bug 19926

Summary: Add the Koha::Object->unblessed_all_relateds method
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: enhancement    
Priority: P5 - low CC: benjamin.rokseth, josef.moravec, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 17553, 19935    
Attachments: Bug 19926: Add the Koha::Object->unblessed_all_relateds method
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds
Bug 19926: Add the Koha::Object->unblessed_all_relateds method
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds
Bug 19926: Add the Koha::Object->unblessed_all_relateds method
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds

Description Jonathan Druart 2018-01-08 16:58:15 UTC
In order to refactor our legacy code step-by-step, we will need to provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to deprecate the existing syntax in order to support only one syntax. Currently we fetch all the values from the related tables, without knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds method which will return a hash containing all the fields from the related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues for instance, they are used to send notices and so we have to provide all the data needed.
Comment 1 Jonathan Druart 2018-01-08 17:00:21 UTC
Created attachment 70327 [details] [review]
Bug 19926: Add the Koha::Object->unblessed_all_relateds method

In order to refactor our legacy code step-by-step, we will need to
provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to
deprecate the existing syntax in order to support only one syntax.
Currently we fetch all the values from the related tables, without
knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds
method which will return a hash containing all the fields from the
related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues
for instance, they are used to send notices and so we have to provide
all the data needed.

See dependent bugs to understand the context and test this patch.
Comment 2 Jonathan Druart 2018-01-08 17:00:26 UTC
Created attachment 70328 [details] [review]
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds
Comment 3 Benjamin Rokseth 2018-03-13 10:11:19 UTC
Created attachment 72764 [details] [review]
Bug 19926: Add the Koha::Object->unblessed_all_relateds method

In order to refactor our legacy code step-by-step, we will need to
provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to
deprecate the existing syntax in order to support only one syntax.
Currently we fetch all the values from the related tables, without
knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds
method which will return a hash containing all the fields from the
related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues
for instance, they are used to send notices and so we have to provide
all the data needed.

See dependent bugs to understand the context and test this patch.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Comment 4 Benjamin Rokseth 2018-03-13 10:11:31 UTC
Created attachment 72765 [details] [review]
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>
Comment 5 Benjamin Rokseth 2018-03-13 10:11:56 UTC
Great work Jo!
Comment 6 Josef Moravec 2018-04-03 12:23:06 UTC
Created attachment 73552 [details] [review]
Bug 19926: Add the Koha::Object->unblessed_all_relateds method

In order to refactor our legacy code step-by-step, we will need to
provide code with the exact same behaviors and then improve it.

The same idea appears for the TT syntax for notices: we will want to
deprecate the existing syntax in order to support only one syntax.
Currently we fetch all the values from the related tables, without
knowing which are actually used.

I am suggestion to introduce a Koha::Object->unblessed_all_relateds
method which will return a hash containing all the fields from the
related tables (with the problems we know: collision in column names).
It is the existing behavior of GetOverduesForPatron and GetPendingIssues
for instance, they are used to send notices and so we have to provide
all the data needed.

See dependent bugs to understand the context and test this patch.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Josef Moravec 2018-04-03 12:23:09 UTC
Created attachment 73553 [details] [review]
Bug 19926: Add tests for Koha::Object->unblessed_all_relateds

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 8 Jonathan Druart 2018-04-03 14:49:30 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 9 Nick Clemens (kidclamp) 2018-05-14 14:36:44 UTC
Enhancement, not backporting to 17.11.x