Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-02-09-11-44-07
[civicrm-core.git] / CRM / Contact / BAO / ContactType.php
index 3be98214b75fb2e6dd00c4f7673014ecf4c76db8..24b44f90930eb7188b8ef45cebb5727ea02c2d83 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -35,7 +35,7 @@
 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
@@ -373,7 +373,7 @@ WHERE  type.name IS NOT NULL
    *
    * @return mixed
    */
-  static function getSelectElements(
+  public  static function getSelectElements(
     $all = FALSE,
     $isSeparator = TRUE,
     $separator = '__'
@@ -444,13 +444,13 @@ 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.
    * @param bool $ignoreCache
    *
-   * @return boolean
+   * @return bool
    *   true if subType, false otherwise.
    */
   public static function isaSubType($subType, $ignoreCache = FALSE) {
@@ -521,7 +521,7 @@ WHERE  subtype.name IN ('" . implode("','", $subType) . "' )";
    * @param bool $ignoreCache
    * @param string $columnName
    *
-   * @return boolean
+   * @return bool
    *   true if contact extends, false otherwise.
    */
   public static function isExtendsContactType($subType, $contactType, $ignoreCache = FALSE, $columnName = 'name') {
@@ -534,7 +534,7 @@ WHERE  subtype.name IN ('" . implode("','", $subType) . "' )";
   }
 
   /**
-   * Create shortcuts menu for contactTypes
+   * Create shortcuts menu for contactTypes.
    *
    * @return array
    *   of contactTypes
@@ -571,7 +571,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,23 +623,23 @@ WHERE name = %1";
   }
 
   /**
-   * Add or update Contact SubTypes
+   * Add or update Contact SubTypes.
    *
    * @param array $params
    *   An assoc array of name/value pairs.
    *
-   * @return object
+   * @return object|void
    */
   public static function add(&$params) {
 
     // label or name
     if (empty($params['id']) && empty($params['label'])) {
-      return;
+      return NULL;
     }
     if (!empty($params['parent_id']) &&
       !CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $params['parent_id'])
     ) {
-      return;
+      return NULL;
     }
 
     $contactType = new CRM_Contact_DAO_ContactType();
@@ -688,7 +688,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.
@@ -734,7 +734,7 @@ WHERE name = %1";
    * @param string $subType
    *   Subtype.
    *
-   * @return boolean
+   * @return bool
    */
   public static function isAllowEdit($contactId, $subType = NULL) {
 
@@ -857,7 +857,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
@@ -867,7 +867,7 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
    *
    * @return bool
    */
-  static function deleteCustomSetForSubtypeMigration(
+  public  static function deleteCustomSetForSubtypeMigration(
     $contactID,
     $contactType,
     $oldSubtypeSet = array(),
@@ -938,4 +938,5 @@ WHERE ($subtypeClause)";
     $query = "DELETE FROM {$customTable} WHERE entity_id = %1";
     return CRM_Core_DAO::singleValueQuery($query, array(1 => array($entityID, 'Integer')));
   }
+
 }