Corregido error al validar NIFs duplicados.

Formateo del NIF introducido.
This commit is contained in:
Marcos Garcia Nuñez
2019-12-30 18:47:30 +01:00
parent 893431851b
commit e3174faf34
7 changed files with 38 additions and 19 deletions

View File

@@ -213,12 +213,15 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
*/
public void handleNIFValueChange() {
boolean isDupe = false;
this.nif = ValidationUtils.normalizeNIF(this.nif);
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
isDupe = true;
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
}
PrimeFaces.current().ajax().addCallbackParam("NIFisDupe", isDupe);
PrimeFaces.current().ajax().addCallbackParam("formattedNIF", this.nif);
}
public List<FamilyDoctorTO> getFamilyDoctorList() {
@@ -318,6 +321,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
// Si no hay tipo de usuario, es que algo raro ha pasado (sesión caducada?). salimos.
if (this.userType == null)
return;
this.nif = ValidationUtils.normalizeNIF(this.nif);
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);