X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FCustomField.php;h=c923c542ac2e567ba1d85f50af457f11af4810d6;hb=553ffa22464ff37a28a070458bcd52097b54235f;hp=5f0db6eaccb3911ddced1d1ee0142b62a2a9f80c;hpb=ed5a0ff7196e306e1319bd3f5913fdb068974daa;p=civicrm-core.git diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 5f0db6eacc..c923c542ac 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.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 | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -43,7 +43,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * Array for valid combinations of data_type & descriptions * * @var array - * @static */ public static $_dataType = NULL; @@ -51,7 +50,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * Array for valid combinations of data_type & html_type * * @var array - * @static */ public static $_dataToHtml = NULL; @@ -59,18 +57,14 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * Array to hold (formatted) fields for import * * @var array - * @static */ public static $_importFields = NULL; /** * Build and retrieve the list of data types and descriptions * - * @param NULL - * * @return array * Data type => Description - * @static */ public static function &dataType() { if (!(self::$_dataType)) { @@ -131,8 +125,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param array $params * (reference) an assoc array of name/value pairs. * - * @return CRM_Core_DAO_CustomField object - * @static + * @return CRM_Core_DAO_CustomField */ public static function create(&$params) { $origParams = array_merge(array(), $params); @@ -327,8 +320,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param array $defaults * (reference ) an assoc array to hold the flattened values. * - * @return CRM_Core_DAO_CustomField object - * @static + * @return CRM_Core_DAO_CustomField */ public static function retrieve(&$params, &$defaults) { return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults); @@ -345,7 +337,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return Object * DAO object on sucess, null otherwise * - * @static */ public static function setIsActive($id, $is_active) { @@ -365,7 +356,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return string * name * - * @static */ public static function getTitle($id) { return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $id, 'label'); @@ -394,7 +384,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return array * an array of active custom fields. * - * @static */ public static function &getFields( $customDataType = 'Individual', @@ -618,7 +607,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return array * * - * @static */ public static function &getFieldsForImport( $contactType = 'Individual', @@ -684,8 +672,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * The key to parse. * * @param bool $all - * @return int|null The id (if exists) - * @static + * @return int|null + * The id (if exists) */ public static function getKeyID($key, $all = FALSE) { $match = array(); @@ -709,9 +697,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param int $fieldID * The custom field ID. * - * @return CRM_Core_DAO_CustomField $field the field object - * @static - * public + * @return CRM_Core_DAO_CustomField + * The field object. */ public static function getFieldObject($fieldID) { $field = new CRM_Core_DAO_CustomField(); @@ -755,7 +742,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param string $label * Label for custom field. * - * @static */ public static function addQuickFormElement( &$qf, @@ -1094,10 +1080,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @param object $field * The field object. - * - * @return boolean - * - * @static */ public static function deleteField($field) { CRM_Utils_System::flushCache(); @@ -1115,8 +1097,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $field->delete(); CRM_Core_BAO_UFField::delUFField($field->id); CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_CustomField'); - - return; } /** @@ -1136,7 +1116,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @return string * the display value * - * @static */ public static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) { $option = &$options[$id]; @@ -1166,7 +1145,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * * @return array|mixed|null|string */ - static function getDisplayValueCommon( + public static function getDisplayValueCommon( $value, &$option, $html_type, @@ -1378,9 +1357,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * If passed - dont fetch value from db,. * just format the given value * - * @static */ - static function setProfileDefaults( + public static function setProfileDefaults( $customFieldId, $elementName, &$defaults, @@ -1591,11 +1569,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param bool $includeViewOnly * If true, fields marked 'View Only' are included. Required for APIv3. * - * @return array + * @return array|NULL * formatted custom field array - * @static */ - static function formatCustomField( + public static function formatCustomField( $customFieldId, &$customFormatted, $value, $customFieldExtend, $customValueId = NULL, $entityId = NULL, @@ -1630,12 +1607,12 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { ); if (!array_key_exists($customFieldId, $customFields)) { - return; + return NULL; } // return if field is a 'code' field if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) { - return; + return NULL; } list($tableName, $columnName, $groupID) = self::getTableColumnGroup($customFieldId); @@ -1940,8 +1917,8 @@ SELECT $columnName * @param int $newGroupID * FK to civicrm_custom_group. * - * @return array( - * string) or TRUE + * @return array + * array(string) or TRUE */ public static function _moveFieldValidate($fieldID, $newGroupID) { $errors = array(); @@ -2075,7 +2052,6 @@ WHERE id IN ( %1, %2 ) * * @return array * fatal is fieldID does not exists, else array of tableName, columnName - * @static */ public static function getTableColumnGroup($fieldID, $force = FALSE) { $cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}"; @@ -2106,14 +2082,13 @@ AND cf.id = %1"; * * @param array $includeFieldIds * Ids of custom fields for which. - * option groups must be included. + * option groups must be included. * * Currently this is required in the cases where option groups are to be included * for inactive fields : CRM-5369 * * - * @return mixed $customOptionGroup - * @static + * @return mixed */ public static function &customOptionGroup($includeFieldIds = NULL) { static $customOptionGroup = NULL; @@ -2158,7 +2133,6 @@ INNER JOIN civicrm_custom_field f ON ( g.id = f.option_group_id ) * Option group id. * * @return void - * @static */ public static function fixOptionGroups($customFieldId, $optionGroupId) { // check if option group belongs to any custom Field else delete @@ -2185,7 +2159,6 @@ INNER JOIN civicrm_custom_field f ON ( g.id = f.option_group_id ) * Option group id. * * @return void - * @static */ public static function checkOptionGroup($optionGroupId) { $query = " @@ -2257,7 +2230,7 @@ ORDER BY html_type"; * * @return array */ - static function postProcess( + public static function postProcess( &$params, &$customFields, $entityID, @@ -2415,11 +2388,10 @@ WHERE f.id IN ($ids)"; * * @param array $params * Custom data submitted. - * ie array( 'custom_1' => 'validate me' ); + * ie array( 'custom_1' => 'validate me' ); * * @return array * validation errors. - * @static */ public static function validateCustomData($params) { $errors = array(); @@ -2556,4 +2528,5 @@ WHERE cf.id = %1 AND cg.is_multiple = 1"; // FIXME: Currently the only way to know if data is serialized is by looking at the html_type. It would be cleaner to decouple this. return ($field['html_type'] == 'CheckBox' || strpos($field['html_type'], 'Multi') !== FALSE); } + }