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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Export full state name - not abbreviation
Pages: [1]

Author Topic: Export full state name - not abbreviation  (Read 2295 times)

vofficeware

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.92
  • PHP version: 5.2.17
Export full state name - not abbreviation
October 12, 2011, 06:59:51 am
I'm trying to export the full state name during an export.  For example, for Pennsylvania, Civi is exporting "PA".  I need this to export the full name.

Has anyone found a solution/work-around for this?

Thanks.

Tim

vofficeware

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.92
  • PHP version: 5.2.17
Re: Export full state name - not abbreviation
October 13, 2011, 08:27:22 am
bump

I've found a similar post that mentions UK states.  2 questions
1.  does anyone have a USA macro?
2.  anyone have an update on this, since the post was old?

old post: http://forum.civicrm.org/index.php?topic=1350.0

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: Export full state name - not abbreviation
October 13, 2011, 10:24:51 am

I'm pretty sure no work has been done on this in core

Would be great if your firm / client can contribute code and make it happen. seems like it does come up occassionally

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

jimurl

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: drupal 6.22
  • MySQL version: 5+
  • PHP version: 5+
Re: Export full state name - not abbreviation
November 09, 2012, 02:15:08 pm
Resurrecting this question .... because, well, it seems important. In general, the abbreviations for state/province make much less sense than the full names; e.g. for Paris, the abbr is 75 , which appears to also be a part of the postal code.

I hacked core to do this, with one very small change to CRM/Contact/BAO/Query.php around line 627 (in 4.1.5 for D6; a little earlier for 4.2.6 D7).
Code: [Select]
              if ($name == 'state_province') {
                $this->_select[$name] = "civicrm_state_province.abbreviation as `$name`, civicrm_state_province.name as state_province_name";
                $this->_element['state_province_name'] = 1;
              }

to

Code: [Select]

              if ($name == 'state_province') {
                $this->_select[$name] = "civicrm_state_province.name as `$name`, civicrm_state_province.name as state_province_name";
                $this->_element['state_province_name'] = 1;
              }

I think this is a great workaround, but terrible fix. What did I break, elsewhere? I am assuming this is used in many, many other places. Tokens and address labels would seem to be the most likely.

I have picked all through CRM/Export/BAO/Export.php looking for a better way to do this, but it appears that the abbreviation is what is returned from the query selectClause function mentioned above.

If anyone has a better suggestion on how to accomplish this, I am game to try. But I can't currently make heads or tails of what the 'right;' way to do this would be.

Aahar

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 3
  • CiviCRM version: 3.4 and 4.0
  • CMS version: Drupal 6.17, 6.x and Drupal 7.x
  • PHP version: 5.2
Re: Export full state name - not abbreviation
May 16, 2013, 03:32:06 am
Restarted it at http://forum.civicrm.org/index.php/topic,28789.0.html

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Export full state name - not abbreviation

This forum was archived on 2017-11-26.