Merge pull request #6458 from totten/4.6-toxic-list
[civicrm-core.git] / CRM / Contact / BAO / ContactType.php
index 9807af89a7ce2e6bca50781a67d58c93570bc0d6..75c8144ce58c0ba0598f98a2c7035c2dd910f1ed 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$
  *
  */
 class CRM_Contact_BAO_ContactType extends CRM_Contact_DAO_ContactType {
 
   /**
-   * 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.
@@ -362,7 +362,7 @@ WHERE  type.name IS NOT NULL
   }
 
   /**
-   * Get a list of elements for select box
+   * Get a list of elements for select box.
    * Note that this used to default to using the hex(01) character - which results in an invalid character being used in form fields
    * which was not handled well be anything that loaded & resaved the html (outside core)
    * The use of this separator is now explicit in the calling functions as a step towards it's removal
@@ -386,6 +386,7 @@ WHERE  type.name IS NOT NULL
 
     $argString = $all ? 'CRM_CT_GSE_1' : 'CRM_CT_GSE_0';
     $argString .= $isSeparator ? '_1' : '_0';
+    $argString .= $separator;
     if (!array_key_exists($argString, $_cache)) {
       $cache = CRM_Utils_Cache::singleton();
       $_cache[$argString] = $cache->get($argString);
@@ -444,7 +445,7 @@ AND   ( p.is_active = 1 OR p.id IS NULL )
   }
 
   /**
-   * Check if a given type is a subtype
+   * Check if a given type is a subtype.
    *
    * @param string $subType
    *   Contact subType.
@@ -534,7 +535,7 @@ WHERE  subtype.name IN ('" . implode("','", $subType) . "' )";
   }
 
   /**
-   * Create shortcuts menu for contactTypes
+   * Create shortcuts menu for contactTypes.
    *
    * @return array
    *   of contactTypes
@@ -571,7 +572,7 @@ WHERE  subtype.name IN ('" . implode("','", $subType) . "' )";
   }
 
   /**
-   * Delete Contact SubTypes
+   * Delete Contact SubTypes.
    *
    * @param int $contactTypeId
    *   ID of the Contact Subtype to be deleted.
@@ -623,7 +624,7 @@ WHERE name = %1";
   }
 
   /**
-   * Add or update Contact SubTypes
+   * Add or update Contact SubTypes.
    *
    * @param array $params
    *   An assoc array of name/value pairs.
@@ -688,7 +689,7 @@ WHERE name = %1";
   }
 
   /**
-   * Update the is_active flag in the db
+   * Update the is_active flag in the db.
    *
    * @param int $id
    *   Id of the database record.
@@ -857,7 +858,7 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
   }
 
   /**
-   * Function that does something
+   * Function that does something.
    * @todo what does this function do?
    *
    * @param int $contactID
@@ -933,9 +934,10 @@ WHERE ($subtypeClause)";
    *
    * @return void
    */
-  public function deleteCustomRowsForEntityID($customTable, $entityID) {
+  public static function deleteCustomRowsForEntityID($customTable, $entityID) {
     $customTable = CRM_Utils_Type::escape($customTable, 'String');
     $query = "DELETE FROM {$customTable} WHERE entity_id = %1";
     return CRM_Core_DAO::singleValueQuery($query, array(1 => array($entityID, 'Integer')));
   }
+
 }