[Bug 29010] New: weight input pattern wrong
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Bug ID: 29010 Summary: weight input pattern wrong Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching - Elasticsearch Assignee: koha-bugs@lists.koha-community.org Reporter: domm@plix.at 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: <input type="text" inputmode="numeric" pattern="[0-9]*" name="search_field_weight" value="[% search_field.weight | html %]" /> To fix this, change the regexp in patter as follows: pattern="[0-9\.]*" I can supply a proper patch in a few minutes... -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 --- Comment #1 from Thomas Klausner <domm@plix.at> --- Created attachment 124855 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=124855&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 Sponsored-by: Steiermärkische Landesbibliothek -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Thomas Klausner <domm@plix.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff --- Comment #2 from Thomas Klausner <domm@plix.at> --- this is a rather simple bug with a rather simple fix. Still it would be nice to get it into 2021.11 :-) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Hi Thomas. A test plan would help with testing to get it to the sign-off stage. For example: Test plan: 1. What is needed to setup testing e.g. Enable Elasticsearch and reindex 2. Steps to replicate current problem 3. Apply the patch 4. Steps to demonstrate that problem is fixed 5. Sign-off! David -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 --- Comment #4 from Thomas Klausner <domm@plix.at> --- Test Plan: * 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #124855|0 |1 is obsolete| | --- Comment #5 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 126303 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=126303&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@myacpl.org> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|weight input pattern wrong |Weight input pattern wrong -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |domm@plix.at |ity.org | --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Don't forget to assign a patch to yourself using the Assignee field once you start working on a patch :) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |18316 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I was checking how we handle other decimal fields and for accounting we have: <input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" name="amount" id="amount" required="required" min="0" value="" class="noEnterSubmit"> The patch has: <input type="text" inputmode="numeric" pattern="[0-9\.]*" name="search_field_weight" value="[% search_field.weight | html %]" />
From documentation I think if we want to support decimals we should change the inputmode from numeric to decimal and maybe make the pattern a bit more specific.
For example see: https://developer.mozilla.org/de/docs/Web/HTML/Global_attributes/inputmode What do you think? Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18316 [Bug 18316] Add weighting/relevancy options to ElasticSearch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal Keywords| |rel_21_11_candidate CC| |jonathan.druart+koha@gmail. | |com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #126303|0 |1 is obsolete| | --- Comment #8 from Katrin Fischer <katrin.fischer@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@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 127882 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127882&action=edit Bug 29010: (QA follow-up) Change inputmode from numeric to decimal Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 --- Comment #10 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29010 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_11_candidate | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org