Merge pull request #4997 from monishdeb/CRM-15536
[civicrm-core.git] / CRM / Core / BAO / Location.php
index 48b425ee9baa02edfe09e3839dc6befd6d68bf81..5fa6dade98c288c796a119b24d0a98bd5a27b7d0 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        |
   +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -55,7 +55,6 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO {
    * @param null $entity
    *
    * @return array
-   * @static
    */
   public static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
     $location = array();
@@ -107,7 +106,11 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO {
     }
 
     foreach (array(
-      'phone', 'email', 'im', 'address') as $loc) {
+               'phone',
+               'email',
+               'im',
+               'address',
+             ) as $loc) {
       $locBlock["{$loc}_id"] = !empty($location["$loc"][0]) ? $location["$loc"][0]->id : NULL;
       $locBlock["{$loc}_2_id"] = !empty($location["$loc"][1]) ? $location["$loc"][1]->id : NULL;
     }
@@ -131,12 +134,11 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO {
 
   /**
    * Takes an entity array and finds the existing location block
-   * @static
    */
   public static function findExisting($entityElements) {
-    $eid    = $entityElements['entity_id'];
+    $eid = $entityElements['entity_id'];
     $etable = $entityElements['entity_table'];
-    $query  = "
+    $query = "
 SELECT e.loc_block_id as locId
 FROM {$etable} e
 WHERE e.id = %1";
@@ -157,7 +159,6 @@ WHERE e.id = %1";
    *
    * @return object
    *   CRM_Core_BAO_locBlock object on success, null otherwise
-   * @static
    */
   public static function addLocBlock(&$params) {
     $locBlock = new CRM_Core_DAO_LocBlock();
@@ -174,7 +175,6 @@ WHERE e.id = %1";
    *   Id of the Location Block.
    *
    * @return void
-   * @static
    */
   public static function deleteLocBlock($locBlockId) {
     if (!$locBlockId) {
@@ -216,8 +216,7 @@ WHERE e.id = %1";
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
    *
-   * @return boolean
-   * @static
+   * @return bool
    */
   public static function dataExists(&$params) {
     // return if no data present
@@ -238,7 +237,6 @@ WHERE e.id = %1";
    *
    * @return array
    *   array of objects(CRM_Core_BAO_Location)
-   * @static
    */
   public static function &getValues($entityBlock, $microformat = FALSE) {
     if (empty($entityBlock)) {
@@ -273,7 +271,6 @@ WHERE e.id = %1";
    *   Id of the location to delete.
    *
    * @return void
-   * @static
    */
   public static function deleteLocationBlocks($contactId, $locationTypeId) {
     // ensure that contactId has a value
@@ -330,8 +327,8 @@ WHERE e.id = %1";
     //copy all location blocks (email, phone, address, etc)
     foreach ($defaults as $key => $value) {
       if ($key != 'id') {
-        $tbl          = explode("_", $key);
-        $name         = ucfirst($tbl[0]);
+        $tbl = explode("_", $key);
+        $name = ucfirst($tbl[0]);
         $updateParams = NULL;
         if ($updateId = CRM_Utils_Array::value($key, $updateValues)) {
           $updateParams = array('id' => $updateId);
@@ -356,7 +353,6 @@ WHERE e.id = %1";
    * @param int $contactId
    *   Contact id.
    *
-   * @static
    */
   public static function checkPrimaryBlocks($contactId) {
     if (!$contactId) {
@@ -368,7 +364,12 @@ WHERE e.id = %1";
     $nonPrimaryBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($contactId, array('is_primary' => 0));
 
     foreach (array(
-      'Email', 'IM', 'Phone', 'Address', 'OpenID') as $block) {
+               'Email',
+               'IM',
+               'Phone',
+               'Address',
+               'OpenID',
+             ) as $block) {
       $name = strtolower($block);
       if (array_key_exists($name, $primaryLocBlockIds) &&
         !CRM_Utils_System::isNull($primaryLocBlockIds[$name])
@@ -421,13 +422,13 @@ WHERE e.id = %1";
 
       // Format for js
       else {
-       // Option-groups for multiple categories
+        // Option-groups for multiple categories
         if ($result && count($values) > 1) {
           $elements[] = array(
             'value' => CRM_Core_PseudoConstant::$valueType($val, FALSE),
             'children' => array(),
           );
-          $list = & $elements[count($elements) - 1]['children'];
+          $list = &$elements[count($elements) - 1]['children'];
         }
         foreach ($result as $id => $name) {
           $list[] = array(
@@ -439,4 +440,5 @@ WHERE e.id = %1";
     }
     return $elements;
   }
+
 }