本文整理汇总了PHP中_civicrm_api3_basic_create函数的典型用法代码示例。如果您正苦于以下问题:PHP _civicrm_api3_basic_create函数的具体用法?PHP _civicrm_api3_basic_create怎么用?PHP _civicrm_api3_basic_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_civicrm_api3_basic_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_contribution_page_create
/**
* Create or update a contribution_page
*
* @param array $params Associative array of property
* name/value pairs to insert in new 'contribution_page'
* @example ContributionPageCreate.php Std Create example
*
* @return array api result array
* {@getfields contribution_page_create}
* @access public
*/
function civicrm_api3_contribution_page_create($params)
{
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
CRM_Contribute_PseudoConstant::flush('contributionPageAll');
CRM_Contribute_PseudoConstant::flush('contributionPageActive');
return $result;
}
示例2: civicrm_api3_payment_processor_create
/**
* Add/Update a PaymentProcessor.
*
* @param array $params
*
* @return array
* API result array
*/
function civicrm_api3_payment_processor_create($params)
{
if (empty($params['id']) && empty($params['payment_instrument_id'])) {
$params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', array('id' => $params['payment_processor_type_id'], 'return' => 'payment_instrument_id'));
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
示例3: civicrm_api3_contribution_create
/**
* Add or update a Contribution.
*
* @param array $params
* Input parameters.
*
* @throws API_Exception
* @return array
* Api result array
*/
function civicrm_api3_contribution_create(&$params)
{
$values = array();
_civicrm_api3_custom_format_params($params, $values, 'Contribution');
$params = array_merge($params, $values);
if (!empty($params['id']) && !empty($params['contribution_status_id'])) {
$error = array();
//throw error for invalid status change such as setting completed back to pending
//@todo this sort of validation belongs in the BAO not the API - if it is not an OK
// action it needs to be blocked there. If it is Ok through a form it needs to be OK through the api
CRM_Contribute_BAO_Contribution::checkStatusValidation(NULL, $params, $error);
if (array_key_exists('contribution_status_id', $error)) {
throw new API_Exception($error['contribution_status_id']);
}
}
if (!empty($params['id']) && !empty($params['financial_type_id'])) {
$error = array();
CRM_Contribute_BAO_Contribution::checkFinancialTypeChange($params['financial_type_id'], $params['id'], $error);
if (array_key_exists('financial_type_id', $error)) {
throw new API_Exception($error['financial_type_id']);
}
}
_civicrm_api3_contribution_create_legacy_support_45($params);
// Make sure tax calculation is handled via api.
$params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Contribution');
}
示例4: civicrm_api3_grant_create
/**
* create/update grant
*
* This API is used to create new grant or update any of the existing
* In case of updating existing grant, id of that particular grant must
* be in $params array.
*
* @param array $params Associative array of property
* name/value pairs to insert in new 'grant'
*
* @return array grant array
* {@getfields grant_create}
* @access public
*/
function civicrm_api3_grant_create($params)
{
$values = array();
_civicrm_api3_custom_format_params($params, $values, 'Grant');
$params = array_merge($values, $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'grant');
}
示例5: civicrm_api3_mailing_event_queue_create
/**
* Handle a queue event.
*
* @param array $params
* Array of property.
*
* @throws Exception
* @return array
* api result array
*/
function civicrm_api3_mailing_event_queue_create($params)
{
if (!array_key_exists('id', $params) && !array_key_exists('email_id', $params) && !array_key_exists('phone_id', $params)) {
throw new API_Exception("Mandatory key missing from params array: id, email_id, or phone_id field is required");
}
civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingJob', array('job_id', 'contact_id'), FALSE);
return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params);
}
示例6: civicrm_api3_action_schedule_create
/**
* Create a new ActionSchedule.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_action_schedule_create($params)
{
civicrm_api3_verify_one_mandatory($params, NULL, array('start_action_date', 'absolute_date'));
if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) {
$params['name'] = CRM_Utils_String::munge($params['title']);
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule');
}
示例7: civicrm_api3_location_type_create
/**
* Add a Location Type
*
* Allowed @params array keys are:
*
* @example LocationTypeCreate.php Standard Create Example
*
* @return array API result array
* {@getfields email_create}
* @access public
*/
function civicrm_api3_location_type_create($params)
{
//set display_name equal to name if it's not defined
if (!array_key_exists('display_name', $params) && array_key_exists('name', $params)) {
$params['display_name'] = $params['name'];
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
示例8: civicrm_api3_volunteer_project_contact_create
/**
* Create or update a project contact
*
* @param array $params Associative array of properties
* name/value pairs to insert in new 'project contact'
* @example
*
* @return array api result array
* {@getfields volunteer_project_contact_create}
* @access public
*/
function civicrm_api3_volunteer_project_contact_create($params)
{
if (!$params['check_permissions'] || CRM_Volunteer_Permission::checkProjectPerms(CRM_Core_Action::UPDATE, $params['project_id'])) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
} else {
return civicrm_api3_create_error(ts('You do not have permission to modify contacts for this project'));
}
}
示例9: civicrm_api3_pledge_create
/**
* Creates or updates an Activity. See the example for usage
*
* @param array $params Associative array of property name/value
* pairs for the activity.
* {@getfields pledge_create}
*
* @return array Array containing 'is_error' to denote success or failure and details of the created pledge
*
* @example PledgeCreate.php Standard create example
*
*/
function civicrm_api3_pledge_create($params)
{
_civicrm_api3_pledge_format_params($params, TRUE);
$values = $params;
//format the custom fields
_civicrm_api3_custom_format_params($params, $values, 'Pledge');
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $values);
}
示例10: civicrm_api3_slot_create
/**
* Slot.Create API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_slot_create($params)
{
if (CRM_Utils_Array::value('id', $params)) {
if (!CRM_Booking_BAO_Slot::isValid($params)) {
return civicrm_api3_create_error('Unable to create slot. Please check the slot date time is availables.');
}
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
示例11: civicrm_api3_membership_type_create
/**
* API to Create or update a Membership Type.
*
* @param array $params
* Array of name/value property values of civicrm_membership_type.
*
* @return array
* API result array.
*/
function civicrm_api3_membership_type_create($params)
{
// Workaround for fields using nonstandard serialization
foreach (array('relationship_type_id', 'relationship_direction') as $field) {
if (isset($params[$field]) && is_array($params[$field])) {
$params[$field] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params[$field]);
}
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Membership_type');
}
示例12: civicrm_api3_h_r_job_contract_revision_create
/**
* HRJobContractRevision.create API
*
* @param array $params
* @return array API result descriptor
* @throws API_Exception
*/
function civicrm_api3_h_r_job_contract_revision_create($params)
{
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
$editorName = '';
if (!empty($result['values'][0]['editor_uid'])) {
$civiUser = civicrm_custom_user_profile_get_contact($result['values'][0]['editor_uid']);
$editorName = $civiUser['sort_name'];
}
$result['values'][0]['editor_name'] = $editorName;
return $result;
}
示例13: civicrm_api3_h_r_job_hour_create
/**
* HRJobHour.create API
*
* @param array $params
* @return array API result descriptor
* @throws API_Exception
*/
function civicrm_api3_h_r_job_hour_create($params)
{
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
if (empty($result['is_error'])) {
$row = CRM_Utils_Array::first($result['values']);
$revision_id = $row['jobcontract_revision_id'];
$revision = civicrm_api3('HRJobContractRevision', 'get', array('sequential' => 1, 'id' => $revision_id, 'options' => array('limit' => 1)));
//CRM_Hrjobcontract_Estimator::updateEstimatesByRevision($revision);
}
return $result;
}
示例14: civicrm_api3_option_value_create
/**
* Add a OptionValue. OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
*
* Allowed @params array keys are:
*
* {@example OptionValueCreate.php}
*
* @param $params
*
* @throws API_Exception
* @return array of newly created option_value property values.
* {@getfields OptionValue_create}
* @access public
*/
function civicrm_api3_option_value_create($params)
{
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
if (!empty($params['id']) && !array_key_exists('option_group_id', $params)) {
$groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $params['id'], 'option_group_id', 'id');
} else {
$groupId = $params['option_group_id'];
}
civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId));
return $result;
}
示例15: civicrm_api3_dashboard_contact_create
/**
* Creates/Updates a new Dashboard Contact Entry.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_dashboard_contact_create($params)
{
if (empty($params['id'])) {
civicrm_api3_verify_one_mandatory($params, NULL, array('dashboard_id'));
}
$errors = _civicrm_api3_dashboard_contact_check_params($params);
if ($errors !== NULL) {
return $errors;
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}