projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
handle recurring entity delete
[civicrm-core.git]
/
CRM
/
Core
/
BAO
/
CustomOption.php
diff --git
a/CRM/Core/BAO/CustomOption.php
b/CRM/Core/BAO/CustomOption.php
index 236ca8f0b13f5fc70c35656c691e45eb5f9ac239..bf2cb527d980381536454b9b7b22104ec8a79a0e 100644
(file)
--- a/
CRM/Core/BAO/CustomOption.php
+++ b/
CRM/Core/BAO/CustomOption.php
@@
-1,9
+1,9
@@
<?php
/*
+--------------------------------------------------------------------+
<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.
4
|
+ | CiviCRM version 4.
5
|
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
3
|
+ | Copyright CiviCRM LLC (c) 2004-201
4
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-28,7
+28,7
@@
/**
*
* @package CRM
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-201
3
+ * @copyright CiviCRM LLC (c) 2004-201
4
* $Id$
*
*/
* $Id$
*
*/
@@
-66,9
+66,10
@@
class CRM_Core_BAO_CustomOption {
/**
* Returns all active options ordered by weight for a given field
*
/**
* Returns all active options ordered by weight for a given field
*
- * @param
int $fieldId field whose options are needed
- * @param boolean
$inactiveNeeded
do we need inactive options ?
+ * @param
$fieldID
+ * @param boolean
$inactiveNeeded
do we need inactive options ?
*
*
+ * @internal param int $fieldId field whose options are needed
* @return array $customOption all active options for fieldId
* @static
*/
* @return array $customOption all active options for fieldId
* @static
*/
@@
-92,7
+93,7
@@
class CRM_Core_BAO_CustomOption {
$optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupID);
foreach ($optionValues as $id => $value) {
$optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupID);
foreach ($optionValues as $id => $value) {
- if (!$inactiveNeeded &&
!CRM_Utils_Array::value('is_active', $value
)) {
+ if (!$inactiveNeeded &&
empty($value['is_active']
)) {
continue;
}
continue;
}
@@
-113,6
+114,7
@@
class CRM_Core_BAO_CustomOption {
*
* @param $fieldId int the custom field ID
* @pram $value string the value (typically from the DB) of this custom field
*
* @param $fieldId int the custom field ID
* @pram $value string the value (typically from the DB) of this custom field
+ * @param $value
* @param $htmlType string the html type of the field (optional)
* @param $dataType string the data type of the field (optional)
*
* @param $htmlType string the html type of the field (optional)
* @param $dataType string the data type of the field (optional)
*
@@
-210,6
+212,11
@@
WHERE id = %1";
}
}
}
}
+ /**
+ * @param $params
+ *
+ * @throws Exception
+ */
static function updateCustomValues($params) {
$optionDAO = new CRM_Core_DAO_OptionValue();
$optionDAO->id = $params['optionId'];
static function updateCustomValues($params) {
$optionDAO = new CRM_Core_DAO_OptionValue();
$optionDAO->id = $params['optionId'];
@@
-277,7
+284,13
@@
SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
}
}
}
}
- static function &valuesByID($customFieldID, $optionGroupID = NULL) {
+ /**
+ * @param $customFieldID
+ * @param null $optionGroupID
+ *
+ * @return array
+ */
+ static function valuesByID($customFieldID, $optionGroupID = NULL) {
if (!$optionGroupID) {
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
$customFieldID,
if (!$optionGroupID) {
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
$customFieldID,
@@
-285,7
+298,7
@@
SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
);
}
);
}
- $options =
CRM_Core_OptionGroup::valuesByID($optionGroupID
);
+ $options =
$optionGroupID ? CRM_Core_OptionGroup::valuesByID($optionGroupID) : array(
);
CRM_Utils_Hook::customFieldOptions($customFieldID, $options, FALSE);
CRM_Utils_Hook::customFieldOptions($customFieldID, $options, FALSE);