Bug 22928: (bug 20226 follow-up) Fix display of 'Update child to adult' link
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 16 May 2019 14:42:32 +0000 (09:42 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 17 May 2019 13:28:28 +0000 (13:28 +0000)
commit583fba977e18cbe4d1fad7a6609d6345095e9920
tree15471ff6626e703a03f71c4d5561ec3e90bc1430
parent2ccc5dcdf124ff8275f58826c837fc55cfd8a9a1
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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc