X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FUFField.php;h=83d56486b79d1c523fedc64661f5b903a5b799bd;hb=c15fb38374462a40d704d83fac983412df8a16a1;hp=70a85c2f525bdb6172697da6cbcdf50f8d0d8c29;hpb=72b3a70c5e7890c69dd70bf00092e1217c5f15b7;p=civicrm-core.git diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index 70a85c2f52..83d56486b7 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | 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$ * */ @@ -40,22 +40,21 @@ 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); @@ -70,14 +69,13 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { * @return string * title * - * @static */ public static function getTitle($id) { return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $groupId, 'title'); } /** - * Update the is_active flag in the db + * Update the is_active flag in the db. * * @param int $id * Id of the database record. @@ -86,7 +84,6 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { * * @return Object * DAO object on sucess, null otherwise - * @static */ public static function setIsActive($id, $is_active) { //check if custom data profile field is disabled @@ -109,9 +106,8 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { * @param int $id * Field Id. * - * @return boolean + * @return bool * - * @static */ public static function del($id) { //delete field field @@ -122,7 +118,7 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { } /** - * 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. @@ -131,7 +127,6 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField { * @return mixed * @ids array $ids array that containd ids * - * @static */ public static function duplicateField($params, $ids) { $ufField = new CRM_Core_DAO_UFField(); @@ -196,16 +191,15 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; } /** - * 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 + * @return CRM_Core_BAO_UFField * - * @static */ public static function add(&$params, $ids = array()) { // set values for uf field properties and save @@ -253,7 +247,7 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; } /** - * 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'. @@ -279,7 +273,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * Set the is_active field. * * @return void - * @static */ public static function setUFField($customFieldId, $is_active) { //find the profile id given custom field @@ -303,7 +296,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * In which to copy. * * @return void - * @static */ public static function copy($old_id, $new_id) { $ufField = new CRM_Core_DAO_UFField(); @@ -318,14 +310,13 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; } /** - * 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 @@ -348,7 +339,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * 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 @@ -366,13 +356,12 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; } /** - * 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 + * @return bool * false if custom field are disabled else true - * @static */ public static function checkUFStatus($UFFieldId) { $fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $UFFieldId, 'field_name'); @@ -461,12 +450,11 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * @param array $optional * Array of types those are optional. * - * @return boolean - * @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(); @@ -510,7 +498,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * * @return bool * true for mix profile else false - * @static */ public static function checkProfileType($ufGroupId) { $ufGroup = new CRM_Core_DAO_UFGroup(); @@ -581,9 +568,7 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * * @return string * profile group_type - * @static * - * 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(); @@ -604,11 +589,8 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * 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 @@ -710,7 +692,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1"; * * @return bool * true for mix profile group else false - * @static */ public static function checkProfileGroupType($ctype) { $ufGroup = new CRM_Core_DAO_UFGroup(); @@ -744,7 +725,7 @@ SELECT ufg.id as id * * @param int $profileID * - * @return boolean + * @return bool */ public static function checkSearchableORInSelector($profileID) { $result = FALSE; @@ -803,7 +784,7 @@ SELECT id * 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) @@ -818,7 +799,7 @@ SELECT id 'return' => 'field_name, is_required', 'options' => array( 'limit' => 0, - ) + ), ) )); //check for valid fields ( fields that are present in billing block ) @@ -847,7 +828,7 @@ SELECT id } if (!in_array($prefixName, $validProfileFields)) { - return; + return FALSE; } if (!empty($index) && ( @@ -872,12 +853,11 @@ SELECT id } /** - * 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 * @return array, multidimensional; e.g. $result['FieldGroup']['field_name']['label'] - * @static */ public static function getAvailableFields($gid = NULL, $defaults = array()) { $fields = array( @@ -1046,7 +1026,7 @@ SELECT id )); //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; } @@ -1063,12 +1043,11 @@ SELECT id } /** - * 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 @@ -1089,7 +1068,7 @@ SELECT id } /** - * Determine whether the given field_name is valid + * Determine whether the given field_name is valid. * * @param string $fieldName * @return bool @@ -1172,4 +1151,5 @@ SELECT id } return self::$_memberBatchEntryFields; } + }