Commit 2b798e3
PATCH CORE: customfields - leave never-set numeric fields unset, only clear reused widgets
et2_customfields_list.set_value() coerces missing (and falsy) stored values
to null before pushing them into the per-field child widgets. For float/int
custom fields the child is an et2-number, whose value setter runs the value
through parseFloat: parseFloat(null) parses the string "null" and yields
NaN, so the input displays the literal text "NaN" and the subsequent save
fails the pattern validation.
Per review on upstream PR EGroupware#269: don't turn "not yet set" into "set as
empty" - a pristine widget is left completely untouched on null. A plain
skip is not enough though: preview / CRM-style views reuse one widget
instance across records via set_value(), and skipping there would leave the
previous record's number displayed on a record where the field is unset.
So null is skipped only while the widget shows nothing, and clears it
otherwise.
The switch matches "number" as well, because _setup_float/_setup_int
rewrite field.type on the shared field object during row creation.
Upstream PR EGroupware#269, replacing the Et2Number-side approach of PR EGroupware#268.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 581153c)1 parent 9761eb8 commit 2b798e3
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
640 | 658 | | |
641 | 659 | | |
642 | 660 | | |
| |||
0 commit comments