I'd really like to use phone fields stored with addresses. But I am migrating a site from D6 -> D7 and there doesn't appear to be a way to take phone numbers in D6 CCK fields and data field addressfield_phone adds to the field_address table. It would appear that this module would need to add subfields to the table, ie, field_address:phone, field_address:phone_ext, field_address:mobile, field_address:fax, and then provide an address_phone.inc to map the subfields.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xatoo’s picture

Take a look at this patch for the Addressfield module: #2013543-2: Better Migrate support and if it works for you, please report back there.

z3cka’s picture

I could be wrong, but I think since this module statically defines a phone number, the migrate api requires that this module maintain compatibility with migrate.

That said, I applied the patch to addressfield from comment #1 and while the subfields showed up for the address, it did not pick up the phone fields from address_phone module :-(.

So, I wrote a patch! But I will have to post it after the holiday weekend. I'm not sure if it is the most optimal way to get migrate support, but it works.

z3cka’s picture

Here is the patch that adds support for using the migrate api (module) with addressfield_phone field as one of your destinations for your data.

z3cka’s picture

Here is a cleaner version of the patch from #3. The previous patch had 1 unnecessary commit.

jcisio’s picture

  1. +++ b/addressfield_phone.info
    @@ -2,6 +2,9 @@ name = Address Field Phone
    +project = addressfield_phone
    

    It is not necessary.

  2. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    $this->dependencies = array('MigrateAddressFieldHandler');
    

    Why?

  3. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    $this->registerTypes(array('addressfield'));
    

    Look like an addressfield field will always use this handler, even addressfield_phone is not configured for that field? Could you give an example?

  4. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    dpm($values);
    

    Debug left.

annya’s picture

Status: Active » Needs review
FileSize
2.11 KB

I think z3cka's patch(#4) is great. So I decided to improve it for commit.

  1. +++ b/addressfield_phone.info
    @@ -2,6 +2,9 @@ name = Address Field Phone
    +project = addressfield_phone

    It is not necessary.

    Removed

  2. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    $this->dependencies = array('MigrateAddressFieldHandler');

    Why?

    Removed

  3. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    $this->registerTypes(array('addressfield'));

    Look like an addressfield field will always use this handler, even addressfield_phone is not configured for that field? Could you give an example?

    We need to inform migrate that our subfield handle addressfield type. Without it we will have a notice that field was used as destination field mapping but is not in list of destination fields.

  4. +++ b/addressfield_phone.migrate.inc
    @@ -0,0 +1,65 @@
    +    dpm($values);

    Debug left.

    Removed

z3cka’s picture

Thanks @annya !!! I meant to come back a clean this up someday when I needed it; and now I don't have to because you fixed it!

Cheers!

jcisio’s picture

Status: Needs review » Fixed

Thanks!

  • Commit 3590881 on 7.x-1.x authored by z3cka, committed by jcisio:
    Issue #2016325 by z3cka, annya | rsbecker: Added migration capability.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.