Bug 10543: fix false warnings from checks of mandatory item fields
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Fri, 5 Jul 2013 13:20:59 +0000 (15:20 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 30 Jul 2013 14:43:41 +0000 (14:43 +0000)
commit651ea298ea90742a2c56bbb693a4fbbb0064d5b2
treef500e5a58877553f59a06fc2712c69c3b8867fef
parent18454bbb7d5bf6486cd7efdde11ffe0eb2cdcf52
Bug 10543: fix false warnings from checks of mandatory item fields

Under certain circumstances, when editing an item, you get a popup
warning
  "1 mandatory fields empty (highlighted)".

Even though all mandatory fields are filled in.

This occurs when there is a field with a huge content (more than 100
characters) that gets displayed in a textarea instead of input.

This patch corrects the Javascript form check by using siblings().

Also adds a more precise filter to find mandatory inputs because
looking in full page may bring unwanted results.

Test plan :
- In a framework, make sure you have in item field :
  An optional subfield (without authorised value),
  then a mandatory subfield, then an optional subfield
  next to mandatory subfield
  For example : $i (optional), $r (mandatory) and $s (optional)
- Open a biblio record and create a new item
- Enter more than 100 characters in $i, fill $r and $s
- Click "Add item"
- Edit this item
=> You get a textarea for $i
- Empty $s and Save
=> Without patch, you get a warning and form is not saved and you see that $s is yellow while it should be $r
=> With patch, form is saved
- Re-edit this item
- Empty $r and save
=> You get a warning and form is not saved

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Notes on last patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt