本文整理汇总了PHP中CRM_Utils_String::strtobool方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_String::strtobool方法的具体用法?PHP CRM_Utils_String::strtobool怎么用?PHP CRM_Utils_String::strtobool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_String
的用法示例。
在下文中一共展示了CRM_Utils_String::strtobool方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isTransactional
/**
* Determine if an API request should be treated as transactional
*
* @param \Civi\API\Provider\ProviderInterface $apiProvider
* @param array $apiRequest
* @return bool
*/
public function isTransactional($apiProvider, $apiRequest)
{
if (isset($apiRequest['params']['is_transactional'])) {
return \CRM_Utils_String::strtobool($apiRequest['params']['is_transactional']);
}
return strtolower($apiRequest['action']) == 'create' || strtolower($apiRequest['action']) == 'delete' || strtolower($apiRequest['action']) == 'submit';
}
示例2: import
/**
* handle the values in import mode
*
* @param int $onDuplicate the code for what action to take on duplicates
* @param array $values the array of values belonging to this line
*
* @return boolean the result of this processing
* @access public
*/
function import($onDuplicate, &$values)
{
try {
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
//assign join date equal to start date if join date is not provided
if (!CRM_Utils_Array::value('join_date', $params) && CRM_Utils_Array::value('membership_start_date', $params)) {
$params['join_date'] = $params['membership_start_date'];
}
$session = CRM_Core_Session::singleton();
$dateType = $session->get('dateTypes');
$formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
// don't add to recent items, CRM-4399
$formatted['skipRecentView'] = TRUE;
$dateLabels = array('join_date' => ts('Member Since'), 'membership_start_date' => ts('Start Date'), 'membership_end_date' => ts('End Date'));
foreach ($params as $key => $val) {
if ($val) {
switch ($key) {
case 'join_date':
case 'membership_start_date':
case 'membership_end_date':
if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) {
if (!CRM_Utils_Rule::date($params[$key])) {
CRM_Contact_Import_Parser_Contact::addToErrorMsg($dateLabels[$key], $errorMessage);
}
} else {
CRM_Contact_Import_Parser_Contact::addToErrorMsg($dateLabels[$key], $errorMessage);
}
break;
case 'membership_type_id':
if (!is_numeric($val)) {
unset($params['membership_type_id']);
$params['membership_type'] = $val;
}
break;
case 'status_id':
if (!is_numeric($val)) {
unset($params['status_id']);
$params['membership_status'] = $val;
}
break;
case 'is_override':
$params[$key] = CRM_Utils_String::strtobool($val);
break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
unset($params[$key]);
} else {
if ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
}
}
}
//date-Format part ends
static $indieFields = NULL;
if ($indieFields == NULL) {
$tempIndieFields = CRM_Member_DAO_Membership::import();
$indieFields = $tempIndieFields;
}
$formatValues = array();
foreach ($params as $key => $field) {
if ($field == NULL || $field === '') {
continue;
}
$formatValues[$key] = $field;
}
//format params to meet api v2 requirements.
//@todo find a way to test removing this formatting
$formatError = $this->membership_format_params($formatValues, $formatted, TRUE);
if ($onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE) {
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, CRM_Core_DAO::$_nullObject, NULL, 'Membership');
} else {
//fix for CRM-2219 Update Membership
// onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
if (CRM_Utils_Array::value('is_override', $formatted) && !CRM_Utils_Array::value('status_id', $formatted)) {
array_unshift($values, 'Required parameter missing: Status');
return CRM_Import_Parser::ERROR;
}
if (!empty($formatValues['membership_id'])) {
$dao = new CRM_Member_BAO_Membership();
$dao->id = $formatValues['membership_id'];
$dates = array('join_date', 'start_date', 'end_date');
//.........这里部分代码省略.........
示例3: testStrToBool
/**
* @param $input
* @param bool $expected
* * @dataProvider booleanDataProvider
*/
public function testStrToBool($input, $expected)
{
$actual = CRM_Utils_String::strtobool($input);
$this->assertTrue($expected === $actual);
}
示例4: import
/**
* Handle the values in import mode.
*
* @param int $onDuplicate
* The code for what action to take on duplicates.
* @param array $values
* The array of values belonging to this line.
*
* @return bool
* the result of this processing
*/
public function import($onDuplicate, &$values)
{
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
$formatted = array('version' => 3);
// don't add to recent items, CRM-4399
$formatted['skipRecentView'] = TRUE;
//for date-Formats
$session = CRM_Core_Session::singleton();
$dateType = $session->get('dateTypes');
$customDataType = !empty($params['contact_type']) ? $params['contact_type'] : 'Contribution';
$customFields = CRM_Core_BAO_CustomField::getFields($customDataType);
//CRM-10994
if (isset($params['total_amount']) && $params['total_amount'] == 0) {
$params['total_amount'] = '0.00';
}
foreach ($params as $key => $val) {
if ($val) {
switch ($key) {
case 'receive_date':
case 'cancel_date':
case 'receipt_date':
case 'thankyou_date':
$params[$key] = CRM_Utils_Date::formatDate($params[$key], $dateType);
break;
case 'pledge_payment':
$params[$key] = CRM_Utils_String::strtobool($val);
break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
unset($params[$key]);
} elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
}
}
//date-Format part ends
static $indieFields = NULL;
if ($indieFields == NULL) {
$tempIndieFields = CRM_Contribute_DAO_Contribution::import();
$indieFields = $tempIndieFields;
}
$paramValues = array();
foreach ($params as $key => $field) {
if ($field == NULL || $field === '') {
continue;
}
$paramValues[$key] = $field;
}
//import contribution record according to select contact type
if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP && (!empty($paramValues['contribution_contact_id']) || !empty($paramValues['external_identifier']))) {
$paramValues['contact_type'] = $this->_contactType;
} elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE && (!empty($paramValues['contribution_id']) || !empty($values['trxn_id']) || !empty($paramValues['invoice_id']))) {
$paramValues['contact_type'] = $this->_contactType;
} elseif (!empty($params['soft_credit'])) {
$paramValues['contact_type'] = $this->_contactType;
} elseif (!empty($paramValues['pledge_payment'])) {
$paramValues['contact_type'] = $this->_contactType;
}
//need to pass $onDuplicate to check import mode.
if (!empty($paramValues['pledge_payment'])) {
$paramValues['onDuplicate'] = $onDuplicate;
}
require_once 'CRM/Utils/DeprecatedUtils.php';
$formatError = _civicrm_api3_deprecated_formatted_param($paramValues, $formatted, TRUE, $onDuplicate);
if ($formatError) {
array_unshift($values, $formatError['error_message']);
if (CRM_Utils_Array::value('error_data', $formatError) == 'soft_credit') {
return CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR;
} elseif (CRM_Utils_Array::value('error_data', $formatError) == 'pledge_payment') {
return CRM_Contribute_Import_Parser::PLEDGE_PAYMENT_ERROR;
}
return CRM_Import_Parser::ERROR;
}
if ($onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE) {
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, NULL, 'Contribution');
} else {
//fix for CRM-2219 - Update Contribution
// onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
if (!empty($paramValues['invoice_id']) || !empty($paramValues['trxn_id']) || !empty($paramValues['contribution_id'])) {
$dupeIds = array('id' => CRM_Utils_Array::value('contribution_id', $paramValues), 'trxn_id' => CRM_Utils_Array::value('trxn_id', $paramValues), 'invoice_id' => CRM_Utils_Array::value('invoice_id', $paramValues));
$ids['contribution'] = CRM_Contribute_BAO_Contribution::checkDuplicateIds($dupeIds);
//.........这里部分代码省略.........
示例5: import
/**
* handle the values in import mode
*
* @param int $onDuplicate the code for what action to take on duplicates
* @param array $values the array of values belonging to this line
*
* @return boolean the result of this processing
* @access public
*/
function import($onDuplicate, &$values)
{
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Member_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
//assign join date equal to start date if join date is not provided
if (!$params['join_date'] && $params['membership_start_date']) {
$params['join_date'] = $params['membership_start_date'];
}
$session =& CRM_Core_Session::singleton();
$dateType = $session->get("dateTypes");
$formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
// don't add to recent items, CRM-4399
$formatted['skipRecentView'] = true;
foreach ($params as $key => $val) {
if ($val) {
switch ($key) {
case 'join_date':
if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) {
if (!CRM_Utils_Rule::date($params[$key])) {
CRM_Import_Parser_Contact::addToErrorMsg('Join Date', $errorMessage);
}
} else {
CRM_Import_Parser_Contact::addToErrorMsg('Join Date', $errorMessage);
}
break;
case 'membership_start_date':
if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) {
if (!CRM_Utils_Rule::date($params[$key])) {
CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage);
}
} else {
CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage);
}
break;
case 'membership_end_date':
if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) {
if (!CRM_Utils_Rule::date($params[$key])) {
CRM_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage);
}
} else {
CRM_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage);
}
break;
case 'is_override':
$params[$key] = CRM_Utils_String::strtobool($val);
break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($customFields[$customFieldID][2] == 'Date') {
CRM_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
unset($params[$key]);
} else {
if ($customFields[$customFieldID][2] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
}
}
}
//date-Format part ends
static $indieFields = null;
if ($indieFields == null) {
require_once 'CRM/Member/DAO/Membership.php';
$tempIndieFields =& CRM_Member_DAO_Membership::import();
$indieFields = $tempIndieFields;
}
$formatValues = array();
foreach ($params as $key => $field) {
if ($field == null || $field === '') {
continue;
}
$formatValues[$key] = $field;
}
$formatError = _civicrm_membership_formatted_param($formatValues, $formatted, true);
if ($formatError) {
array_unshift($values, $formatError['error_message']);
return CRM_Member_Import_Parser::ERROR;
}
if ($onDuplicate != CRM_Member_Import_Parser::DUPLICATE_UPDATE) {
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, CRM_Core_DAO::$_nullObject, null, 'Membership');
} else {
//fix for CRM-2219 Update Membership
// onDuplicate == CRM_Member_Import_Parser::DUPLICATE_UPDATE
if (CRM_Utils_Array::value('is_override', $formatted) && !CRM_Utils_Array::value('status_id', $formatted)) {
array_unshift($values, "Required parameter missing: Status");
return CRM_Member_Import_Parser::ERROR;
//.........这里部分代码省略.........
示例6: updateValue
/**
* update the custom calue for a given contact id and field id
*
* @param int $contactId contact id
* @param int $cfId custom field id
* @param string $value the value to set the field
*
* @return void
* @access public
* @static
*/
function updateValue($contactId, $cfId, $value)
{
$customValue =& new CRM_Core_BAO_CustomValue();
$customValue->custom_field_id = $cfId;
$customValue->entity_table = 'civicrm_contact';
$customValue->entity_id = $contactId;
$customValue->find(true);
$cf =& new CRM_Core_BAO_CustomField();
$cf->id = $cfId;
$cf->find(true);
if ($cf->data_type == 'StateProvince') {
$states =& CRM_Core_PseudoConstant::stateProvince();
if (CRM_Utils_Rule::integer($value)) {
$customValue->int_data = $value;
$customValue->char_data = CRM_Utils_Array::value($value, $states);
} else {
$customValue->int_data = CRM_Utils_Array::key($value, $states);
$customValue->char_data = $value;
}
} elseif ($cf->data_type == 'Country') {
$countries =& CRM_Core_PseudoConstant::country();
if (CRM_Utils_Rule::integer($value)) {
$customValue->int_data = $value;
$customValue->char_data = CRM_Utils_Array::value($value, $countries);
} else {
$customValue->int_data = CRM_Utils_Array::key($value, $countries);
$customValue->char_data = $value;
}
} else {
$isBool = false;
$field = $customValue->getField($isBool, $cf);
if ($isBool) {
$value = CRM_Utils_String::strtobool($value);
}
$customValue->{$field} = $value;
}
$customValue->save();
}
示例7: isForceRollback
/**
* Determine if caller wants us to *always* rollback.
*
* @param \Civi\API\Provider\ProviderInterface $apiProvider
* The API provider responsible for this request.
* @param array $apiRequest
* The full API request.
* @return bool
*/
public function isForceRollback($apiProvider, $apiRequest)
{
// FIXME: When APIv3 uses better parsing, only one check will be needed.
if (isset($apiRequest['params']['options']['force_rollback'])) {
return \CRM_Utils_String::strtobool($apiRequest['params']['options']['force_rollback']);
}
if (isset($apiRequest['options']['force_rollback'])) {
return \CRM_Utils_String::strtobool($apiRequest['options']['force_rollback']);
}
return FALSE;
}
示例8: run
/**
* @return array
*/
public function run()
{
$config =& CRM_Core_Config::singleton();
// do check for geocoding.
$processGeocode = FALSE;
if (empty($config->geocodeMethod)) {
if (CRM_Utils_String::strtobool($this->geocoding) === TRUE) {
$this->returnMessages[] = ts('Error: You need to set a mapping provider under Administer > System Settings > Mapping and Geocoding');
$this->returnError = 1;
$this->returnResult();
}
} else {
$processGeocode = TRUE;
// user might want to over-ride.
if (CRM_Utils_String::strtobool($this->geocoding) === FALSE) {
$processGeocode = FALSE;
}
}
// do check for parse street address.
$parseAddress = FALSE;
$parseAddress = CRM_Utils_Array::value('street_address_parsing', CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options'), FALSE);
$parseStreetAddress = FALSE;
if (!$parseAddress) {
if (CRM_Utils_String::strtobool($this->parse) === TRUE) {
$this->returnMessages[] = ts('Error: You need to enable Street Address Parsing under Administer > Localization > Address Settings.');
$this->returnError = 1;
return $this->returnResult();
}
} else {
$parseStreetAddress = TRUE;
// user might want to over-ride.
if (CRM_Utils_String::strtobool($this->parse) === FALSE) {
$parseStreetAddress = FALSE;
}
}
// don't process.
if (!$parseStreetAddress && !$processGeocode) {
$this->returnMessages[] = ts('Error: Both Geocode mapping as well as Street Address Parsing are disabled. You must configure one or both options to use this script.');
$this->returnError = 1;
return $this->returnResult();
}
// do check for parse street address.
return $this->processContacts($config, $processGeocode, $parseStreetAddress);
}
示例9: isForkable
/**
* Determine if modifications are allowed on the case-type
*
* @param int $caseTypeId
* @return bool
* TRUE if the definition can be modified
*/
public static function isForkable($caseTypeId)
{
$caseTypeName = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'name', 'id', TRUE);
if ($caseTypeName) {
// if file-based definition explicitly disables "forkable" option, then don't allow changes to definition
$fileDefinition = CRM_Case_XMLRepository::singleton()->retrieveFile($caseTypeName);
if ($fileDefinition && isset($fileDefinition->forkable)) {
return CRM_Utils_String::strtobool((string) $fileDefinition->forkable);
}
}
return TRUE;
}
示例10: _crm_update_contact
//.........这里部分代码省略.........
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Core_BAO_" . $block) . ".php";
eval('$contact->location[$contactLocationBlock]->{$name}[$propertyBlock] =& new CRM_Core_BAO_' . $block . '( );');
}
$property['location_id'] = $contact->location[$contactLocationBlock]->id;
if (!$overwrite) {
_crm_update_from_object($contact->location[$contactLocationBlock]->{$name}[$propertyBlock], $property, true);
}
if ($primary == null && $property['is_primary']) {
$primary = $propertyBlock;
} else {
if ($primary != $propertyBlock) {
$property['is_primary'] = false;
}
}
_crm_update_object($contact->location[$contactLocationBlock]->{$name}[$propertyBlock], $property);
$propertyBlock++;
}
}
/* handle multiple phones */
if (is_array($updateLocation['phone'])) {
if (!isset($contact->location[$contactLocationBlock]->phone)) {
$contact->location[$contactLocationBlock]->phone = array();
}
$primary_phone = null;
foreach ($contact->location[$contactLocationBlock]->phone as $key => $value) {
if ($value->is_primary) {
$primary_phone = $key;
break;
}
}
foreach ($updateLocation['phone'] as $phone) {
/* scan through the contact record for matching phone type at this location */
$contactPhoneBlock = null;
foreach ($contact->location[$contactLocationBlock]->phone as $key => $contactPhoneBlock) {
if ($contactPhoneBlock->phone_type_id == $phone['phone_type_id']) {
$contactPhoneBlock = $key;
break;
}
}
if ($contactPhoneBlock == null) {
if (empty($contact->location[$contactLocationBlock]->phone)) {
$contactPhoneBlock = 1;
} else {
$contactPhoneBlock = count($contact->location[$contactLocationBlock]->phone) + 1;
}
$contact->location[$contactLocationBlock]->phone[$contactPhoneBlock] =& new CRM_Core_BAO_Phone();
}
$phone['location_id'] = $contact->location[$contactLocationBlock]->id;
if (!$overwrite) {
_crm_update_from_object($contact->location[$contactLocationBlock]->phone[$contactPhoneBlock], $phone, true);
}
if ($primary_phone == null && $phone['is_primary']) {
$primary_phone = $contactPhoneBlock;
} else {
if ($primary_phone != $contactPhoneBlock) {
$phone['is_primary'] = false;
}
}
_crm_update_object($contact->location[$contactLocationBlock]->phone[$contactPhoneBlock], $phone);
}
}
}
}
/* Custom data */
if (is_array($values['custom'])) {
foreach ($values['custom'] as $customValue) {
/* get the field for the data type */
$field = CRM_Core_BAO_CustomValue::typeToField($customValue['type']);
if (!$field) {
/* FIXME failure! */
continue;
}
/* adjust the value if it's boolean */
if ($customValue['type'] == 'Boolean') {
$value = CRM_Utils_String::strtobool($customValue['value']);
} else {
$value = $customValue['value'];
}
/* look for a matching existing custom value */
$match = false;
foreach ($contact->custom_values as $cv) {
if ($cv->custom_field_id == $customValue['custom_field_id']) {
/* match */
$match = true;
if ($overwrite) {
$cv->{$field} = $value;
$cv->save();
break;
}
}
}
if (!$match) {
/* no match, so create a new CustomValue */
$cvParams = array('entity_table' => 'civicrm_contact', 'entity_id' => $contact->id, 'value' => $value, 'type' => $customValue['type'], 'custom_field_id' => $customValue['custom_field_id']);
CRM_Core_BAO_CustomValue::create($cvParams);
}
}
}
return $contact;
}
示例11: import
/**
* handle the values in import mode
*
* @param int $onDuplicate the code for what action to take on duplicates
* @param array $values the array of values belonging to this line
*
* @return boolean the result of this processing
* @access public
*/
function import($onDuplicate, &$values)
{
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Contribute_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
$formatted = array();
// don't add to recent items, CRM-4399
$formatted['skipRecentView'] = true;
//for date-Formats
$session =& CRM_Core_Session::singleton();
$dateType = $session->get("dateTypes");
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
foreach ($params as $key => $val) {
if ($val) {
switch ($key) {
case 'receive_date':
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
break;
case 'cancel_date':
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
break;
case 'receipt_date':
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
break;
case 'thankyou_date':
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
break;
case 'pledge_payment':
$params[$key] = CRM_Utils_String::strtobool($val);
break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
unset($params[$key]);
} else {
if ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
}
}
}
//date-Format part ends
static $indieFields = null;
if ($indieFields == null) {
require_once 'CRM/Contribute/DAO/Contribution.php';
$tempIndieFields =& CRM_Contribute_DAO_Contribution::import();
$indieFields = $tempIndieFields;
}
$paramValues = array();
foreach ($params as $key => $field) {
if ($field == null || $field === '') {
continue;
}
$paramValues[$key] = $field;
}
//import contribution record according to select contact type
if ($onDuplicate == CRM_Contribute_Import_Parser::DUPLICATE_SKIP && ($paramValues['contribution_contact_id'] || $paramValues['external_identifier'])) {
$paramValues['contact_type'] = $this->_contactType;
} else {
if ($onDuplicate == CRM_Contribute_Import_Parser::DUPLICATE_UPDATE && ($paramValues['contribution_id'] || $values['trxn_id'] || $paramValues['invoice_id'])) {
$paramValues['contact_type'] = $this->_contactType;
} else {
if (!empty($params['soft_credit'])) {
$paramValues['contact_type'] = $this->_contactType;
} else {
if (CRM_Utils_Array::value('pledge_payment', $paramValues)) {
$paramValues['contact_type'] = $this->_contactType;
}
}
}
}
//need to pass $onDuplicate to check import mode.
if (CRM_Utils_Array::value('pledge_payment', $paramValues)) {
$paramValues['onDuplicate'] = $onDuplicate;
}
$formatError = _civicrm_contribute_formatted_param($paramValues, $formatted, true);
if ($formatError) {
array_unshift($values, $formatError['error_message']);
if (CRM_Utils_Array::value('error_data', $formatError) == 'soft_credit') {
return CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR;
} else {
if (CRM_Utils_Array::value('error_data', $formatError) == 'pledge_payment') {
return CRM_Contribute_Import_Parser::PLEDGE_PAYMENT_ERROR;
}
}
return CRM_Contribute_Import_Parser::ERROR;
//.........这里部分代码省略.........