Future addresses (beta extension)

Published
2014-05-08 07:35
Written by

One of the requirements in a project I am working at the moment was that the client wanted to enter when an adress becomes active. E.g. a member says he is moving by the 1st July 2015 (which is in the future). From that moment the member should be contacted by that address and till that moment the old address is the active address.

I have created an extension which achieve this. This extension is in beta and can be found on (https://github.com/CiviCooP/org.civicoop.futureaddress).

I will put this extension into the extension directory later on, when my client has finished testing this extension.

How does this extension work?

As a user you enter a future address by adding a new address on a contact and you set two things:

  1. You enter a location type which is a future one
  2. You enter a change date (the date when this address is changed)

This extension checks daily for any addresses with a location type in the future (see later on what this is). And it will then check the date for the change of this address and if the date has passed then the old address is archived (see later on what I mean by this) and the future address will be changed from the future location type to the current location type.

Future location types

Future location types are location types with a name which starts with "new_" followed by the name of the location type in which this changes. E.g. for a future home address you enter the name new_Home the display name of the location type could be something which explains it to your user. In this case it could be something like Future home address.

Archived addresses 

An acrhived addresses is saved as a Address Change activity at the moment the address is changed. This way you can find back the old address information in your system. For developers you can disable or change this behaviour quite easily, see herefore the documentation at github.

Setup

The only thing you have to do is to set up location types for future addresses. E.g. create a new location type for a future billing address with the name new_Billing.

Comments

Anonymous (not verified)
2014-05-08 - 15:09

Have you thought about extending this to allow for Previous Adresses? Basically each address will have a start and end date -- once the end date is past then the address gets moved to Location Type "Previous Adress" and there can be  multiple "Previous Address" that can be viewed with the dates they were valid. The extension could keep them from being displayed on the contact summary but have a link to display previous addresses in a popup.

 

I haven't found a solution for adding an end date on an address. One of the things my client was is temporarily addresses. So that an address is active for a certain period of time and after that moving back to the original address. 

About the location type previous addresses. That sounds a good solution and my extension has hooks so as a developer you can add/change behaviour of this extension. So if you want the previous addresses stored on your contact card, rather than as an activity feel free to implement this in your own extension using hooks from this extension. On github there is documentation for achieving this kind of things. But there is one draw back and that is civi. Civi will only allow you to store one address per location type per contact. So multiple previous addresses aren't going to work. What might work is that you store the previous addresses in a seperate database table and you provide a page which shows those previous addresses and a link to this page on the contact summary.

Anonymous (not verified)
2014-05-10 - 19:03

I wish I was a developer. I'm not skilled enough to do that.

My opinion is that is one feature civi is lacking is the ability to mark an address as having ended and it becomes inactive/previous.

Very much like how Relationships work.

And that is exactly what this extension is doing. The only draw back is that inactive addresses from the past are saved into a seperate activity.

For past addresses being able to have an appropriate view on the logging table (if logging is on) might work. We used to create custom field records when addresses were updated - not sure if we have sites still doing this - if so it hasn't broken for a while :-)

Anonymous (not verified)
2014-05-13 - 12:37

My first read through this I was understanding it differently. After I read it again I see that it is doing what I'm wanting except that it is moving them to an activity. I can live with that. I Installed the extension and noticed that on the contact edit screen next to the date it has the word Ingangsdatum. I assume that's hard coded into the extension. MIght want to translate that to english.