ItEr38S05ValidacionEProbasFuncionaisItEr37S06: [Bug #118] Fixed. Now it only complains if there is another advance type with the same name

This commit is contained in:
Óscar González Fernández 2009-12-08 00:01:15 +01:00
parent ac1afcc555
commit 6ba095ac47
2 changed files with 4 additions and 6 deletions

View file

@ -149,9 +149,9 @@ public class AdvanceTypeCRUDController extends GenericForwardComposer {
throw new WrongValueException(comp,
_("The name is not valid, the name must not be null "));
}
if (!(advanceTypeModel.distinctNames((String) value))) {
if (!advanceTypeModel.distinctNames((String) value)) {
throw new WrongValueException(comp,
_("The name is not valid, there is another advance type with a similar name. "));
_("The name is not valid, there is another advance type with the same name. "));
}
}
};

View file

@ -136,10 +136,8 @@ public class AdvanceTypeModel implements IAdvanceTypeModel {
}
for (AdvanceType advanceType : advanceTypeDAO
.list(AdvanceType.class)) {
if ((advanceType.getId() == null)
|| (!advanceType.getId().equals(this.advanceType.getId()))
&& (advanceType.getUnitName().contains(name) || (name
.contains(advanceType.getUnitName())))) {
if (!advanceType.getId().equals(this.advanceType.getId())
&& advanceType.getUnitName().equalsIgnoreCase(name)) {
return false;
}
}