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) »
  • Preferred Language reset after editing contact
Pages: [1]

Author Topic: Preferred Language reset after editing contact  (Read 3198 times)

thomas.feichter

  • I’m new here
  • *
  • Posts: 10
  • Karma: 1
Preferred Language reset after editing contact
August 03, 2010, 02:12:53 am
Every time a contact is edited, its "Preferred Language" is reset.
The drop down for "Preferred Language" is not preselected when clicking on edit
(http://drupal.demo.civicrm.org/civicrm/contact/add?reset=1&action=update&cid=14&context=search).
Saving the contact without selecting the preferred language again leads to loss of the "Preferred Language" setting.

Tested on my installation (Drupal with CiviCRM 3.2) as well as on drupal.demo.civicrm.org

I couldn't find a related bug report on the issue tracker.

tom

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: Preferred Language reset after editing contact
August 03, 2010, 06:18:37 am
It's a bug, thanks for reporting. Fixing it now, it'll make to 3.2.1, will post a patch here as soon as I'm done.

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!

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: Preferred Language reset after editing contact
August 03, 2010, 06:31:42 am
Bugfix checked in, it'll be released with 3.2.1. If you would like to fix it on your install right now, here's a patch:

$ svn diff -r28988:28989 CRM/Contact/Form/Edit/CommunicationPreferences.php
Index: CRM/Contact/Form/Edit/CommunicationPreferences.php
===================================================================
--- CRM/Contact/Form/Edit/CommunicationPreferences.php   (revision 28988)
+++ CRM/Contact/Form/Edit/CommunicationPreferences.php   (revision 28989)
@@ -154,6 +154,12 @@
      */
     function setDefaultValues( &$form, &$defaults )
     {
+
+        if ( ! empty( $defaults['preferred_language'] ) ) {
+            $languages = array_flip( CRM_Core_PseudoConstant::languages( ) );
+            $defaults['preferred_language'] = $languages[$defaults['preferred_language']];
+        }                                                       
+
         //set default from greeting types CRM-4575.
         $greetingTypes = array('addressee'       => 'addressee_id',
                                'email_greeting'  => 'email_greeting_id',


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!

thomas.feichter

  • I’m new here
  • *
  • Posts: 10
  • Karma: 1
Re: Preferred Language reset after editing contact
August 03, 2010, 07:16:27 pm
Thanks for the quick fix!
Already tested on my install.

thx
tom

Kampaweb

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
    • Campaignforum
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.54
  • PHP version: 5.3
Re: Preferred Language reset after editing contact
February 14, 2011, 08:06:46 am
Sorry for bringing up an old topic, but I thought this might be related?

I'm currently trying to import a "preferred language", however the imported contacts are all set to the respective default language (e.g. English US).

I have tried with all options from the language list (i.e. "French"/ "French (France) / "fr") but to no avail.

If I set the language manually for a contact before an import (let's say "Czech" for contact "Test") and import using the "update duplicates" option, the language is reset, too after the import! (i.e. it say "English US" instead of "Czech" or - as intended and specified in the import table - "French (France)".

I've tested this on my own installation (V 3.3.5) as well as on the demo.

Is this a bug (maybe similar to the one above) or do I have to specify the language differently?

Thanks for any suggestions!

Chris
We passionately provide NPOs in Switzerland, Germany and Austria with the means to campaign succesfully.

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Preferred Language reset after editing contact
June 09, 2011, 08:50:55 am
@CampaignForum did you ever figure this out? I'm having the same problem. 

Kampaweb

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
    • Campaignforum
  • CiviCRM version: 3.3.6
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.54
  • PHP version: 5.3
Re: Preferred Language reset after editing contact
June 15, 2011, 08:58:25 am
@joshstuart

Unfortunately, the answer is "no"...

For the moment we are using a workaround, which goes like this:

1. Create a custom field with multiple choice checkboxes (one for each language needed) named "language skills" (or similar)
2. Import the file with language settings linked to this custom field
3. Batch update the preferred language (or just go with your "language skills"-field, anyway)

There's several downsides to this approach, obviously (i.e. it's confusing, doesn't work very well if you have a long list of languages or many contact to batch update, as you can only update 100 a time etc.)

But I haven't come up with something better so far. Have you, maybe?

Chris
We passionately provide NPOs in Switzerland, Germany and Austria with the means to campaign succesfully.

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Preferred Language reset after editing contact
June 15, 2011, 09:24:54 am
Ugh. Your workaround is basically the system that I was trying to replace. 

We have a custom data field for "language" that was imported when we originally setup our CiviCRM install and contained legacy data from another CRM. Over time I've been trying to migrate these custom fields into core CiviCRM functionalities where I can... but I guess this one will just have to wait.

clemenbor

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 6
  • MySQL version: 5.1.48
  • PHP version: 5.2.1
Re: Preferred Language reset after editing contact
November 21, 2011, 04:40:53 am
When you want to import the "Preferred Language" you shoud use the CiviCRM language code instead (Example: English (United States) is en_US, French (France) is fr_FR). At least this worked for me.

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Preferred Language reset after editing contact
November 21, 2011, 09:43:06 am
@clemenbor - Is there a listing of the preferred language codes (I just did a quick search and didn't see anything)?

clemenbor

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 6
  • MySQL version: 5.1.48
  • PHP version: 5.2.1
Re: Preferred Language reset after editing contact
November 24, 2011, 05:02:48 am
Yes, there it is a list. You can check it on the following URL http://yourdomain.con/en/civicrm/admin/options/language . Then look for the option group called "languages" (List of Languages) and click on "Multiple Choice Options". There you´ll see all the languages availables, and when you edit one of them, the code is right there.

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Preferred Language reset after editing contact
November 25, 2011, 08:09:13 am
Spam blocker cut off your URL... I just emailed you. 

Thanks for the help.

clemenbor

  • I’m new here
  • *
  • Posts: 16
  • Karma: 1
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 6
  • MySQL version: 5.1.48
  • PHP version: 5.2.1
Re: Preferred Language reset after editing contact
November 25, 2011, 08:30:11 am
The address is your domain (where CiviCRM is installed ex: http://yourdomain.com/ ) followed by:

/civicrm/admin/options/language

 :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Preferred Language reset after editing contact

This forum was archived on 2017-11-26.