add some shitty temporary logic for name processing
This commit is contained in:
parent
e4af927a5b
commit
080157754b
1 changed files with 21 additions and 8 deletions
|
@ -307,11 +307,20 @@ class TwingleEvent extends Campaign {
|
||||||
if (is_array($names) && count($names) > 1) {
|
if (is_array($names) && count($names) > 1) {
|
||||||
$lastname = array_pop($names);
|
$lastname = array_pop($names);
|
||||||
$test = $names[count($names) - 1];
|
$test = $names[count($names) - 1];
|
||||||
$nameSuffixes = ['de', 'da', 'von', 'van'];
|
$lastnamePrefixes = ['da', 'de', 'der', 'van', 'von'];
|
||||||
|
|
||||||
if (in_array($test, $nameSuffixes)) {
|
if (in_array($test, $lastnamePrefixes)) {
|
||||||
array_pop($names);
|
if ($test == 'der' &&
|
||||||
$lastname = $test . ' ' . $lastname;
|
$names[count($names) - 2] == 'van' ||
|
||||||
|
$names[count($names) - 2] == 'von'
|
||||||
|
) {
|
||||||
|
$lastname = implode(' ', array_splice($names, -2))
|
||||||
|
. ' ' . $lastname;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array_pop($names);
|
||||||
|
$lastname = $test . ' ' . $lastname;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$names = implode(" ", $names);
|
$names = implode(" ", $names);
|
||||||
|
@ -334,19 +343,23 @@ class TwingleEvent extends Campaign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the campaign id of the parent TwingleProject campaign.
|
* Gets the campaign id of the parent TwingleProject campaign.
|
||||||
|
*
|
||||||
* @return int|null
|
* @return int|null
|
||||||
* @throws CiviCRM_API3_Exception
|
* @throws CiviCRM_API3_Exception
|
||||||
*/
|
*/
|
||||||
private function getParentCampaignId() {
|
private function getParentCampaignId() {
|
||||||
$cf_project_id = Cache::getInstance()->getCustomFieldMapping()['twingle_project_id'];
|
$cf_project_id = Cache::getInstance()
|
||||||
|
->getCustomFieldMapping()['twingle_project_id'];
|
||||||
$parentCampaign = civicrm_api3('Campaign', 'get', [
|
$parentCampaign = civicrm_api3('Campaign', 'get', [
|
||||||
'sequential' => 1,
|
'sequential' => 1,
|
||||||
$cf_project_id => $this->values['project_id']
|
$cf_project_id => $this->values['project_id'],
|
||||||
]);
|
]);
|
||||||
if ($parentCampaign['is_error'] == 0) {
|
if ($parentCampaign['is_error'] == 0) {
|
||||||
return (int) $parentCampaign['id'];
|
return (int) $parentCampaign['id'];
|
||||||
}
|
}
|
||||||
else return NULL;
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue