/** * takes an associative array and updates a uf join object * * @param array $params assoc array of name/value pairs * * @return object updated CRM_Core_DAO_UFJoin object * @access public * */ function crm_edit_uf_join(&$ufJoin, &$params) { if (!is_array($params)) { return _crm_error("params is not an array"); } if (empty($params)) { return _crm_error("params is an empty array"); } if (!is_a($ufJoin, 'CRM_Core_DAO_UFJoin')) { return _crm_error('$ufJoin is not a valid object'); } $error = _crm_update_object($ufJoin, $params); if (is_a($error, 'CRM_Core_Error')) { return $error; } return $ufJoin; }
/** * Updating Custom Field. * * Use this API to update the custom Field. See the CRM Data Model for custom_field property definitions. * Updating the html_type enum value and data_type enum value is not allowed. * * @param $params Array Associative array of property name/value pairs of custom field. * * @param $customField Object Object of (CRM_Core_BAO_CustomField) custom field to be updated. * * @return Updated custom_field object * * @access public */ function crm_update_custom_field($params, $customField) { _crm_initialize(); if (!isset($customField->id)) { return _crm_error("id of the custom field is not set."); } if (!is_array($params)) { return _crm_error("params is not of array type"); } if (isset($params['html_type']) || isset($params['data_type'])) { return _crm_error("Updating html_type and/or data_type is not allowed."); } $params['id'] = $customField->id; if (!isset($params['custom_group_id'])) { $params['custom_group_id'] = $customField->custom_group_id; } if (!isset($params['weight'])) { $params['weight'] = $customField->weight; } $checkFields = _crm_check_required_fields($params, 'CRM_Core_DAO_CustomField'); if (is_a($checkFields, 'CRM_Core_Error')) { return $checkFields; } $updateObject = _crm_update_object($customField, $params); if (is_a($updateObject, 'CRM_Core_Error')) { return $updateObject; } return $customField; //require_once 'CRM/Core/BAO/CustomField.php'; //return CRM_Core_BAO_CustomField::create($params); }
function _crm_update_contribution($contribution, $values, $overwrite = true) { CRM_Contribute_BAO_Contribution::resolveDefaults($values, true); if (!$overwrite) { _crm_update_from_object($contribution, $values, true, true); } _crm_update_object($contribution, $values); return $contribution; }
/** * Update a history record * * Updates history record with the values passed in the 'params' array. An * error is returned if an invalid history record is passed, or an invalid * property name or property value is included in 'params'. An error * is also returned if the processing the update would violate data * integrity rules, e.g. if a group id value is passed which is * not present * * <b>Clearing Property Values with Update APIs</b> * * <ul> * <li>For any CRM 'update' API...to clear the value of an existing * property (i.e. set it to empty) - pass the property name in the * $params array with a NULL value.</li> * </ul> * * @param CRM_Core_DAO_ActivityHistory $historyDAO A valid history object * @param array $params Associative array of property name/value pairs to be updated. * * @return CRM_Core_DAO_ActivityHistory|CRM_Core_Error Return the updated Contact Object else * Error Object (if integrity violation) * * @access public * */ function &crm_update_activity_history(&$historyDAO, &$params) { _crm_initialize(); $error = _crm_check_activity_history_object($historyDAO, true); if (is_a($error, 'CRM_Core_Error')) { return $error; } $error = _crm_update_object($historyDAO, $params); if (is_a($error, 'CRM_Core_Error')) { return $error; } return $historyDAO; }