<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * This class handle creation of location block elements
+ * This class handle creation of location block elements.
*/
class CRM_Core_BAO_Location extends CRM_Core_DAO {
}
/**
- * Get the ID of the database billing location.
+ * Creates the entry in the civicrm_loc_block.
*
- * @return int
- * Billing location type id.
+ * @param string $location
+ * @param array $entityElements
*
- * @throws \CRM_Core_Exception
- */
- public static function getBillingLocationId() {
- static $billingTypeID = NULL;
- if ($billingTypeID) {
- return $billingTypeID;
- }
- $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
- $billingTypeID = array_search('Billing', $locationTypes);
- if (!$billingTypeID) {
- throw new CRM_Core_Exception(ts('Please set a location type of %1', array(1 => 'Billing')));
- }
- return $billingTypeID;
- }
- /**
- * Creates the entry in the civicrm_loc_block.
+ * @return int
*/
public static function createLocBlock(&$location, &$entityElements) {
$locId = self::findExisting($entityElements);
/**
* Takes an entity array and finds the existing location block.
+ *
+ * @param array $entityElements
+ *
+ * @return int
*/
public static function findExisting($entityElements) {
$eid = $entityElements['entity_id'];
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return object
- * CRM_Core_BAO_locBlock object on success, null otherwise
+ * @return CRM_Core_BAO_locBlock
+ * Object on success, null otherwise
*/
public static function addLocBlock(&$params) {
$locBlock = new CRM_Core_DAO_LocBlock();
*
* @param int $locBlockId
* Id of the Location Block.
- *
- * @return void
*/
public static function deleteLocBlock($locBlockId) {
if (!$locBlockId) {
}
/**
- * @param $entityBlock
+ * Get values.
+ *
+ * @param array $entityBlock
* @param bool $microformat
*
* @return array
* Contact id.
* @param int $locationTypeId
* Id of the location to delete.
- *
- * @return void
*/
public static function deleteLocationBlocks($contactId, $locationTypeId) {
// ensure that contactId has a value
}
/**
- * If contact has data for any location block, make sure
- * contact should have only one primary block, CRM-5051
+ * Make sure contact should have only one primary block, CRM-5051.
*
* @param int $contactId
* Contact id.
- *
*/
public static function checkPrimaryBlocks($contactId) {
if (!$contactId) {
}
/**
+ * Get chain select values (whatever that means!).
+ *
* @param mixed $values
* @param string $valueType
* @param bool $flatten