Menu

Postal code lookup

Developers
Teo Sarca
2007-06-26
2013-03-08
  • Teo Sarca

    Teo Sarca - 2007-06-26

    Hi,

    As we know, Michael Judd added Postal code functionality to Adempiere, which is great!
    So, if you want to implement a postal code lookup for your country, you will need to extend the org.adempiere.interfaces.PostcodeLookupInterface interface and set the classname into Country window.

    It works fine, but it does just postal code to address lookup. I think it will be useful to add address to postal code functionality.

    Personally i played a little with this and i implemented this functionality by adding the following method to the PostcodeLookupInterface:
    public int lookupAddress (String addr1, String addr2, String addr3, String addr4, String region, String country);

    The VLocationDialog form remains the same, but when you hit the Online button:
    * if the postal code is not empty then will search for address (lookupPostcode)
    * if the postal code is empty then will search for postal code (lookupAddress)

    Also when there are more then one result, will popup an JOptionPane to choose the desired item.

    I would like to commit this to trunk. What you think ?

    Best regards,
    Teo Sarca

     
    • Trifon (An ADempiere founder)

      Hi Teo,

      I like it.
      Go on.

      Kind regards,
      Trifon

       
      • Michael Judd

        Michael Judd - 2007-06-26

        Teo - currently the implementation does actually look up the address - it does street1, city and region.

        The UK service implementation is done and the plugin is implemented with clients.  Due to the licensing restrictions imposed by Royal Mail, any UK implementation would be restricted from committing to the SVN.

        However, we are going to make the plugin available for download in the next few days. We also need to update the UK regions and we are awaiting clarification on this subject because unfortunately, Royal Mail does not align with the United Nations/International/British Standard 6879 Regions(Counties).  Once this is complete, we will update the regions and release the plugin.  The Plugin will be free to use and download.

        Mike

         
    • Bahman Movaqar

      Bahman Movaqar - 2007-06-26

      Hi Teo,

      Good idea! Just wanted to suggest JTable instead of JOptionPane since the number of results will be great number in case the user leaves some address fields empty and JTable helps visualising them in a better way in my humble opinion.

      My [+1] vote to commit your patch.

      Warm regards,
      Bahman

      PS: Not sure all countries support this lookup type.

       
      • Teo Sarca

        Teo Sarca - 2007-06-26

        Hi Bahman,

        > PS: Not sure all countries support this lookup type.

        Basically there is no real implementation in trunk. Just interfaces :)
        You will need to implement for your country or for your service.

        Best regards,
        Teo Sarca

         
    • Colin Rooney

      Colin Rooney - 2007-06-26

      along the same lines might it be useful to split the building number from the address.
      This is something that is country specific in address layouts, for example in Ireland we would write

      "1 Main Street"

      but in Germany

      "Haupt Strasse 1" ...

      also I know that there is software utilised by call centres (and anywhere other business scenario that requires quick a valid address entry) that will auto complete addresses based on partial info.  Again, for example, in the Netherlands a PostCode + House number is all that is required to derive a complete address... I imagine it might be the same in other countries?  While the number is embedded in the address line one it is not possible to define formatting including it or use it in autocomplete/verification.

      Colin

       
      • Michael Judd

        Michael Judd - 2007-06-26

        Colin,

        In the UK we derive the address from the post code - although this may return a number of house numbers.  You can go from the house number and the spocode to derive the street, city and region (which is what the post code plugin does).

        In the case where there are more than one house number for a post code, the user is presented with the options and then selects the correct house number and that gets copied in to street1.  The Address is formatted according to the @C@ @P@ @R@ so perhaps we could extend this to add the @S = street1 and @N = number.  However, the way we currently work, the final result is returned to the street1 and this works for us because if the post code plugin was designed for the netherlands, then the implementation would deal with this and hence we wouldn't need to change adempiere's street1.

        I hope that make sense.  In the end, all of the local formatting can be done in the plugin (as this is country specific) and hence I didn't think there was a case to change the street1 to extract the house......

        Mike

         
        • Colin Rooney

          Colin Rooney - 2007-06-27

          Yeah Mike, I probably shouldn't have posted here and confused the topic as I wasn't commenting on your enhancement per se but it just got me thinking.  I was merely suggesting that maybe we should (as another Feature Request) consider having a new house number field in the address rather than having it in "address line one", as that would allow use to use formatting (as you suggested with the @S & @N) and we could pass house number & postcode to retrieve the complete address as you again say.

          sorry if I confused matters.

          colin

           

Log in to post a comment.