Page MenuHomeIn-Portal Phabricator
  • Changed Files
  • branches/5.2.x/core/kernel/utility/formatters/formatter.php

INP-1411 - Store empty value in form field as-as
ClosedPublic

Authored by alex on Mar 9 2015, 7:27 AM.

Details

Test Plan
NOTE: Use any section to test (I prefer In-CommerceManufacturers).
  1. identify 2 fields to be used in test:
    • null one with null default value
    • not_null one with empty string as default value

Part 1

  1. create new record with both fields filled-in > confirm that data is stored in db as-is
  2. edit record and remove value from both fields > confirm that data is stored in db as-is (before NULL was stored in null field instead of empty string)

Part 2

  1. change default field for both fields to non-empty string
  2. create record without changing default value of these fields > confirm that data is stored in db as-is
  3. edit record and remove value from both fields > confirm that data is stored in db as-is (before not null field would revert to default non-empty value)
  4. create record and immediately clear both fields > confirm that data is stored in db as-is (before not null field would revert to default non-empty value)

Part 3

  1. repeat all of above for numeric field (in previous diff there was a side effect, that empty string would be stored as 0 in numeric field instead of null)

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex updated this revision to Diff 115.Mar 9 2015, 7:27 AM
alex retitled this revision from to INP-1411 - Store empty value in form field as-as.
alex updated this object.
alex edited the test plan for this revision. (Show Details)
alex added 1 JIRA issue(s): INP-1411.
glebs accepted this revision.Mar 9 2015, 7:38 AM
glebs edited edge metadata.
This revision is now accepted and ready to land.Mar 9 2015, 7:38 AM
alex planned changes to this revision.Mar 11 2015, 12:40 PM

Turns out this have negative side effect for numeric fields, where empty string is converted to 0 in database.

alex updated this revision to Diff 118.Mar 11 2015, 12:47 PM
alex edited edge metadata.

Now numeric fields (int, float, double) won't have 0 stored in database, when an empty string value is submitted from the form.

This revision is now accepted and ready to land.Mar 11 2015, 12:47 PM
alex requested a review of this revision.Mar 11 2015, 12:47 PM
alex edited edge metadata.
alex edited the test plan for this revision. (Show Details)Mar 11 2015, 12:50 PM
alex edited edge metadata.
alex edited the test plan for this revision. (Show Details)
glebs accepted this revision.Mar 12 2015, 3:12 AM
glebs edited edge metadata.
This revision is now accepted and ready to land.Mar 12 2015, 3:12 AM
This revision was automatically updated to reflect the committed changes.
alex edited edge metadata.Mar 10 2016, 6:46 AM
alex added a project: Restricted Project.