Merge pull request #2329 from davecivicrm/CRM-13726
[civicrm-core.git] / CRM / Core / BAO / CustomGroup.php
index 83636eb6be931a874a3790a548c93166a41e2e15..a8325dc39ac629bd3171cfe283709e58fff4f17b 100644 (file)
@@ -166,7 +166,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
     $group->save();
     if (!isset($params['id'])) {
       if (!isset($params['table_name'])) {
-        $munged_title = strtolower(CRM_Utils_String::munge($group->title, '_', 32));
+        $munged_title = strtolower(CRM_Utils_String::munge($group->title, '_', 42));
         $tableName = "civicrm_value_{$munged_title}_{$group->id}";
       }
       $group->table_name = $tableName;
@@ -1992,7 +1992,17 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
 
                 if (is_object($coDAO)) {
                   while ($coDAO->fetch()) {
-                    $options[$coDAO->value] = $coDAO->label;
+                    if ($dataType == 'Country') {
+                      // NB: using ts() on a variable here is OK, since the value is pre-determined, not variable
+                      // and already extracted to .pot files.
+                      $options[$coDAO->value] = ts($coDAO->label, array('context' => 'country'));
+                    }
+                    elseif ($dataType == 'StateProvince') {
+                      $options[$coDAO->value] = ts($coDAO->label, array('context' => 'province'));
+                    }
+                    else {
+                      $options[$coDAO->value] = $coDAO->label;
+                    }
                   }
                 }