X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FLocation.php;h=5fa6dade98c288c796a119b24d0a98bd5a27b7d0;hb=553ffa22464ff37a28a070458bcd52097b54235f;hp=7eb55cd0d89faa74b41fb98eb03ed78ba68eccdb;hpb=c24be2289c776d9ee74980d0db74996804bd0eff;p=civicrm-core.git diff --git a/CRM/Core/BAO/Location.php b/CRM/Core/BAO/Location.php index 7eb55cd0d8..5fa6dade98 100644 --- a/CRM/Core/BAO/Location.php +++ b/CRM/Core/BAO/Location.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -54,8 +54,7 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { * * @param null $entity * - * @return array $location - * @static + * @return array */ public static function create(&$params, $fixAddress = TRUE, $entity = NULL) { $location = array(); @@ -97,7 +96,6 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { /** * Creates the entry in the civicrm_loc_block - * */ public static function createLocBlock(&$location, &$entityElements) { $locId = self::findExisting($entityElements); @@ -108,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; } @@ -132,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"; @@ -156,8 +157,8 @@ WHERE e.id = %1"; * @param array $params * (reference ) an assoc array of name/value pairs. * - * @return object CRM_Core_BAO_locBlock object on success, null otherwise - * @static + * @return object + * CRM_Core_BAO_locBlock object on success, null otherwise */ 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 @@ -236,8 +235,8 @@ WHERE e.id = %1"; * @param $entityBlock * @param bool $microformat * - * @return array array of objects(CRM_Core_BAO_Location) - * @static + * @return array + * array of objects(CRM_Core_BAO_Location) */ public static function &getValues($entityBlock, $microformat = FALSE) { if (empty($entityBlock)) { @@ -272,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 @@ -306,7 +304,8 @@ WHERE e.id = %1"; * @param int $updateLocBlockId * Update location block id. * - * @return int newly created/updated location block id. + * @return int + * newly created/updated location block id. */ public static function copyLocBlock($locBlockId, $updateLocBlockId = NULL) { //get the location info. @@ -328,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); @@ -354,7 +353,6 @@ WHERE e.id = %1"; * @param int $contactId * Contact id. * - * @static */ public static function checkPrimaryBlocks($contactId) { if (!$contactId) { @@ -366,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]) @@ -419,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( @@ -437,4 +440,5 @@ WHERE e.id = %1"; } return $elements; } + }