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 (Moderator: Donald Lobo) »
  • Adding geo_code_level
Pages: [1]

Author Topic: Adding geo_code_level  (Read 754 times)

sdague

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 6
  • MySQL version: 5.1.58
  • PHP version: 5.3
Adding geo_code_level
February 26, 2012, 04:02:07 pm
I'm attempting to add another field to addresses called geo_code_level, which will let you specify what level of address will be geo coded. It goes more or less as ADDRESS -> CITY -> STATE -> COUNTRY -> NONE. There will also be a global level that can be set, which will let you limit globally, in case just CITY level is more appropriate for your members based on privacy. The back end logic for this isn't really an issue, but I'm running into issues understanding how to get a new database field (which I created manually) exposed on the Address panel.

I've found templates/CRM/Contact/Form/Edit/Address/geo_code.tpl, but I'm not grasping how $form.address.$blockId.geo_code_1.label get's filled in, or where the .html gets generated. Can someone point me at that? I assume adding this field would be like the existing geo_code fields? Help would be appreciated, either here, or on irc. Thanks

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Adding geo_code_level
February 26, 2012, 11:48:37 pm
Hi,

Might have missed earlier discussion, but is the idea to add this feature to the core or hack it on your install?

If the first, could you describe what's the goal, not sure I understood. Do you want to do that per address or a global setting?

If the second, I'd suggest to use hooks and custom module instead of hacking the core, will make upgrading much easier.

http://book.civicrm.org/developer/techniques/hooks

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

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: Adding geo_code_level
February 26, 2012, 11:58:22 pm

hey sdague:

1. U'll need to add the DB field in the xml (which is only present in an svn install)

http://wiki.civicrm.org/confluence/display/CRMDOC41/Installing+CiviCRM+from+subversion+(SVN)+repository

2. Once u do so, u can rebuild the schema (by running GenCode.php) and also ensure you fix the upgrade script to add that field

3. most of the address related stuff is at:

CRM/Core/BAO/Address.php
CRM/Contact/Form/Edit/Address.php

4. The html is generated by the form layer (combination of smarty and quickform)

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

sdague

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 6
  • MySQL version: 5.1.58
  • PHP version: 5.3
Re: Adding geo_code_level
March 17, 2012, 12:58:02 pm
I'm clearly missing something. The database field is added via the Schema.xml, and I rebuilt my dev environment. I attempted to add fields in the same places that the geo_code_1 and geo_code_2 existed, but I don't get anything in the edit form.

The magic I think I'm most missing is what is actually called when the .html magic happens in patch 0003 (CRM/Contact/Form/Edit/Address/geo_code.tpl). As right now the calls for geo_code_level generate nothing. Even if I could get something like the geo_code_1 geo_code_2 to get started, I might be able to progress from there.

Thanks in advance.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding geo_code_level

This forum was archived on 2017-11-26.