Bug 22928 - "Update child to adult patron" link no longer displayed
Summary: "Update child to adult patron" link no longer displayed
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 20226
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-16 14:38 UTC by Jonathan Druart
Modified: 2020-01-06 20:14 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link (2.40 KB, patch)
2019-05-16 14:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22928: Add selenium tests (6.96 KB, patch)
2019-05-16 17:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link (2.45 KB, patch)
2019-05-16 18:13 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22928: Add selenium tests (7.00 KB, patch)
2019-05-16 18:14 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link (2.52 KB, patch)
2019-05-17 13:16 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 22928: Add selenium tests (7.06 KB, patch)
2019-05-17 13:16 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2019-05-16 14:38:44 UTC
Looks like it is caused by bug 20226, however I am pretty sure it works when I wrote the patch.

[% IF Categories.scalar.all(category_type => 'A').count > 0 %]

is always wrong
Comment 1 Jonathan Druart 2019-05-16 14:45:45 UTC
Created attachment 89851 [details] [review]
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link

Looks like it is caused by bug 20226, however I am pretty sure it works when I wrote the patch.

[% IF Categories.scalar.all(category_type => 'A').count > 0 %]

is always wrong.

It must be, either:
  [% IF Categories.all(category_type => 'A').size > 0 %]
or
  [% SET adult_categories = Categories.scalar.all(category_type => 'A') %]
  [% IF adult_categories.count > 0 %]

In the first case we are getting an array whereas in the later, a
Koha::Patrons which is preferable.

Test plan (from 20226):
- Remove all your adult categories (categories.category_type='A')
- Create a patron with a child category
- Try to update to adult category
=> The entry does no longer appears! (This is a change in the behaviour)
- Create one adult category
- Update to adult category
=> There is a JS confirmation message, if you accept the patron will
be updated to the adult category
- Create (at least) another adult category
- Create another child
- Update to adult category
=> No more confirmation message but a popup to select the adult category
- Pick one
=> The patron has been updated to the adult category
Comment 2 Jonathan Druart 2019-05-16 17:22:29 UTC
Created attachment 89862 [details] [review]
Bug 22928: Add selenium tests
Comment 3 Liz Rea 2019-05-16 18:13:57 UTC
Created attachment 89866 [details] [review]
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link

Looks like it is caused by bug 20226, however I am pretty sure it works when I wrote the patch.

[% IF Categories.scalar.all(category_type => 'A').count > 0 %]

is always wrong.

It must be, either:
  [% IF Categories.all(category_type => 'A').size > 0 %]
or
  [% SET adult_categories = Categories.scalar.all(category_type => 'A') %]
  [% IF adult_categories.count > 0 %]

In the first case we are getting an array whereas in the later, a
Koha::Patrons which is preferable.

Test plan (from 20226):
- Remove all your adult categories (categories.category_type='A')
- Create a patron with a child category
- Try to update to adult category
=> The entry does no longer appears! (This is a change in the behaviour)
- Create one adult category
- Update to adult category
=> There is a JS confirmation message, if you accept the patron will
be updated to the adult category
- Create (at least) another adult category
- Create another child
- Update to adult category
=> No more confirmation message but a popup to select the adult category
- Pick one
=> The patron has been updated to the adult category

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 4 Liz Rea 2019-05-16 18:14:14 UTC
Created attachment 89867 [details] [review]
Bug 22928: Add selenium tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 5 Kyle M Hall 2019-05-17 13:16:04 UTC
Created attachment 89899 [details] [review]
Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link

Looks like it is caused by bug 20226, however I am pretty sure it works when I wrote the patch.

[% IF Categories.scalar.all(category_type => 'A').count > 0 %]

is always wrong.

It must be, either:
  [% IF Categories.all(category_type => 'A').size > 0 %]
or
  [% SET adult_categories = Categories.scalar.all(category_type => 'A') %]
  [% IF adult_categories.count > 0 %]

In the first case we are getting an array whereas in the later, a
Koha::Patrons which is preferable.

Test plan (from 20226):
- Remove all your adult categories (categories.category_type='A')
- Create a patron with a child category
- Try to update to adult category
=> The entry does no longer appears! (This is a change in the behaviour)
- Create one adult category
- Update to adult category
=> There is a JS confirmation message, if you accept the patron will
be updated to the adult category
- Create (at least) another adult category
- Create another child
- Update to adult category
=> No more confirmation message but a popup to select the adult category
- Pick one
=> The patron has been updated to the adult category

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2019-05-17 13:16:13 UTC
Created attachment 89900 [details] [review]
Bug 22928: Add selenium tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Nick Clemens 2019-05-17 14:54:56 UTC
Awesome work all! 

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-05-30 19:34:57 UTC
Bug with enhancement not in 18.11.x series.