Skip to content

Commit

Permalink
warn if postal code does not match country
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiofbsilva committed Sep 9, 2018
1 parent 8d6fb63 commit 3f1196f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collection;
import java.util.Locale;

import org.fenixedu.PostalCodeValidator;
import org.fenixedu.academic.domain.Country;
import org.fenixedu.academic.domain.EntryPhase;
import org.fenixedu.academic.domain.ExecutionDegree;
Expand Down Expand Up @@ -417,9 +418,14 @@ public Person createPerson() {
person.setDateOfBirthYearMonthDay(getDateOfBirth());
person.setIdentificationDocumentSeriesNumber(digit);


final PhysicalAddressData data = new PhysicalAddressData(getAddress(), getAreaCode(), getAreaOfAreaCode(), null);
data.setCountryOfResidence(Country.readDefault());

if (!PostalCodeValidator.isValidAreaCode(data.getCountryOfResidence().getCode(), areaCode)) {
logger.warn("Postal code {} not valid for docId {}", areaCode, getDocumentIdNumber());
}

final PhysicalAddress createPhysicalAddress =
PhysicalAddress.createPhysicalAddress(person,
data, PartyContactType.PERSONAL, true);
Expand Down

0 comments on commit 3f1196f

Please sign in to comment.