[Koha-bugs] [Bug 29010] Weight input pattern wrong

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 19 16:09:49 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010

Katrin Fischer <katrin.fischer at bsz-bw.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #126303|0                           |1
        is obsolete|                            |

--- Comment #8 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
Created attachment 127881
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127881&action=edit
Bug 29010: fix pattern in search_field.weight

search_field.weight is of type NUMERIC(5,2) in the database, and values
are rendered as floats in /admin/searchengine/elasticsearch/mappings.pl

But the field validation only accepts INTs. This patch fixes the pattern
to accept NUMERIC(ish) values

- Enable Elasticsearch (but no need to actually index anyting)
- go to cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl
- Enter an integer (eg "8") into any "weight" column and click save
- Koha now displays the value as NUMERIC, eg. "8.00"
- Change nothing, and click save again
- Save does not work, you get a warning by the browser that the input
  does not match the requested format (because in the html field only
  ints are allowed, but the DB stored the value as numeric and returns
  it as such)
- Workaround: Change all the values back to ints (i.e. remove ".00"),
  but this is very cumbersome if you have several weights

- Apply the patch
- Now try to save again (without changing eg "8.00" to "8". It works
- Add a new weight (eg "4"), save, it's turned into "4.00", but saving
  again still works

Sponsored-by: Steiermärkische Landesbibliothek

Signed-off-by: Owen Leonard <oleonard at myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83 at web.de>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list