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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Location type via API - wishlist or other plans?
Pages: [1]

Author Topic: Location type via API - wishlist or other plans?  (Read 1504 times)

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
Location type via API - wishlist or other plans?
October 05, 2012, 02:14:39 am
It appears that the API doesn't offer a mechanism for adding or even looking up a location_type. Is this on a wishlist or roadmap somewhere, or is there a plan to convert location types to the more generic option group approach? Either way works for me... ;)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Location type via API - wishlist or other plans?
October 05, 2012, 05:40:16 am
Hi,

location_type are more complex than simple option lists (eg it defines the mapping to vcard) so I think it makes sense to keep aside and it matches how it's implemented at the DAO level too.

By creating an api/v3/LocationType.php and implementing the same functions than in Email.php for instance, you should get what you want in a few lines.

Do you think you could contribute a patch?

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
Re: Location type via API - wishlist or other plans?
October 17, 2012, 10:05:32 am
I'll certainly have a look at doing so.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Location type via API - wishlist or other plans?
October 18, 2012, 12:54:27 am
Would be really nice if you could, and I do not think it will be a massive coding effort....I'd applaud!!!! ;)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Location type via API - wishlist or other plans?
November 02, 2012, 03:03:25 am
I also had a need for this - and while I'm not much of a coder, I was inspired by Xavier's suggestion that it wouldn't be a massive effort.

I just submitted code: http://issues.civicrm.org/jira/browse/CRM-11206

Not sure about its quality (hopefully someone can give me feedback!) but it worked for me!
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Location type via API - wishlist or other plans?
November 02, 2012, 03:36:55 am
Thanks JonGold, looks fine to me (as if I can be judge  :P) and great that you are sharing this!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Location type via API - wishlist or other plans?
November 07, 2012, 11:06:42 am
Yep - looks good to me too. I'm hoping Jon will have time at the code sprint to write a unit test but will write one myself if he doesn't

Thanks Jon
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Location type via API - wishlist or other plans?
November 07, 2012, 01:58:17 pm
Eileen,

I'm going to make the change in code that you suggested in the issue's comments, and Tuesday I'll ask about writing unit tests at the CiviCRM Integrator's Day.  So I'll report back to you on the unit test issue next week.

Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Location type via API - wishlist or other plans?
November 09, 2012, 01:41:43 am
Hey Jon,

How did it go? Hope I was right and it wasn't a massive effort and thanks for your contribution. You are one bad joke away to become an official member of the Api team ;)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Location type via API - wishlist or other plans?
November 09, 2012, 07:54:53 am
I haven't cleaned up the API code yet - and the Civi integrator day is next week, not this week.  I'll be sure to say, "Xavier and Eileen want us to cover unit tests!"
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Location type via API - wishlist or other plans?
November 09, 2012, 02:32:03 pm
X & Eileen also want you to work on your bad jokes - you should be able to recycle a few if need be.

It would be nice to hear that people can get up & going fairly quickly on the tests these days- they used to be a big haul but I believe they are much better now
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Location type via API - wishlist or other plans?

This forum was archived on 2017-11-26.