use Setting api and resolving conflicts with othere CMS
authormonishdeb <monish.deb@webaccessglobal.com>
Thu, 19 Feb 2015 15:37:29 +0000 (21:07 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 19 Feb 2015 15:37:29 +0000 (21:07 +0530)
install/index.php
install/template.html

index 81d3de0b119a1f7025931243bc7ef672732c4880..3d4e7c7d2ba9204effd8f08f794b83d7ecb44684 100644 (file)
@@ -1350,6 +1350,15 @@ class Installer extends InstallRequirements {
         $GLOBALS['user'] = $original_user;
         drupal_save_session(TRUE);
 
+        //change the default language to one chosen
+        if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
+          civicrm_api3('Setting', 'create', array(
+              'domain_id' => 'current_domain',
+              'lcMessages' => $config['seedLanguage'],
+            )
+          );
+        }
+
         $output .= '</ul>';
         $output .= '</div>';
         $output .= '</body>';
@@ -1417,6 +1426,9 @@ class Installer extends InstallRequirements {
           $docLinkConfig = "<a href=\"{$docLinkConfig}\">here</a>";
         }
 
+        $c = CRM_Core_Config::singleton(FALSE);
+        $c->free();
+
         $cmsURL = civicrm_cms_base();
         $cmsURL .= "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/configtask&reset=1";
         $wpPermissionsURL = "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1";
@@ -1430,21 +1442,6 @@ class Installer extends InstallRequirements {
         echo '</ul>';
         echo '</div>';
       }
-
-      //change the default language to one chosen
-      if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
-        $domainID = CRM_Core_Config::domainID();
-        $configBackend = civicrm_api3('Domain', 'getvalue', array('id' => $domainID, 'return'=> 'config_backend'));
-        $configBackend = unserialize($config_backend);
-
-        //TODO: Scope to set default attributes like for now e.g. Default Launguage
-        $configBackend['lcMessages'] = $config['seedLanguage'];
-        $result = civicrm_api3('Domain', 'setvalue', array(
-                    'id' => $domainID,
-                    'field' => 'config_backend',
-                    'value' => serialize($configBackend),
-                  ));
-      }
     }
 
     return $this->errors;
index 76364df0cc3b4e951a6da2061d5faafba051ffb0..110a30c8949c8c17d72361d2e4b366320518f47d 100644 (file)
@@ -51,7 +51,7 @@
        window.location = location;
      }
      else {
-       window.location += '?seedLanguage=' + language;
+       window.location += (location.indexOf('?') < 0 ? '?' : '&') + 'seedLanguage=' + language;
      }
   }
 </script>