CRM-13823 find status preference by name/domain combo
authorAndrew Hunt <andrew@aghstrategies.com>
Sun, 26 Apr 2015 22:19:20 +0000 (18:19 -0400)
committerJon goldberg <jon@palantetech.coop>
Tue, 21 Jul 2015 20:37:37 +0000 (16:37 -0400)
----------------------------------------
* CRM-13823: Admin Status Page
  https://issues.civicrm.org/jira/browse/CRM-13823

CRM/Core/BAO/StatusPreference.php
CRM/Utils/Check/Env.php

index 6173463fa3b4d23f86f7f717422d2068da46c279..09cf4abd7f3cc3dc396d23d7f41f64d8bbec6ae1 100644 (file)
@@ -47,8 +47,14 @@ class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference {
    */
   public static function create($params) {
     $statusPreference = new CRM_Core_DAO_StatusPreference();
-    if (array_key_exists("domain_id", $params) === FALSE) {
-      $params["domain_id"] = CRM_Core_Config::domainID();
+
+    if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) {
+      $searchParams = array(
+        'domain_id' => CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID()),
+        'name' => $params['name'],
+      );
+
+      $statusPreference->find(TRUE);
     }
 
     $statusPreference->copyValues($params);
index 24e63310523afa0be51f3afbf3c44f546af9f8cb..4e82f05f8d19e3390d2bf0677ebc46af9415ee85 100644 (file)
@@ -147,12 +147,15 @@ class CRM_Utils_Check_Env {
       $msg = ts("Please enter your organization's <a href=\"%1\">name and primary address</a>.",
         array(1 => $fixEmailUrl));
     }
-    $messages[] = new CRM_Utils_Check_Message(
-      'checkDomainNameEmail',
-      $msg,
-      ts('Complete Setup'),
-      \Psr\Log\LogLevel::WARNING
-    );
+
+    if (!empty($msg)) {
+      $messages[] = new CRM_Utils_Check_Message(
+        'checkDomainNameEmail',
+        $msg,
+        ts('Complete Setup'),
+        \Psr\Log\LogLevel::WARNING
+      );
+    }
 
     return $messages;
   }