<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
/**
- * insert/update a new entry in the database.
+ * Insert/update a new entry in the database.
*
- * @param array $params (reference), array $ids
+ * @param array $params
+ * (reference), array $ids.
*
* @param $ids
*
- * @return object CRM_Price_DAO_PriceFieldValue object
- * @access public
- * @static
+ * @return CRM_Price_DAO_PriceFieldValue
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$fieldValueBAO = new CRM_Price_BAO_PriceFieldValue();
$fieldValueBAO->copyValues($params);
/**
* Creates a new entry in the database.
*
- * @param array $params (reference), array $ids
+ * @param array $params
+ * (reference), array $ids.
*
* @param $ids
*
- * @return object CRM_Price_DAO_PriceFieldValue object
- * @access public
- * @static
+ * @return CRM_Price_DAO_PriceFieldValue
*/
- static function create(&$params, $ids = array()) {
+ public static function create(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
if (!is_array($params) || empty($params)) {
- return;
+ return NULL;
}
- if(!$id && empty($params['name'])) {
+ if (!$id && empty($params['name'])) {
$params['name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 242));
}
- if ($id && !empty($params['weight'])) {
- if (isset($params['name']))unset($params['name']);
+ if ($id && !empty($params['weight'])) {
+ if (isset($params['name'])) {
+ unset($params['name']);
+ }
$oldWeight = NULL;
if ($id) {
* Get defaults for new entity
* @return array
*/
- static function getDefaults() {
+ public static function getDefaults() {
return array(
'is_active' => 1,
'weight' => 1,
* Takes a bunch of params that are needed to match certain criteria and
* retrieves the relevant objects.
*
- * @param array $params (reference ) an assoc array
- * @param array $defaults (reference ) an assoc array to hold the flattened values
+ * @param array $params
+ * (reference ) an assoc array.
+ * @param array $defaults
+ * (reference ) an assoc array to hold the flattened values.
*
- * @return object CRM_Price_DAO_PriceFieldValue object
- * @access public
- * @static
+ * @return CRM_Price_DAO_PriceFieldValue
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceFieldValue', $params, $defaults);
}
/**
* Retrive the all values for given field id
*
- * @param int $fieldId price_field_id
- * @param array $values (reference ) to hold the values
- * @param string $orderBy for order by, default weight
+ * @param int $fieldId
+ * Price_field_id.
+ * @param array $values
+ * (reference ) to hold the values.
+ * @param string $orderBy
+ * For order by, default weight.
* @param bool|int $isActive is_active, default false
*
- * @return array $values
+ * @return array
*
- * @access public
- * @static
*/
- static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
+ public static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
$fieldValueDAO = new CRM_Price_DAO_PriceFieldValue();
$fieldValueDAO->price_field_id = $fieldId;
$fieldValueDAO->orderBy($orderBy, 'label');
/**
* Get the price field option label.
*
- * @param int $id id of field option.
+ * @param int $id
+ * Id of field option.
*
- * @return string name
- *
- * @access public
- * @static
+ * @return string
+ * name
*
*/
public static function getOptionLabel($id) {
}
/**
- * update the is_active flag in the db
+ * Update the is_active flag in the db
*
- * @param int $id Id of the database record
- * @param boolean $is_active Value we want to set the is_active field
+ * @param int $id
+ * Id of the database record.
+ * @param bool $is_active
+ * Value we want to set the is_active field.
*
- * @return Object DAO object on sucess, null otherwise
+ * @return Object
+ * DAO object on sucess, null otherwise
*
- * @access public
- * @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'is_active', $is_active);
}
/**
- * delete all values of the given field id
+ * Delete all values of the given field id
*
- * @param int $fieldId Price field id
+ * @param int $fieldId
+ * Price field id.
*
*
- * @access public
- * @static
*/
- static function deleteValues($fieldId) {
+ public static function deleteValues($fieldId) {
if (!$fieldId) {
return;
}
/**
* Delete the value.
*
- * @param int $id Id
+ * @param int $id
+ * Id.
*
- * @return boolean
+ * @return bool
*
- * @access public
- * @static
*/
- static function del($id) {
+ public static function del($id) {
if (!$id) {
return FALSE;
}
* Update civicrm_price_field_value.financial_type_id
* when financial_type_id of contribution_page or event is changed
*
- * @param int $entityId Id
- * @param String $entityTable entity table
- * @param String $financialTypeID financial type id
+ * @param int $entityId
+ * Id.
+ * @param string $entityTable table.
+ * Entity table.
+ * @param string $financialTypeID type id.
+ * Financial type id.
*
- * @access public
- * @static
*/
- static function updateFinancialType($entityId, $entityTable, $financialTypeID) {
+ public static function updateFinancialType($entityId, $entityTable, $financialTypeID) {
if (!$entityId || !$entityTable || !$financialTypeID) {
return;
}
CRM_Core_DAO::executeQuery($sql, $params);
}
}
-