Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0055325Openbravo ERPA. Platformpublic2024-04-25 16:372024-06-10 18:54
lorenzofidalgo 
Triage Platform Base 
normalminoralways
closedfixed 
5
 
PR24Q2PR24Q3 
approved
No
Core
No
0055325: [24Q2] Error "null value in column "name" violates not-null constraint" is shown to the user instead of being user friendly
Inside "Discounts and Promotions" window, if the backend user edits the "Name" field and inserts blanks and tries to save the record, the following non-friendly message is shown:
Saving failed. ERROR: null value in column "name" violates not-null constraint Detail: Failing row contains [...].
0-Login backoffice as Openbravo.
1-Go to "Discounts and Promotions" window.
2-Create a new record in form view with the following data:
--
Discount/Promotion Type *: Buy X pay Y of same product
Name *: Test
Starting Date: 25-04-2024
X Units: 10
Y Units: 9
--
Save the record.
3-Focus the Name input field and remove its value. Press spacebar to insert a blank. Click Save button. DEFECT: A non-friendly message is shown to the backoffice user.
No tags attached.
png NullValue.png (101,415) 2024-04-25 16:42
https://issues.openbravo.com/file_download.php?file_id=19717&type=bug
png
Issue History
2024-04-25 16:37lorenzofidalgoNew Issue
2024-04-25 16:37lorenzofidalgoAssigned To => Triage Platform Base
2024-04-25 16:37lorenzofidalgoFile Added: NullValue.png
2024-04-25 16:37lorenzofidalgoOBNetwork customer => No
2024-04-25 16:37lorenzofidalgoModules => Core
2024-04-25 16:37lorenzofidalgoTriggers an Emergency Pack => No
2024-04-25 16:38lorenzofidalgoSummaryError stating "null value in column "name" violates not-null constraint" is shown to the user instead of being user friendly => [24Q2] Error "null value in column "name" violates not-null constraint" is shown to the user instead of being user friendly
2024-04-25 16:40lorenzofidalgoDescription Updatedbug_revision_view_page.php?rev_id=27883#r27883
2024-04-25 16:42lorenzofidalgoFile Deleted: NullValue.png
2024-04-25 16:42lorenzofidalgoFile Added: NullValue.png
2024-05-06 17:10lorenzofidalgoTarget Version => PR24Q2
2024-05-08 13:56hgbotMerge Request Status => open
2024-05-08 13:56hgbotNote Added: 0164328
2024-05-08 16:07AugustoMauchStatusnew => scheduled
2024-06-10 18:54hgbotMerge Request Statusopen => approved
2024-06-10 18:54hgbotResolutionopen => fixed
2024-06-10 18:54hgbotStatusscheduled => closed
2024-06-10 18:54hgbotFixed in Version => PR24Q3
2024-06-10 18:54hgbotNote Added: 0165750
2024-06-10 18:54hgbotNote Added: 0165751

Notes
(0164328)
hgbot   
2024-05-08 13:56   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1230 [^]
(0165750)
hgbot   
2024-06-10 18:54   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 8293ace5c2e1fae2c2b54ae2f16849ec3b27c98f
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 10-06-2024 18:49:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/8293ace5c2e1fae2c2b54ae2f16849ec3b27c98f [^]

Fixes ISSUE-55325: Do not allow save if mandatory text items only contain whitespaces

- The SAVE button is disabled if any mandatory field is not filled in, see [1].
- The allRequiredFieldsSet, when checking if a text field is empty, does not consider a string formed by whitespaces only to be empty
- But in the backend, those string are actually considered empty [2], which results in being replaced by null [3]

To get rid of the discrepancy between the front and the backend about when is a string value considered empty, the front now considered empty those
string comprised only of whitespaces.

Also, updates the definition of the 'required' validator, so if the value is a string, the value will be trimmed before being validated.

[1] https://gitlab.com/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js#L58 [^]
[2] https://gitlab.com/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java#L252 [^]
[3] https://gitlab.com/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java#L640 [^]

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
M modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
---
(0165751)
hgbot   
2024-06-10 18:54   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1230 [^]