Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-07-06-14-41-49
[civicrm-core.git] / CRM / Core / BAO / Domain.php
index 32e2e2da570c7d81b7b2dc51d6a70c1ec69585c8..11d58a328d11d2fe5ffd080b86bdc4590c249192 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -39,7 +39,7 @@
 class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
 
   /**
-   * Cache for the current domain object
+   * Cache for the current domain object.
    */
   static $_domain = NULL;
 
@@ -49,27 +49,25 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
   private $_location = NULL;
 
   /**
-   * Fetch object based on array of properties
+   * Fetch object based on array of properties.
    *
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
    * @param array $defaults
    *   (reference ) an assoc array to hold the flattened values.
    *
-   * @return CRM_Core_DAO_Domain object
-   * @static
+   * @return CRM_Core_DAO_Domain
    */
   public static function retrieve(&$params, &$defaults) {
     return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_Domain', $params, $defaults);
   }
 
   /**
-   * Get the domain BAO
+   * Get the domain BAO.
    *
    * @param null $reset
    *
-   * @return null|object CRM_Core_BAO_Domain
-   * @static
+   * @return CRM_Core_BAO_Domain|null
    */
   public static function &getDomain($reset = NULL) {
     static $domain = NULL;
@@ -131,9 +129,7 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
   }
 
   /**
-   * Get the location values of a domain
-   *
-   * @param NULL
+   * Get the location values of a domain.
    *
    * @return array
    *   Location::getValues
@@ -154,7 +150,7 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
   }
 
   /**
-   * Save the values of a domain
+   * Save the values of a domain.
    *
    * @param array $params
    * @param int $id
@@ -171,7 +167,7 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
   }
 
   /**
-   * Create a new domain
+   * Create a new domain.
    *
    * @param array $params
    *
@@ -211,9 +207,9 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
     $fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
     if (!empty($fromEmailAddress)) {
       foreach ($fromEmailAddress as $key => $value) {
-        $email     = CRM_Utils_Mail::pluckEmailFromHeader($value);
+        $email = CRM_Utils_Mail::pluckEmailFromHeader($value);
         $fromArray = explode('"', $value);
-        $fromName  = CRM_Utils_Array::value(1, $fromArray);
+        $fromName = CRM_Utils_Array::value(1, $fromArray);
         break;
       }
       return array($fromName, $email);
@@ -275,15 +271,6 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
       $groupID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',
         $title, 'id', 'title', TRUE
       );
-      if (empty($groupID) && !empty($title)) {
-        $groupParams = array(
-          'title' => $title,
-          'is_active' => 1,
-          'no_parent' => 1,
-        );
-        $group = CRM_Contact_BAO_Group::create($groupParams);
-        $groupID = $group->id;
-      }
     }
     return $groupID ? $groupID : FALSE;
   }
@@ -335,4 +322,5 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
     }
     return $siteContacts;
   }
+
 }