projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #4997 from monishdeb/CRM-15536
[civicrm-core.git]
/
CRM
/
Core
/
BAO
/
CustomField.php
diff --git
a/CRM/Core/BAO/CustomField.php
b/CRM/Core/BAO/CustomField.php
index 2d910bd9815d355842b9e38bd003297d49aabb07..c923c542ac2e567ba1d85f50af457f11af4810d6 100644
(file)
--- 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 |
+--------------------------------------------------------------------+
| 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
* Array for valid combinations of data_type & descriptions
*
* @var array
- * @static
*/
public static $_dataType = NULL;
*/
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
* Array for valid combinations of data_type & html_type
*
* @var array
- * @static
*/
public static $_dataToHtml = NULL;
*/
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
* Array to hold (formatted) fields for import
*
* @var array
- * @static
*/
public static $_importFields = NULL;
/**
* Build and retrieve the list of data types and descriptions
*
*/
public static $_importFields = NULL;
/**
* Build and retrieve the list of data types and descriptions
*
- * @param NULL
- *
* @return array
* Data type => Description
* @return array
* Data type => Description
- * @static
*/
public static function &dataType() {
if (!(self::$_dataType)) {
*/
public static function &dataType() {
if (!(self::$_dataType)) {
@@
-132,7
+126,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Core_DAO_CustomField
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Core_DAO_CustomField
- * @static
*/
public static function create(&$params) {
$origParams = array_merge(array(), $params);
*/
public static function create(&$params) {
$origParams = array_merge(array(), $params);
@@
-328,7
+321,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Core_DAO_CustomField
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Core_DAO_CustomField
- * @static
*/
public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
*/
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
*
* @return Object
* DAO object on sucess, null otherwise
*
- * @static
*/
public static function setIsActive($id, $is_active) {
*/
public static function setIsActive($id, $is_active) {
@@
-365,7
+356,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* @return string
* name
*
* @return string
* name
*
- * @static
*/
public static function getTitle($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $id, 'label');
*/
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.
*
* @return array
* an array of active custom fields.
*
- * @static
*/
public static function &getFields(
$customDataType = 'Individual',
*/
public static function &getFields(
$customDataType = 'Individual',
@@
-618,7
+607,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* @return array
*
*
* @return array
*
*
- * @static
*/
public static function &getFieldsForImport(
$contactType = 'Individual',
*/
public static function &getFieldsForImport(
$contactType = 'Individual',
@@
-686,7
+674,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* @param bool $all
* @return int|null
* The id (if exists)
* @param bool $all
* @return int|null
* The id (if exists)
- * @static
*/
public static function getKeyID($key, $all = FALSE) {
$match = array();
*/
public static function getKeyID($key, $all = FALSE) {
$match = array();
@@
-711,9
+698,7
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* The custom field ID.
*
* @return CRM_Core_DAO_CustomField
* The custom field ID.
*
* @return CRM_Core_DAO_CustomField
- * $field the field object
- * @static
- * public
+ * The field object.
*/
public static function getFieldObject($fieldID) {
$field = new CRM_Core_DAO_CustomField();
*/
public static function getFieldObject($fieldID) {
$field = new CRM_Core_DAO_CustomField();
@@
-757,7
+742,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* @param string $label
* Label for custom field.
*
* @param string $label
* Label for custom field.
*
- * @static
*/
public static function addQuickFormElement(
&$qf,
*/
public static function addQuickFormElement(
&$qf,
@@
-1096,10
+1080,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
*
* @param object $field
* The field object.
*
* @param object $field
* The field object.
- *
- * @return boolean
- *
- * @static
*/
public static function deleteField($field) {
CRM_Utils_System::flushCache();
*/
public static function deleteField($field) {
CRM_Utils_System::flushCache();
@@
-1117,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');
$field->delete();
CRM_Core_BAO_UFField::delUFField($field->id);
CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_CustomField');
-
- return;
}
/**
}
/**
@@
-1138,7
+1116,6
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
* @return string
* the display value
*
* @return string
* the display value
*
- * @static
*/
public static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) {
$option = &$options[$id];
*/
public static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) {
$option = &$options[$id];
@@
-1168,7
+1145,7
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
*
* @return array|mixed|null|string
*/
*
* @return array|mixed|null|string
*/
- static function getDisplayValueCommon(
+
public
static function getDisplayValueCommon(
$value,
&$option,
$html_type,
$value,
&$option,
$html_type,
@@
-1380,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
*
* If passed - dont fetch value from db,.
* just format the given value
*
- * @static
*/
*/
- static function setProfileDefaults(
+
public
static function setProfileDefaults(
$customFieldId,
$elementName,
&$defaults,
$customFieldId,
$elementName,
&$defaults,
@@
-1593,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.
*
* @param bool $includeViewOnly
* If true, fields marked 'View Only' are included. Required for APIv3.
*
- * @return array
+ * @return array
|NULL
* formatted custom field array
* formatted custom field array
- * @static
*/
*/
- static function formatCustomField(
+
public
static function formatCustomField(
$customFieldId, &$customFormatted, $value,
$customFieldExtend, $customValueId = NULL,
$entityId = NULL,
$customFieldId, &$customFormatted, $value,
$customFieldExtend, $customValueId = NULL,
$entityId = NULL,
@@
-1632,12
+1607,12
@@
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
);
if (!array_key_exists($customFieldId, $customFields)) {
);
if (!array_key_exists($customFieldId, $customFields)) {
- return;
+ return
NULL
;
}
// return if field is a 'code' field
if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) {
}
// return if field is a 'code' field
if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) {
- return;
+ return
NULL
;
}
list($tableName, $columnName, $groupID) = self::getTableColumnGroup($customFieldId);
}
list($tableName, $columnName, $groupID) = self::getTableColumnGroup($customFieldId);
@@
-1942,8
+1917,8
@@
SELECT $columnName
* @param int $newGroupID
* FK to civicrm_custom_group.
*
* @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();
*/
public static function _moveFieldValidate($fieldID, $newGroupID) {
$errors = array();
@@
-2077,7
+2052,6
@@
WHERE id IN ( %1, %2 )
*
* @return array
* fatal is fieldID does not exists, else array of tableName, columnName
*
* @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}";
*/
public static function getTableColumnGroup($fieldID, $force = FALSE) {
$cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}";
@@
-2115,7
+2089,6
@@
AND cf.id = %1";
*
*
* @return mixed
*
*
* @return mixed
- * @static
*/
public static function &customOptionGroup($includeFieldIds = NULL) {
static $customOptionGroup = NULL;
*/
public static function &customOptionGroup($includeFieldIds = NULL) {
static $customOptionGroup = NULL;
@@
-2160,7
+2133,6
@@
INNER JOIN civicrm_custom_field f ON ( g.id = f.option_group_id )
* Option group id.
*
* @return void
* Option group id.
*
* @return void
- * @static
*/
public static function fixOptionGroups($customFieldId, $optionGroupId) {
// check if option group belongs to any custom Field else delete
*/
public static function fixOptionGroups($customFieldId, $optionGroupId) {
// check if option group belongs to any custom Field else delete
@@
-2187,7
+2159,6
@@
INNER JOIN civicrm_custom_field f ON ( g.id = f.option_group_id )
* Option group id.
*
* @return void
* Option group id.
*
* @return void
- * @static
*/
public static function checkOptionGroup($optionGroupId) {
$query = "
*/
public static function checkOptionGroup($optionGroupId) {
$query = "
@@
-2259,7
+2230,7
@@
ORDER BY html_type";
*
* @return array
*/
*
* @return array
*/
- static function postProcess(
+
public
static function postProcess(
&$params,
&$customFields,
$entityID,
&$params,
&$customFields,
$entityID,
@@
-2421,7
+2392,6
@@
WHERE f.id IN ($ids)";
*
* @return array
* validation errors.
*
* @return array
* validation errors.
- * @static
*/
public static function validateCustomData($params) {
$errors = array();
*/
public static function validateCustomData($params) {
$errors = array();
@@
-2558,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);
}
// 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);
}
+
}
}