Here's the initial port of this module to Drupal 7.

Previously the module introduced many field types, one for each country. My version now creates only a single field type "phone". The country setting is set globally per field instead and once the field contains some data, it cannot be changed.

I also tried to refactor a lot of repeating code into somehow leaner functions, especially various country-specific options.

What is missing (afaik):
- upgrade path from 6.x version.
- the tests were not tested yet :)

I'm posting both zipped module and a patch based on the latest HEAD version in repository.

Comments

BenK’s picture

Subscribing

jelenex’s picture

Status: Needs work » Needs review
StatusFileSize
new65.26 KB
new205.31 KB

Here's the updated version:
- added the upgrade path (for use with content_migrate module in CCK)
- automated tests now work (although not all pass, but that's another issue--like this one: #1108066: Fix phone Simpletest)
- general file cleanup & renaming

I think this version is ready for testing, so please do test & review..

descender’s picture

Subscribing.

jerrac’s picture

Nice, now, if only we could get a D7 dev branch going.

Which is to say, "Subscribing."

glottus’s picture

subscribing

luigithekid’s picture

Subscribing

narky’s picture

Yay! It's coming!

akalata’s picture

Testing #2. Receive following error when enabling the field on a content type: Notice: Undefined index: country in phone_field_settings_form() (line 96 of /.../sites/all/modules/phone/phone.module).

By default the field displays (and the area code / separator formatting options work well), but the display of this field seems to break the display of other fields, regardless of the order of display. Once I tweaked the Manage Display settings on the content type, the only available format was and I get this error: Warning: Invalid argument supplied for foreach() in field_ui_formatter_options() (line 1451 of /.../modules/field_ui/field_ui.admin.inc).

When adding the field to Views (new ui, 7.x-3.0-beta3), there are no Formatter options in the drop-down list, though the field does display correctly with the formatting defined in the field settings. (I have to resave the node after changing the display formatting, but I'm pretty sure that's just the way it works).

seandunaway’s picture

StatusFileSize
new162 bytes
new330 bytes

Re: #2 jelenex, for some reason I was unable to apply that patch to the master, or latest tag or latest branch. However, your included zip file worked great.

Re: #8 akalata, I think this patch fixes the issue. This patch applies to the module in #2.

I can reroll from master as soon as I can figure out how to apply jelenex's patch.

Please, please, please lets start a 7.x-1.x branch and get this in to simplify things.

seandunaway’s picture

StatusFileSize
new86.91 KB

Whoops, the whole module attached properly this time.

tommychris’s picture

phone.module at line 30:

      'hu' => 'Poland - mobiles only',

which should be

      'hu' => 'Hungary',
akalata’s picture

@rump, thanks, your updates fixed the formatter issue. Just got one error when adding a field:
Notice: Undefined index: country in phone_field_settings_form() (line 96 of /Users/Swan/Sites/ePC 2/sites/all/modules/phone/phone.module).

Jerome F’s picture

subscribing

rickmanelius’s picture

subscribing

seandunaway’s picture

I have some more changes but am hoping for a 7.x branch with the latest offerings that will dramatically ease all of this. Can we get a commit or is this project dead?

unegro’s picture

+1

Why the manteiner didn't release this as a dev version...

Please do this!

awolfey’s picture

Has anyone contacted Thierry? Maybe this could live in a sandbox for now.

unegro’s picture

Rumber and Jelenex,

I contacted the maintainer of the project, I am awaiting response. I suggest that you contact as well, if he did not contact, I suggest you create a new project based on phone (CCK). This was done in migration of several projects d6 => d7

awolfey’s picture

It would be best to maintain this one if it's really abandoned. Dealing with abandoned projects

jcarlson34’s picture

Great work on the initial port. It's working well for me so far.

Also, I agree with @awolfey, it'd be great if this project could be maintained.

jnettik’s picture

subscribing

seandunaway’s picture

Status: Needs review » Reviewed & tested by the community
pauleb’s picture

+1

JohnnyX’s picture

Will we get a first (dev?) release?

Some countries missing like Germany. But looks like a simple and good solution :)

cweagans’s picture

I applied to be a comaintainer of this project in another issue and I also sent a message to the current maintainer via his contact form. We'll see how it goes.

cweagans’s picture

