Skip to content

Commit

Permalink
#5192-app include township in postal lookup (#1197)
Browse files Browse the repository at this point in the history
#5192-app include township in postal lookup
  • Loading branch information
metas-ts committed May 14, 2019
2 parents 2463e74 + d9fcdd7 commit b6cf428
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ else if (Check.isEmpty(filter, true))
+ "\n " + I_C_Postal.COLUMNNAME_C_Postal_ID
+ "\n, " + I_C_Postal.COLUMNNAME_Postal
+ "\n, " + I_C_Postal.COLUMNNAME_City
+ "\n, " + I_C_Postal.COLUMNNAME_Township
+ "\n, " + I_C_Postal.COLUMNNAME_C_Country_ID
+ "\n FROM " + I_C_Postal.Table_Name
+ "\n WHERE "
Expand All @@ -224,11 +225,12 @@ else if (Check.isEmpty(filter, true))
final int postalId = rs.getInt(I_C_Postal.COLUMNNAME_C_Postal_ID);
final String postal = rs.getString(I_C_Postal.COLUMNNAME_Postal);
final String city = rs.getString(I_C_Postal.COLUMNNAME_City);
final String township = rs.getString(I_C_Postal.COLUMNNAME_Township);
final int countryId = rs.getInt(I_C_Postal.COLUMNNAME_C_Country_ID);

final LookupValue countryLookupValue = countryLookup.getLookupValueById(countryId);

lookupValues.add(buildPostalLookupValue(postalId, postal, city, countryLookupValue.getDisplayNameTrl()));
lookupValues.add(buildPostalLookupValue(postalId, postal, city, township, countryLookupValue.getDisplayNameTrl()));
}

return LookupValuesList.fromCollection(lookupValues);
Expand All @@ -253,16 +255,22 @@ public IntegerLookupValue getLookupValueFromLocation(final I_C_Location location

final LookupValue countryLookupValue = countryLookup.getLookupValueById(postalRecord.getC_Country_ID());

return buildPostalLookupValue(postalRecord.getC_Postal_ID(), postalRecord.getPostal(), postalRecord.getCity(), countryLookupValue.getDisplayNameTrl());
return buildPostalLookupValue(
postalRecord.getC_Postal_ID(),
postalRecord.getPostal(),
postalRecord.getCity(),
postalRecord.getTownship(),
countryLookupValue.getDisplayNameTrl());
}

private static final IntegerLookupValue buildPostalLookupValue(
final int postalId,
final String postal,
final String city,
final String township,
final ITranslatableString countryName)
{
final ITranslatableString displayName = ITranslatableString.compose("", postal, " ", city, " (", countryName, ")");
final ITranslatableString displayName = ITranslatableString.compose("", postal, " ", city, " ", township, " (", countryName, ")");
return IntegerLookupValue.of(postalId, displayName, null/* description */);
}
}

0 comments on commit b6cf428

Please sign in to comment.