Bug 17555

Summary: Add Koha::Patron->category
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: josef.moravec, kyle, mtj, tomascohen
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:
Bug Depends on:    
Bug Blocks: 17556, 17578, 17604    
Attachments: Bug 17555: Add Koha::Patron->category
[SIGNED-OFF] Bug 17555: Add Koha::Patron->category
Bug 17555: Add Koha::Patron->category

Description Jonathan Druart 2016-11-04 15:17:07 UTC
We need to use the DBIx::Class relationship to retrieve the patron category.
It will be more convenient to have a Koha::Patron->category method to retrieve the category of a given patron.
Comment 1 Jonathan Druart 2016-11-04 15:22:03 UTC
Created attachment 57211 [details] [review]
Bug 17555: Add Koha::Patron->category

We need to use the DBIx::Class relationship to retrieve the patron
category.
It is more convenient to have a Koha::Patron->category method to
retrieve the category of a given patron.

Test plan:
Make sure that the tests in t/db_dependent/Koha/Patron* return green
Comment 2 Jonathan Druart 2016-11-04 15:22:40 UTC
(In reply to Jonathan Druart from comment #1)
> Test plan:
> Make sure that the tests in t/db_dependent/Koha/Patron* return green

Note that t/db_dependent/Koha/Patron/Messages.t is broken in master.
Comment 3 Josef Moravec 2016-11-04 19:27:59 UTC
Created attachment 57224 [details] [review]
[SIGNED-OFF] Bug 17555: Add Koha::Patron->category

We need to use the DBIx::Class relationship to retrieve the patron
category.
It is more convenient to have a Koha::Patron->category method to
retrieve the category of a given patron.

Test plan:
Make sure that the tests in t/db_dependent/Koha/Patron* return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Josef Moravec 2016-11-04 19:29:14 UTC
With combination of 1st patch from 17558 also Messages.t pass...
Comment 5 Tomás Cohen Arazi 2016-11-12 03:29:09 UTC
Why do u use Koha::Patron::Category->_new_from_dbic instead of Koha::Patron::Categories->find($self->categorycode)?
Comment 6 Jonathan Druart 2016-11-12 08:11:18 UTC
(In reply to Tomás Cohen Arazi from comment #5)
> Why do u use Koha::Patron::Category->_new_from_dbic instead of
> Koha::Patron::Categories->find($self->categorycode)?

Because we want to use the DBIx::Class relationship
Comment 7 Kyle M Hall 2016-11-15 15:13:21 UTC
Created attachment 57495 [details] [review]
Bug 17555: Add Koha::Patron->category

We need to use the DBIx::Class relationship to retrieve the patron
category.
It is more convenient to have a Koha::Patron->category method to
retrieve the category of a given patron.

Test plan:
Make sure that the tests in t/db_dependent/Koha/Patron* return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Kyle M Hall 2016-11-15 15:14:14 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 9 Mason James 2016-11-30 11:53:23 UTC
enhancement, passing for 16.05