Bug 21927: Acq - Add blank values in pull downs of mandatory item subfields
authorKatrin Fischer <katrin.fischer.83@web.de>
Sun, 12 Apr 2020 03:19:03 +0000 (03:19 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 27 Apr 2020 10:14:58 +0000 (11:14 +0100)
commit6f3c1d5af804e16243433b11751f9ad3677aab37
tree6925fe94e90a5aeee314ae13c6739c4b6eb60d68
parent9c39093b3d397790003f82a56ed2a506c3556cc9
Bug 21927: Acq - Add blank values in pull downs of mandatory item subfields

This is the same fix as on bug 14662, which fixed the behaviour in
cataloguing, but for the item form in acquisitions.

The code assumes that if a subfield is marked as mandatory, there
should be no empty entry in the pull downs.

This assumption is not correct, as it leads to the first entry of the
pull down being preselected if there is no default set. As the field
can never be 'unset', there will never be a 'required' warning.
Furthermore, it might be counterproductive to use mandatory fields,
as it might be easily forgotten to change the preselected value and
those mistakes will be hard to find.

Correct behaviour would be to preselect the empty value when there is
no default. This means on saving the item an error message is triggered
and the cataloger is forced to set the value.

To test:
- This is best tested with an ACQ framework, but default can be used
  when no ACQ framework was created.
- In your MARC bibliographic framework:
  - In 952 make itemtype, classification source and some other pull downs
    like location or collection mandatory and set them to visibel if needed
- Create a new basket with 'items created while ordering'
- Add a new order, an existing record with 942$c set will work best
- Add items for your order line
  - Verify that the first value of each pull down is preselected,
    there is no way to trigger the 'required' error
- Apply patch
  - Add a new order line
    - Verify that classification source is preselected according to the
      DefaultClassificationSource system preference (try unsetting it later)
    - Verify all mandatory fields can be set to empty
    - Verify that you can't save before correctly setting them
  - Change your frameworks and set a default for itemtype (Ex: BK) and
    another mandatory and non-mandatory field of your choice
  - Add a new order line and item and verify the defaults are selected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Items.pm