Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,18 @@ public ContactInformationType serializeEcfContactInformation(
boolean atLeastOnePhoneAdded = false;
for (String phoneNumber : numbers) {
if (!phoneRow.matchRegex(phoneNumber)) {
if (phoneNumber.contains("-")) {
if (phoneNumber.contains("-")
|| phoneNumber.contains("(")
|| phoneNumber.contains(")")
|| phoneNumber.contains(" ")) {
// HACK(brycew): Massachusetts doesn't like dashes in the number, just numbers
phoneNumber = phoneNumber.replace("-", "").replace("(", "").replace(")", "").strip();
phoneNumber =
phoneNumber
.replace("-", "")
.replace("(", "")
.replace(")", "")
.strip()
.replace(" ", "");
}
if (!phoneRow.matchRegex(phoneNumber)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ public void shouldAllowAtLeastOnePhone() throws FilingError {
collector = new AllWrongCollector();
ContactInformation info =
new ContactInformation(
List.of("1234567890", "123-456-7890 ", "123-abc"),
List.of("1234567890", "123-456-7890 ", "123-abc", "(123) 456-7890"),
Optional.empty(),
Optional.of("bob@example.com"));
CourtLocationInfo loc = new CourtLocationInfo();
loc.code = "not_real";
EcfCourtSpecificSerializer courtSer = new EcfCourtSpecificSerializer(cd, loc);
var contactInfoType = courtSer.serializeEcfContactInformation(info, collector);
assertThat(contactInfoType.getContactMeans()).hasSize(2);
assertThat(contactInfoType.getContactMeans()).hasSize(3);
assertThat(collector.getWrong()).hasSize(0);
}

Expand Down