X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FCustomOption.php;h=179abf99abe17346112427941f21f192bde8ea2b;hb=af321125666c7444accea956adaad22395fcd4c9;hp=0317c867d7f9e3b9e9eadb5cb2dce3bd331f4f37;hpb=71f4f2c6d8bd9e3a4a121bf47d0cc86aa8af0f33;p=civicrm-core.git diff --git a/CRM/Core/BAO/CustomOption.php b/CRM/Core/BAO/CustomOption.php index 0317c867d7..179abf99ab 100644 --- a/CRM/Core/BAO/CustomOption.php +++ b/CRM/Core/BAO/CustomOption.php @@ -1,7 +1,7 @@ copyValues($params); if ($customOption->find(TRUE)) { @@ -66,10 +63,11 @@ class CRM_Core_BAO_CustomOption { /** * Returns all active options ordered by weight for a given field * - * @param $fieldID - * @param boolean $inactiveNeeded do we need inactive options ? + * @param int $fieldID + * Field whose options are needed. + * @param bool $inactiveNeededDo we need inactive options ?. + * Do we need inactive options ?. * - * @internal param int $fieldId field whose options are needed * @return array $customOption all active options for fieldId * @static */ @@ -112,17 +110,19 @@ class CRM_Core_BAO_CustomOption { * Returns the option label for a custom field with a specific value. Handles all * custom field data and html types * - * @param $fieldId int the custom field ID + * @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). * * @return string the label to display for this custom field * @static - * @access public */ - static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL) { + public static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL) { if (!$fieldId) { return NULL; } @@ -166,14 +166,13 @@ WHERE id = %1 } /** - * Function to delete Option + * Delete Option * * param $optionId integer option id * * @static - * @access public */ - static function del($optionId) { + public static function del($optionId) { // get the customFieldID $query = " SELECT f.id as id, f.data_type as dataType @@ -212,7 +211,12 @@ WHERE id = %1"; } } - static function updateCustomValues($params) { + /** + * @param array $params + * + * @throws Exception + */ + public static function updateCustomValues($params) { $optionDAO = new CRM_Core_DAO_OptionValue(); $optionDAO->id = $params['optionId']; $optionDAO->find(TRUE); @@ -267,7 +271,8 @@ WHERE id = %2"; $query = " UPDATE {$dao->tableName} SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )"; - $queryParams = array(1 => array($oldString, 'String'), + $queryParams = array( + 1 => array($oldString, 'String'), 2 => array($newString, 'String'), ); break; @@ -279,7 +284,13 @@ SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )"; } } - static function valuesByID($customFieldID, $optionGroupID = NULL) { + /** + * @param int $customFieldID + * @param int $optionGroupID + * + * @return array + */ + public static function valuesByID($customFieldID, $optionGroupID = NULL) { if (!$optionGroupID) { $optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $customFieldID, @@ -294,4 +305,3 @@ SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )"; return $options; } } -