From 6d0031673c1bbfcc799bbb35d877a1cb93b62ce5 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 22 Dec 2020 13:04:44 -0400 Subject: [PATCH] PMCORE-2577-A It is not possible to import users by searching them, using the import users button --- .../translations/english/processmaker.en.po | 6 ++ workflow/engine/data/mysql/insert.sql | 1 + .../src/components/newUserAttribute.vue | 61 ++++++++++--------- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 4ffd23094..7141d68a5 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -27677,6 +27677,12 @@ msgstr "The row '{USR_UID}' in table USER doesn't exist!" msgid "Users with role" msgstr "Users with role" +# TRANSLATION +# LABEL/ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING +#: LABEL/ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING +msgid "Please just use alphanumeric characters including: {0}" +msgstr "Please just use alphanumeric characters including: {0}" + # TRANSLATION # LABEL/ID_USE_LANGUAGE_URL #: LABEL/ID_USE_LANGUAGE_URL diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 0864cc9e0..4ef42eee3 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -61575,6 +61575,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_USER_TO_REASSIGN','en','Reassign to:','2014-01-15') , ( 'LABEL','ID_USER_UID_DOESNT_EXIST','en','The row ''{USR_UID}'' in table USER doesn''t exist!','2014-01-15') , ( 'LABEL','ID_USER_WITH_ROLE','en','Users with role','2014-01-15') , +( 'LABEL','ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING','en','Please just use alphanumeric characters including: {0}','2020-12-22') , ( 'LABEL','ID_USE_LANGUAGE_URL','en','Use the language of URL','2014-08-08') , ( 'LABEL','ID_UXS_NORMAL','en','Normal','2014-01-15') , ( 'LABEL','ID_UXS_SIMPLIFIED','en','Mobile','2014-01-15') , diff --git a/workflow/engine/methods/userExtendedAttributes/src/components/newUserAttribute.vue b/workflow/engine/methods/userExtendedAttributes/src/components/newUserAttribute.vue index b503fd466..bcb3ec711 100644 --- a/workflow/engine/methods/userExtendedAttributes/src/components/newUserAttribute.vue +++ b/workflow/engine/methods/userExtendedAttributes/src/components/newUserAttribute.vue @@ -200,40 +200,35 @@ this.statusAttributeId = null; }, onsubmit() { - this.statusName = true; - if (this.form.name.trim() === "") { - this.statusName = false; - this.statusNameMessage = this.$root.translation("ID_IS_REQUIRED"); - return; - } - this.statusAttributeId = true; - if (this.form.attributeId.trim() === "") { - this.statusAttributeId = false; - this.statusAttributeIdMessage = this.$root.translation("ID_IS_REQUIRED"); - return; - } - if (this.form.attributeId.length >= 50) { - this.statusAttributeId = false; - this.statusAttributeIdMessage = this.$root.translation("ID_INVALID_MAX_PERMITTED", [this.$root.translation('ID_ATTRIBUTE_ID'), '50']); - return; - } - if (/^[a-zA-Z][_0-9a-zA-Z]+$/.test(this.form.attributeId) === false) { - this.statusAttributeId = false; - this.statusAttributeIdMessage = this.$root.translation("ID_INVALID_DATA"); - return; - } let promise = this.validateName(); promise.then(response => { response; let promise2 = this.validateAttributeId(); promise2.then(response2 => { response2; - this.saveForm(); + if (this.statusName === true && this.statusAttributeId === true) { + this.saveForm(); + } }); }); }, validateName() { - this.statusValidation = false; + this.statusName = true; + if (this.form.name.trim() === "") { + this.statusName = false; + this.statusNameMessage = this.$root.translation("ID_IS_REQUIRED"); + return; + } + if (this.form.name.length >= 50) { + this.statusName = false; + this.statusNameMessage = this.$root.translation("ID_INVALID_MAX_PERMITTED", [this.$root.translation('ID_ATTRIBUTE_NAME'), '50']); + return; + } + if (/^[a-zA-Z][-_0-9a-zA-Z]+$/.test(this.form.name) === false) { + this.statusName = false; + this.statusNameMessage = this.$root.translation("ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING", ["- _"]); + return; + } let formData = new FormData(); formData.append("id", this.form.id); formData.append("name", this.form.name); @@ -245,7 +240,6 @@ this.statusNameMessage = response.data.message; } else { this.statusName = true; - this.statusValidation = true; } }) .catch(error => { @@ -255,10 +249,20 @@ }); }, validateAttributeId() { - this.statusValidation = false; - if (/^[a-zA-Z][_0-9a-zA-Z]+$/.test(this.form.attributeId) === false) { + this.statusAttributeId = true; + if (this.form.attributeId.trim() === "") { this.statusAttributeId = false; - this.statusAttributeIdMessage = this.$root.translation("ID_INVALID_DATA"); + this.statusAttributeIdMessage = this.$root.translation("ID_IS_REQUIRED"); + return; + } + if (this.form.attributeId.length >= 250) { + this.statusAttributeId = false; + this.statusAttributeIdMessage = this.$root.translation("ID_INVALID_MAX_PERMITTED", [this.$root.translation('ID_ATTRIBUTE_ID'), '250']); + return; + } + if (/^[a-zA-Z][-_.0-9a-zA-Z]+$/.test(this.form.attributeId) === false) { + this.statusAttributeId = false; + this.statusAttributeIdMessage = this.$root.translation("ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING", [". - _"]); return; } let formData = new FormData(); @@ -272,7 +276,6 @@ this.statusAttributeIdMessage = response.data.message; } else { this.statusAttributeId = true; - this.statusValidation = true; } }) .catch(error => {