StatusFileSize
new87.34 KB

I cleaned up the code a bit in the .module file.

It would probably be good to either a) rename the private functions to have an _ in front of them (instead of denoting that they are private functions with a comment) or b) rethink if they really need to be private or not.

seandunaway’s picture

By my guess, there are now probably 5+ forks of this module floating around... I have made a lot of changes also.

Please, someone, anyone, take over this project, so we can get a 7.x :)

Jerome F’s picture

I tested the version provided by cweagans in #26.
There's a notice when you create the field, otherwise it works all right.
Notice : Undefined index: country in phone_field_settings_form() (line 93 in .../sites/all/modules/phone/phone.module).

I tend to prefer the Phone number module in comparison, http://drupal.org/project/cck_phone
It's more flexible, because of its settings to choose which country codes to display in the select list. And you can use an extension if needed.

One thing no phone modules can handle now is the spacing between numbers, as described http://drupal.org/node/1133536 which apparently you can handle with masked input http://drupal.org/project/maskedinput but it is still not compatible with contributed fields such as Phone number, only with core fields. At least until this feature request is leading somewhere: http://drupal.org/node/1226706

IMHO the best is to merge efforts in Phone Number module and add the required formatters and perhaps provide a migration road if needed.

cweagans’s picture

I'm having some other issues with my version - the phone field is not working when applied to a user. Haven't tried it with a node yet.

What appears to be happening is that include files are not being loaded correctly.

Another improvement that I'd like to make is to turn the country code includes into CTools plugins, so that any module can provide country code plugins for phone module.

Jarviss’s picture

subscribe

jdleonard’s picture

#26 appears to be working to me. Suffices for my purposes.

jdleonard’s picture

Actually, looks like the help text for the field (defined by admin in the Field UI) isn't being displayed properly, but that shouldn't hold up this branch.

berenddeboer’s picture

StatusFileSize
new33.6 KB

Minor improvement upon #26: fix of notice, added dependency on field.

Is this module still maintained?

khanz’s picture

Above port #33 doesn't have all the countries so I chose "International Phone Numbers per E.123" as the option. But for invalid input its giving a confusing error...

"xyz" is not a valid Italian phone number
Italian phone numbers should only...

where xyz is the input by the user.

sashken2’s picture

berenddeboer, thanks! All works good for me. I'm use Russian phone number.

sashken2’s picture

It would be great if add a text field to phone number field.
For example:
+7 (343) 000-00-00 / / Support
+7 (343) 000-11-11 / / Advertising Service

as this module - http://drupal.org/project/double_field

cweagans’s picture

Title: Port to Drupal 7 » Port Phone (CCK) to D7

Changing title for clarity in dashboard.

milos.kroulik’s picture

+1

c4rl’s picture

Subscribey

barraponto’s picture

Assigned: Unassigned » barraponto
Status: Reviewed & tested by the community » Postponed

Ownership of the module is now being discussed at #1226088: Phone field/cck contrib has been abandoned in the Drupal.org Wembasters issue queue.
Meanwhile, a repository clone should be created with a branch for 7.x.
I'll get this done ASAP, and post a github link here, so we can work on the branch.

cweagans’s picture

I guess I'm the new maintainer :) I'll try to work through some of the queue tonight.

jcarlson34’s picture

Awesome news. Congrats cweagans!

seandunaway’s picture

Thank you cweagans for rising to the occasion and for saving this project from death and destruction. :)

seandunaway’s picture

Status: Postponed » Reviewed & tested by the community

Leaving this open and setting to rtbc as a placeholder until this gets worked into the new dev branch.

cweagans’s picture

Status: Reviewed & tested by the community » Fixed

Alright! Committed the latest version to Git and rolled a dev release. Should show up on the project page soon. Great work everyone :)

barraponto’s picture

Assigned: barraponto » Unassigned
DanielF’s picture

Hey, how's this coming along? I'm researching modules for storing phone numbers, and this seems to be the one everyone's excited about, but the dev tag is making me hesitant.

cweagans’s picture

I'd say use the dev version - it seems pretty stable for my uses, but I want to leave it as a dev release for a little while longer to give other users some time to open tickets against it before I roll a 1.0 release

Status: Fixed » Closed (fixed)

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