CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Contact import choking on websites with hypen
Pages: [1]

Author Topic: Contact import choking on websites with hypen  (Read 1888 times)

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Contact import choking on websites with hypen
May 08, 2011, 02:16:39 pm
Hi, this is my first time building a site on CiviCRM and everything is going well except I'm having a heck of a time getting all my contacts imported successfully. Hopefully someone here can help me out.

I've done several tests now and keep getting stumped by this. Any contact I try to import with a website that has a hyphen in the URL gets flagged with the following error message: "Invalid value for field(s) : Website"

Unfortunately I can't provide an example because this forum doesn't allow me to post external links...  ::)

I'm running a fresh installation of CiviCRM 4.0.1

I'm assuming this is a bug that nobody has encountered before as my searches have all turned up empty. Hopefully it will get fixed in a future release... in the meantime, is there a way to bypass the validation for the website field in the import process?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contact import choking on websites with hypen
May 08, 2011, 03:40:43 pm

1. Can you reproduce this on demo and if so please file an issue

2. If you can investigate and provide a patch that would be great. most likely the validation function being called is:

CRM/Utils/Rule.php, function url

3. In the very short term, you might want to either avoid importing the website url and/or "fix" the url. Would be great if you patch the code though and hence solve the issue for u and the community :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contact import choking on websites with hypen
May 08, 2011, 04:38:57 pm
OK...

I tried reproducing on the demo site. Well, like I said, I ~tried~ on demo but the import contact tool isn't working. It doesn't seem to recognize the commas in my CSV, so it's merging all the fields into one. I'm not having that problem on my installation (with the same CSV file)... so, um, should that be logged a separate issue first?

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contact import choking on websites with hypen
May 08, 2011, 05:54:34 pm
I found the following function in Rule.php, but I must confess I don't know what to do with it...

Code: [Select]
static function url($url)
    {
        return (bool) filter_var($url, FILTER_VALIDATE_URL);
    }

Where does FILTER_VALIDATE_URL live?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contact import choking on websites with hypen
May 08, 2011, 07:53:02 pm

thats a php function, check:

http://us2.php.net/manual/en/function.filter-var.php

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contact import choking on websites with hypen
May 08, 2011, 07:55:28 pm

check:

http://bugs.php.net/bug.php?id=51258

so most likely depends on your version of PHP

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Contact import choking on websites with hypen
May 08, 2011, 11:16:47 pm
Quote from: crispinbailey on May 08, 2011, 04:38:57 pm

I tried reproducing on the demo site. Well, like I said, I ~tried~ on demo but the import contact tool isn't working. It doesn't seem to recognize the commas in my CSV, so it's merging all the fields into one.

Most probably because one did change the separator to ; or tab. That's a common issue: MS uses , or ; based on the version and language as the default separator.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contact import choking on websites with hypen
May 09, 2011, 10:37:17 am
@lobo Ahhhh... thanks, that explains it! I'm using MAMP locally and it's running PHP version 5.3.2 and this bug has apparently been fixed in 5.3.3 (and also 5.2.14 for those interested). Sigh... ok, well at least now I know what's going on and how to address it. :)

@xavier I wouldn't have thought to go and check that. Thanks!

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Contact import choking on websites with hypen
May 09, 2011, 01:10:31 pm
Just to follow up and close this off, upgrading to the latest version of MAMP (1.9.6) resolved the issue.  ;D

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Contact import choking on websites with hypen

This forum was archived on 2017-11-26.