Bug 28906

Summary: Koha::Items->filter_by_visible_in_opac doesn't honour list context
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, kyle, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28883
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29844
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 26223    
Bug Blocks:    
Attachments: Bug 28906: Regression tests
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context
Bug 28906: (26223 follow-up) Remove use of as_list
Bug 28906: (26223 follow-up) Remove use of as_list
Bug 28906: Regression tests
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context
Bug 28906: (26223 follow-up) Remove use of as_list
Bug 28906: Regression tests
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context
Bug 28906: (26223 follow-up) Remove use of as_list

Description Tomás Cohen Arazi (tcohen) 2021-08-26 12:33:04 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2021-08-26 12:38:12 UTC
Created attachment 124112 [details] [review]
Bug 28906: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2021-08-26 12:38:21 UTC
Created attachment 124113 [details] [review]
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context

This patch makes the method honour list context.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail! It returns [Koha::Items]. Boo!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi (tcohen) 2021-08-26 12:44:40 UTC
Created attachment 124114 [details] [review]
Bug 28906: (26223 follow-up) Remove use of as_list

This bug makes Koha::Items->filter_by_visible_in_opac honour list
context, so this explicit call is not needed.

To test:
1. Pick a biblio in the OPAC
2. Go to the ISBD view
=> SUCCESS: It renders correctly
3. Apply this patch and restart Plack
4. Refresh the ISBD view page
=> SUCCESS: It doesn't break!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2021-08-26 12:48:25 UTC
Created attachment 124115 [details] [review]
Bug 28906: (26223 follow-up) Remove use of as_list

This bug makes Koha::Items->filter_by_visible_in_opac honour list
context, so this explicit call is not needed.

To test:
1. Pick a biblio in the OPAC
2. Go to the ISBD view
=> SUCCESS: It renders correctly
3. Apply this patch and restart Plack
4. Refresh the ISBD view page
=> SUCCESS: It doesn't break!
5. Check opac-reserve.pl doesn't break either
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 David Nind 2021-09-19 20:29:55 UTC
Created attachment 125035 [details] [review]
Bug 28906: Regression tests

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

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-09-19 20:29:59 UTC
Created attachment 125036 [details] [review]
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context

This patch makes the method honour list context.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail! It returns [Koha::Items]. Boo!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

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

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2021-09-19 20:30:05 UTC
Created attachment 125037 [details] [review]
Bug 28906: (26223 follow-up) Remove use of as_list

This bug makes Koha::Items->filter_by_visible_in_opac honour list
context, so this explicit call is not needed.

To test:
1. Pick a biblio in the OPAC
2. Go to the ISBD view
=> SUCCESS: It renders correctly
3. Apply this patch and restart Plack
4. Refresh the ISBD view page
=> SUCCESS: It doesn't break!
5. Check opac-reserve.pl doesn't break either
6. Sign off :-D

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

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Martin Renvoize (ashimema) 2021-09-24 15:12:11 UTC
Created attachment 125258 [details] [review]
Bug 28906: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize (ashimema) 2021-09-24 15:12:15 UTC
Created attachment 125259 [details] [review]
Bug 28906: Make Koha::Items->filter_by_visible_in_opac honour list context

This patch makes the method honour list context.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> FAIL: Tests fail! It returns [Koha::Items]. Boo!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize (ashimema) 2021-09-24 15:12:19 UTC
Created attachment 125260 [details] [review]
Bug 28906: (26223 follow-up) Remove use of as_list

This bug makes Koha::Items->filter_by_visible_in_opac honour list
context, so this explicit call is not needed.

To test:
1. Pick a biblio in the OPAC
2. Go to the ISBD view
=> SUCCESS: It renders correctly
3. Apply this patch and restart Plack
4. Refresh the ISBD view page
=> SUCCESS: It doesn't break!
5. Check opac-reserve.pl doesn't break either
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2021-09-24 15:12:46 UTC
All works as expected, no regressions found, QA scripts happy and tests all passing.

Passing QA
Comment 12 Jonathan Druart 2021-10-08 08:50:57 UTC
Blocked by the discussion on bug 28883.
IF we decide to remove wantarray it does not make sense to have this patch.
Comment 13 Tomás Cohen Arazi (tcohen) 2022-01-11 16:00:06 UTC
We decided to actually drop support for wantarray altogether in Koha::Objects. See bug 29844.