Bug 27544

Summary: Simplify /checkouts implementation
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, jonathan.druart, martin.renvoize
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:
21.05.00
Bug Depends on: 17005    
Bug Blocks: 27353    
Attachments: Bug 27544: Simplilfy GET /checkouts implementation
Bug 27544: Simplilfy GET /checkouts implementation
Bug 27544: Simplify GET /checkouts implementation
Bug 27544: Simplify GET /checkouts implementation

Description Tomás Cohen Arazi 2021-01-25 13:32:19 UTC
Because of the 'checked_in' parameter, the list() method got too complex. It should be just using $c->objects->search instead, after cleaning that param from the validated parameters list.
Comment 1 Tomás Cohen Arazi 2021-01-25 13:41:36 UTC
Created attachment 115770 [details] [review]
Bug 27544: Simplilfy GET /checkouts implementation

This patch makes the list() controller method simpler, by removing the
checked_in parameter, and passing the appropriate restulset.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/checkouts.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests still pass! (no behaviour change)
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Jonathan Druart 2021-01-25 13:54:39 UTC
Created attachment 115772 [details] [review]
Bug 27544: Simplilfy GET /checkouts implementation

This patch makes the list() controller method simpler, by removing the
checked_in parameter, and passing the appropriate restulset.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/checkouts.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests still pass! (no behaviour change)
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Jonathan Druart 2021-01-25 14:00:25 UTC
Created attachment 115773 [details] [review]
Bug 27544: Simplify GET /checkouts implementation

This patch makes the list() controller method simpler, by removing the
checked_in parameter, and passing the appropriate restulset.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/checkouts.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests still pass! (no behaviour change)
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Martin Renvoize 2021-01-25 14:57:38 UTC
Created attachment 115778 [details] [review]
Bug 27544: Simplify GET /checkouts implementation

This patch makes the list() controller method simpler, by removing the
checked_in parameter, and passing the appropriate restulset.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/checkouts.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests still pass! (no behaviour change)
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2021-01-25 14:58:06 UTC
Nice cleanup, works as expected.. Passing QA
Comment 6 Jonathan Druart 2021-01-28 16:35:04 UTC
Pushed to master for 21.05, thanks to everybody involved!