/**
 * @todo Move this to ContactFormat.php
 * @deprecated
 */
function civicrm_contact_format_create(&$params)
{
    _civicrm_initialize();
    CRM_Core_DAO::freeResult();
    // return error if we have no params
    if (empty($params)) {
        return civicrm_create_error('Input Parameters empty');
    }
    $error = _civicrm_required_formatted_contact($params);
    if (civicrm_error($error)) {
        return $error;
    }
    $error = _civicrm_validate_formatted_contact($params);
    if (civicrm_error($error)) {
        return $error;
    }
    //get the prefix id etc if exists
    require_once 'CRM/Contact/BAO/Contact.php';
    CRM_Contact_BAO_Contact::resolveDefaults($params, TRUE);
    require_once 'CRM/Import/Parser.php';
    if (CRM_Utils_Array::value('onDuplicate', $params) != CRM_Import_Parser::DUPLICATE_NOCHECK) {
        CRM_Core_Error::reset();
        $error = _civicrm_duplicate_formatted_contact($params);
        if (civicrm_error($error)) {
            return $error;
        }
    }
    $contact = CRM_Contact_BAO_Contact::create($params, CRM_Utils_Array::value('fixAddress', $params));
    _civicrm_object_to_array($contact, $contactArray);
    return $contactArray;
}
Exemplo n.º 2
0
/**
 * @deprecated - this is part of the import parser not the API & needs to be moved on out
 *
 * @param array $params
 * @param $onDuplicate
 *
 * @return array|bool
 *   <type>
 */
function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate)
{
    require_once 'CRM/Event/Import/Parser.php';
    if ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
        CRM_Core_Error::reset();
        $error = _civicrm_api3_deprecated_participant_check_params($params, TRUE);
        if (civicrm_error($error)) {
            return $error;
        }
    }
    require_once "api/v3/Participant.php";
    return civicrm_api3_participant_create($params);
}
Exemplo n.º 3
0
/**
 *
 * @param <type> $params
 * @param <type> $onDuplicate
 * @return <type>
 */
function civicrm_create_participant_formatted(&$params, $onDuplicate)
{
    _civicrm_initialize();
    // return error if we have no params
    if (empty($params)) {
        return civicrm_create_error('Input Parameters empty');
    }
    require_once 'CRM/Event/Import/Parser.php';
    if ($onDuplicate != CRM_Event_Import_Parser::DUPLICATE_NOCHECK) {
        CRM_Core_Error::reset();
        $error = civicrm_participant_check_params($params);
        if (civicrm_error($error)) {
            return $error;
        }
    }
    return civicrm_participant_create($params);
}