+--------------------------------------------------------------------+
| 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_Core_BAO_UFField extends CRM_Core_DAO_UFField {
/**
- * Batch entry fields
+ * Batch entry fields.
*/
private static $_contriBatchEntryFields = NULL;
private static $_memberBatchEntryFields = NULL;
/**
- * 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.
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Core_BAO_UFField object
- * @static
+ * @return CRM_Core_BAO_UFField
*/
public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_UFField', $params, $defaults);
* @param int $id
* Id of uf_form.
*
- * @return string title
- *
- * @static
+ * @return string
+ * title
*
*/
public static function getTitle($id) {
}
/**
- * Update the is_active flag in the db
+ * Update the is_active flag in the db.
*
* @param int $id
* Id of the database record.
* @param bool $is_active
* Value we want to set the is_active field.
*
- * @return Object DAO object on sucess, null otherwise
- * @static
+ * @return Object
+ * DAO object on sucess, null otherwise
*/
public static function setIsActive($id, $is_active) {
//check if custom data profile field is disabled
* @param int $id
* Field Id.
*
- * @return boolean
- *
- * @static
+ * @return bool
*
*/
public static function del($id) {
}
/**
- * Check duplicate for duplicate field in a group
+ * Check duplicate for duplicate field in a group.
*
* @param array $params
* An associative array with field and values.
* @return mixed
* @ids array $ids array that containd ids
*
- * @static
*/
public static function duplicateField($params, $ids) {
$ufField = new CRM_Core_DAO_UFField();
}
/**
- * Add the UF Field
+ * Add the UF Field.
*
* @param array $params
* (reference) array containing the values submitted by the form.
* @param array $ids
* Array containing the id.
*
- * @return CRM_Core_BAO_UFField object
- *
- * @static
+ * @return CRM_Core_BAO_UFField
*
*/
public static function add(&$params, $ids = array()) {
}
/**
- * Automatically determine one weight and modify others
+ * Automatically determine one weight and modify others.
*
* @param array $params
* UFField record, e.g. with 'weight', 'uf_group_id', and 'field_id'.
* Set the is_active field.
*
* @return void
- * @static
*/
public static function setUFField($customFieldId, $is_active) {
//find the profile id given custom field
* In which to copy.
*
* @return void
- * @static
*/
public static function copy($old_id, $new_id) {
$ufField = new CRM_Core_DAO_UFField();
}
/**
- * Delete profile field given a custom field
+ * Delete profile field given a custom field.
*
* @param int $customFieldId
* ID of the custom field to be deleted.
*
* @return void
*
- * @static
*/
public static function delUFField($customFieldId) {
//find the profile id given custom field id
* Value we want to set the is_active field.
*
* @return void
- * @static
*/
public static function setUFFieldStatus($customGroupId, $is_active) {
//find the profile id given custom group id
}
/**
- * Check the status of custom field used in uf fields
+ * Check the status of custom field used in uf fields.
*
* @param int $UFFieldId
*
- * @return boolean false if custom field are disabled else true
- * @static
+ * @return bool
+ * false if custom field are disabled else true
*/
public static function checkUFStatus($UFFieldId) {
$fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $UFFieldId, 'field_name');
* @param array $optional
* Array of types those are optional.
*
- * @return boolean $valid
- * @static
+ * @return bool
*/
public static function checkValidProfileType($ufGroupId, $required, $optional = NULL) {
if (!is_array($required) || empty($required)) {
- return;
+ return FALSE;
}
$ufGroup = new CRM_Core_DAO_UFGroup();
*
* @param int $ufGroupId
*
- * @return true for mix profile else false
- * @static
+ * @return bool
+ * true for mix profile else false
*/
public static function checkProfileType($ufGroupId) {
$ufGroup = new CRM_Core_DAO_UFGroup();
*
* @param bool $skipComponentType
*
- * @return string profile group_type
- * @static
+ * @return string
+ * profile group_type
*
- * TODO Why is this function in this class? It seems to be about the UFGroup.
*/
public static function getProfileType($ufGroupId, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
$ufGroup = new CRM_Core_DAO_UFGroup();
* True if only pure profiles are required.
* @param bool $skipComponentType
*
- * @return string profile group_type
- * @static
+ * @return string profile group_type
*
- * TODO Why is this function in this class? It seems to be about the UFGroup.
*/
public static function calculateProfileType($ufGroupType, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
// profile types
*
* @param $ctype
*
- * @return true for mix profile group else false
- * @static
+ * @return bool
+ * true for mix profile group else false
*/
public static function checkProfileGroupType($ctype) {
$ufGroup = new CRM_Core_DAO_UFGroup();
*
* @param int $profileID
*
- * @return boolean $result true/false.
+ * @return bool
*/
public static function checkSearchableORInSelector($profileID) {
$result = FALSE;
*
* @param int $profileID
*
- * @return void.
+ * @return void
*/
public function resetInSelectorANDSearchable($profileID) {
if (!$profileID) {
* Array of profile fields that relate to address fields.
* @param array $profileFilter
* Filter to apply to profile fields - expected usage is to only fill based on.
- * the bottom profile per CRM-13726
+ * the bottom profile per CRM-13726
*
- * @return bool Can the address block be hidden safe in the knowledge all fields are elsewhere collected (see CRM-15118)
+ * @return bool
+ * Can the address block be hidden safe in the knowledge all fields are elsewhere collected (see CRM-15118)
*/
public static function assignAddressField($key, &$profileAddressFields, $profileFilter) {
$billing_id = CRM_Core_BAO_LocationType::getBilling();
$profileFields = civicrm_api3('uf_field', 'get', array_merge($profileFilter,
array(
- 'is_active' => 1,
- 'return' => 'field_name, is_required',
- 'options' => array(
- 'limit' => 0,
- ))
+ 'is_active' => 1,
+ 'return' => 'field_name, is_required',
+ 'options' => array(
+ 'limit' => 0,
+ ),
+ )
));
//check for valid fields ( fields that are present in billing block )
$validBillingFields = array(
}
if (!in_array($prefixName, $validProfileFields)) {
- return;
+ return FALSE;
}
if (!empty($index) && (
- // it's empty so we set it OR
- !CRM_Utils_array::value($prefixName, $profileAddressFields)
+ // it's empty so we set it OR
+ !CRM_Utils_array::value($prefixName, $profileAddressFields)
//we are dealing with billing id (precedence)
|| $index == $billing_id
// we are dealing with primary & billing not set
|| ($index == 'Primary' && $profileAddressFields[$prefixName] != $billing_id)
|| ($index == CRM_Core_BAO_LocationType::getDefault()->id
- && $profileAddressFields[$prefixName] != $billing_id
- && $profileAddressFields[$prefixName] != 'Primary'
+ && $profileAddressFields[$prefixName] != $billing_id
+ && $profileAddressFields[$prefixName] != 'Primary'
+ )
)
- )
) {
$profileAddressFields[$prefixName] = $index;
}
$potentiallyMissingRequiredFields = array_diff($requiredBillingFields, $requiredProfileFields);
- CRM_Core_Resources::singleton()->addSetting(array('billing' => array('billingProfileIsHideable' => empty($potentiallyMissingRequiredFields))));
+ CRM_Core_Resources::singleton()
+ ->addSetting(array('billing' => array('billingProfileIsHideable' => empty($potentiallyMissingRequiredFields))));
}
/**
- * Get a list of fields which can be added to profiles
+ * Get a list of fields which can be added to profiles.
*
- * @param int $gid: UF group ID
- * @param array $defaults: Form defaults
+ * @param int $gid : UF group ID
+ * @param array $defaults : Form defaults
* @return array, multidimensional; e.g. $result['FieldGroup']['field_name']['label']
- * @static
*/
public static function getAvailableFields($gid = NULL, $defaults = array()) {
$fields = array(
));
//unset selected fields
foreach ($groupFieldList as $key => $value) {
- if (is_integer($key)) {
+ if (is_int($key)) {
unset($fields['Individual'][$value], $fields['Household'][$value], $fields['Organization'][$value]);
continue;
}
}
/**
- * Get a list of fields which can be added to profiles
+ * Get a list of fields which can be added to profiles.
*
* @param bool $force
*
* @return array, multidimensional; e.g. $result['field_name']['label']
- * @static
*/
public static function getAvailableFieldsFlat($force = FALSE) {
// FIXME reset when data model changes
}
/**
- * Determine whether the given field_name is valid
+ * Determine whether the given field_name is valid.
*
* @param string $fieldName
* @return bool
}
return self::$_memberBatchEntryFields;
}
+
}