From 9bfe1b834b130a34319b0df6258386a7de83546b Mon Sep 17 00:00:00 2001 From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local> Date: Thu, 28 Mar 2019 16:51:49 +0100 Subject: [PATCH] Employee fix --- entity/Employee_entity/Employee_entity.aod | 6 +++++- .../entityfields/confirm_password/onValidation.js | 3 ++- .../Employee_entity/entityfields/password/onValidation.js | 6 ------ .../entityfields/setpassword/onActionProcess.js | 5 ++++- entity/Employee_entity/recordcontainers/jdito/onUpdate.js | 5 +++-- 5 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 entity/Employee_entity/entityfields/password/onValidation.js diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index 1ed33a9fdb4..80c05d8fb1d 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -44,7 +44,6 @@ <name>PASSWORD</name> <title>Password</title> <contentType>PASSWORD</contentType> - <onValidation>%aditoprj%/entity/Employee_entity/entityfields/password/onValidation.js</onValidation> </entityField> <entityField> <name>CONFIRM_PASSWORD</name> @@ -58,6 +57,11 @@ <title>Set Password</title> <onActionProcess>%aditoprj%/entity/Employee_entity/entityfields/setpassword/onActionProcess.js</onActionProcess> </entityActionField> + <entityParameter> + <name>passwordChange_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Employee_entity/entityfields/confirm_password/onValidation.js b/entity/Employee_entity/entityfields/confirm_password/onValidation.js index 1ade64458c9..f4f7551118f 100644 --- a/entity/Employee_entity/entityfields/confirm_password/onValidation.js +++ b/entity/Employee_entity/entityfields/confirm_password/onValidation.js @@ -1,6 +1,7 @@ import("system.translate"); import("system.result"); import("system.vars"); +import("Entity_lib"); -if (vars.get("$field.PASSWORD") != vars.get("$field.CONFIRM_PASSWORD")) +if (vars.get("$field.PASSWORD") != ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONFIRM_PASSWORD"))) result.string(translate.text("Password and confirmation must be the same!")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/password/onValidation.js b/entity/Employee_entity/entityfields/password/onValidation.js deleted file mode 100644 index 1ade64458c9..00000000000 --- a/entity/Employee_entity/entityfields/password/onValidation.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.translate"); -import("system.result"); -import("system.vars"); - -if (vars.get("$field.PASSWORD") != vars.get("$field.CONFIRM_PASSWORD")) - result.string(translate.text("Password and confirmation must be the same!")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/setpassword/onActionProcess.js b/entity/Employee_entity/entityfields/setpassword/onActionProcess.js index 72a4b78bd17..c05551ee97e 100644 --- a/entity/Employee_entity/entityfields/setpassword/onActionProcess.js +++ b/entity/Employee_entity/entityfields/setpassword/onActionProcess.js @@ -1,4 +1,7 @@ import("system.vars"); import("system.neon"); -neon.openContext("Employee", "EmployeePassword_view", [vars.get("$field.TITLE")], neon.OPERATINGSTATE_EDIT, null); \ No newline at end of file +var params = { + "passwordChange_param" : true +}; +neon.openContext("Employee", "EmployeePassword_view", [vars.get("$field.TITLE")], neon.OPERATINGSTATE_EDIT, params); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js index 2208551717d..0e94ccf1fc5 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js @@ -7,9 +7,10 @@ user.params[tools.FIRSTNAME] = vars.get("$field.FIRSTNAME"); user.params[tools.LASTNAME] = vars.get("$field.LASTNAME"); user.params[tools.EMAIL] = vars.get("$field.EMAIL_ADDRESS"); -if (vars.get("$field.PASSWORD") && vars.get("$field.PASSWORD") == vars.get("$field.CONFIRM_PASSWORD")) +if (vars.exists("$param.passwordChange_param") && vars.get("$param.passwordChange_param") + && vars.get("$field.PASSWORD") == vars.get("$field.CONFIRM_PASSWORD")) { - user[tools.PASSWORD] = vars.get("$field.PASSWORD"); + user[tools.PASSWORD] = vars.getString("$field.PASSWORD"); } tools.updateUser(user); \ No newline at end of file -- GitLab