comments
This commit is contained in:
parent
0ce48fa58b
commit
bbca822f15
1 changed files with 11 additions and 2 deletions
|
@ -179,6 +179,15 @@ class TwingleProject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate an existing project by campaign id
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
*
|
||||||
|
* @return \CRM\TwingleCampaign\Models\TwingleProject
|
||||||
|
* @throws \CiviCRM_API3_Exception
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public static function fetch($id) {
|
public static function fetch($id) {
|
||||||
$result = civicrm_api3('Campaign', 'getsingle', [
|
$result = civicrm_api3('Campaign', 'getsingle', [
|
||||||
'sequential' => 1,
|
'sequential' => 1,
|
||||||
|
@ -222,6 +231,7 @@ class TwingleProject {
|
||||||
*/
|
*/
|
||||||
private function translateValues($rev = FALSE) {
|
private function translateValues($rev = FALSE) {
|
||||||
$values = [];
|
$values = [];
|
||||||
|
// Translate from field name to custom field name
|
||||||
if (!$rev) {
|
if (!$rev) {
|
||||||
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
||||||
if (array_key_exists(
|
if (array_key_exists(
|
||||||
|
@ -236,6 +246,7 @@ class TwingleProject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Translate from custom field name to field name
|
||||||
else {
|
else {
|
||||||
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
||||||
if (array_key_exists($custom, $this->values)
|
if (array_key_exists($custom, $this->values)
|
||||||
|
@ -360,6 +371,4 @@ class TwingleProject {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue