Bug 18680: Add an empty entry by default to sort1/sort2 values in patron account
authorKatrin Fischer <katrin.fischer.83@web.de>
Tue, 14 Apr 2020 16:57:38 +0000 (16:57 +0000)
committerJoy Nelson <joy@bywatersolutions.com>
Thu, 7 May 2020 21:29:50 +0000 (21:29 +0000)
commita934499b8cc192781f263b0ba2b3edd5374e64cf
treec90cd8e822462cf3fa3e56d20891d1736de2441a
parent6d02cbad0b8f64293ceae4a3cc2640a149a2756a
Bug 18680: Add an empty entry by default to sort1/sort2 values in patron account

When using sort1/sort2 with authorised values to create a pull down
list, there will be no empty entry unless one is manually added to
the authorised values list.

This is not a good default behaviour, as it can easily
cause errors on patron creation. Without the empty entry, the first
alphabetic value is pre-selected and will be saved if not explicitly
changed. It also doesn't allow to mark sort1/sort2 as mandatory,
as the value is always 'set', the required message won't be triggered.

This adds an empty parameter to av-build-dropbox.inc to allow selectively
adding this empty entry without causing side-effects in other places
this include is used.

To test:
- Create authorised values for either Bsort1 or Bsort2 authorised
  value category
- Create a new patron:
  - you should see a pull down list on one and an input field for the other
  - for the pull down list, there will be no empty entry and the first
    alphabetic value will be preselected
- Make your sort1 and sort2 mandatory using BorrowerMandatoryField
- Verify there is still on empty entry
- Apply patch
- Repeat tests and verify that the behaviour is as expected
  - There should now be an empty entry
  - When the field is marked mandatory and empty is left, the required
    warning will be shown.

Signed-off-by: David Roberts <david@koha-ptfs.co.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt