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 CiviEvent (Moderator: Yashodha Chaku) »
  • Importing Events with Addresses
Pages: [1]

Author Topic: Importing Events with Addresses  (Read 1419 times)

FredJones

  • Guest
Importing Events with Addresses
June 23, 2008, 02:24:36 pm
I have an XLS file of events which I turned into a MySQL table. I need to import these into CiviCRM. I therefore made a Drupal module which runs through each events and imports it.

All of the fields I have determined how to import--for some I use the V2 API (CiviCRM 2.0.4) and then for the custom fields I use CRM_Core_DAO::executeQuery to run a simple SQL query to update the field in the custom data table. This part works fine.

The only other data I need to import is the location of the events. It seems that when I make a new event with a simple location (I only need to store one little "Street Address" field for location and that's it) a record is made in civicrm_address and then a record in civicrm_loc_block (linked to the civicrm_address record) and then the record in civicrm_event is linked to the record in civicrm_loc_block. From what I see, that's it. At least for a simple location.

My questions:

1. Is this correct? :)
2. If I have repeated locations should I reuse the existing record in civicrm_address and make a new civicrm_loc_block record or just reuse the existing civicrm_loc_block record and have multiple events linked to it? The location is indeed physically the same place. :)

Seems that the difference regarding the two options of my 2. above would be with regard to changing / adding fields like email or phone.

Thank you

Michał Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: Importing Events with Addresses
June 30, 2008, 07:08:39 am
Hey,

Ad 1. Yes, that's how we store location for the event. :-)

Ad 2. We currently do not support single location per multiple events - therefore some of consequences of excercising your approach might be unpredictable. I didn't test it in practice, so I might be wrong, but here's what might happen: if you delete an event which has the same loc_block record as others, it will trigger removing the loc_block itself, and than, through foreign key reference, all your events referring to this loc_block will be gone as well.

So in general, I would propose creating separate loc_block (and civicrm_address) records for each event.

Thx,
m
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

FredJones

  • Guest
Re: Importing Events with Addresses
June 30, 2008, 09:42:39 am
Thank you.

marqpdx

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 2
Re: Importing Events with Addresses
February 21, 2009, 04:32:50 pm
Hi, i'm doing just this, importing events with locations.

my thinking was to:
1. use the location api to create an address record
2. then manually create the loc_block record.
3. then create the event record, using the event API...

that's what i understood from the above comments.

problem with this is, the location API seems to want to require a contact_id, even though a number of addresses in the address table have contact_id = NULL. i tried passing NULL into the event API, but get a contact_id required error.

please advise, if possible!
thanks,
m

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: Importing Events with Addresses
February 21, 2009, 05:19:21 pm

for now, i would manually create the address record. You should also file an issue that will permit folks to create an address/email/im record without a contact id. We'll fix this for a future release of 2.2

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Importing Events with Addresses

This forum was archived on 2017-11-26.