Openbravo Issue Tracking System - POS2
View Issue Details
0057357POS2POSpublic2024-12-03 19:272024-12-12 14:24
sofidossant 
Bimla_vm 
normalminoralways
closedfixed 
5
pi 
25Q1 
No
0057357: Regular expression in CRM does not work with null
When I configure the validation in the adress name field in the CRM, and I add the validation and the regular expression ^.{0,60}$, and when I want to save an adress in null, it fails and shows me the error message.
1- Configurate in CRM, field address name, validation in Y, type:Regular Expression and regular expression validation ^.{0,60}$
2- Do the refresh in the webpos2
3 - Create a new address with null, and check the error: "name has not a valid pattern

"
Errro in the code
const regExpValidator = new Validator(
  `regExp`,
  // eslint-disable-next-line no-unused-vars
  (propertyForValidation, entityForValidation) =>
    propertyForValidation.value &&
    new RegExp(propertyForValidation.extraProperties.validationregexp).test(
      propertyForValidation.value
    )
      ? { status: VALIDATION_STATUS.OK }
      : {
          status: VALIDATION_STATUS.ERROR,
          message: getLabel('$OBC2_RegExpValidationError', [
            propertyForValidation.name
          ]),
          propertyName: propertyForValidation.name
        }
);


The if gives null and the regex
If in javascript we try:
undefined ? 1: 0, the result is 0.
So it fails even though the regex gives me ok.
No tags attached.
Issue History
2024-12-03 19:27sofidossantNew Issue
2024-12-03 19:27sofidossantAssigned To => Retail
2024-12-03 19:27sofidossantTriggers an Emergency Pack => No
2024-12-04 14:51guilleaerAssigned ToRetail => guilleaer
2024-12-04 14:51guilleaerStatusnew => acknowledged
2024-12-04 15:04Bimla_vmAssigned Toguilleaer => Bimla_vm
2024-12-04 15:04Bimla_vmStatusacknowledged => scheduled
2024-12-06 06:03hgbotNote Added: 0173030
2024-12-06 06:07hgbotNote Added: 0173031
2024-12-12 14:23hgbotResolutionopen => fixed
2024-12-12 14:23hgbotStatusscheduled => closed
2024-12-12 14:23hgbotFixed in Version => 25Q1
2024-12-12 14:23hgbotNote Added: 0173242
2024-12-12 14:23hgbotNote Added: 0173243
2024-12-12 14:24hgbotNote Added: 0173244
2024-12-12 14:24hgbotNote Added: 0173245

Notes
(0173030)
hgbot   
2024-12-06 06:03   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3211 [^]
(0173031)
hgbot   
2024-12-06 06:07   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1677 [^]
(0173242)
hgbot   
2024-12-12 14:23   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: 39a369a8f4a6ff6dd44045424e82bb7f7d4c5d88
Author: Bimla Mayavan <b.mayavan@external.orisha.com>
Date: 12-12-2024 13:23:13
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/39a369a8f4a6ff6dd44045424e82bb7f7d4c5d88 [^]

Fixed ISSUE-57357: Modified the condition of regExp validation

---
M web-jspack/org.openbravo.core2/src/core/validatorEngine/validators/regExp/regExpValidator.js
---
(0173243)
hgbot   
2024-12-12 14:23   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1677 [^]
(0173244)
hgbot   
2024-12-12 14:24   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 1af08fa3ee8afda011981e45b3b0e651b11e52d4
Author: Bimla Mayavan <b.mayavan@external.orisha.com>
Date: 12-12-2024 13:23:41
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/1af08fa3ee8afda011981e45b3b0e651b11e52d4 [^]

Related to ISSUE-57357: Handled error msg in customerFormHandlerUtils

---
M web-jspack/org.openbravo.pos2/src/components/Customer/CustomerUtils/CustomerFormHandlerUtils.js
---
(0173245)
hgbot   
2024-12-12 14:24   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3211 [^]