Merge remote-tracking branch 'gitlab/dev' into main
This commit is contained in:
commit
01265fbbb0
13 changed files with 289 additions and 95 deletions
|
@ -6,7 +6,7 @@ class CRM_TwingleCampaign_BAO_Configuration {
|
|||
private static $settingsKeys = [
|
||||
'twingle_api_key',
|
||||
'twinglecampaign_xcm_profile',
|
||||
'twinglecampaign_start_case',
|
||||
'twinglecampaign_default_case',
|
||||
'twinglecampaign_soft_credits'
|
||||
];
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ class CRM_TwingleCampaign_BAO_CustomField {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a CustomField by calling CiviCRM API v.3
|
||||
*
|
||||
* @param bool $upgrade
|
||||
* If true: Does not show UF message if custom field already exists
|
||||
*
|
||||
* @returns array Result of custom field creation api call
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
|
@ -79,38 +79,44 @@ class CRM_TwingleCampaign_BAO_CustomField {
|
|||
|
||||
// If the field does not exist, create it
|
||||
if ($field['count'] == 0) {
|
||||
$this->result = civicrm_api3(
|
||||
'CustomField',
|
||||
'create',
|
||||
$this->getSetAttributes());
|
||||
|
||||
// Set field id
|
||||
$this->id = $this->result['id'];
|
||||
try {
|
||||
$this->result = civicrm_api3(
|
||||
'CustomField',
|
||||
'create',
|
||||
$this->getSetAttributes());
|
||||
|
||||
// Log field creation
|
||||
if ($this->result['is_error'] == 0) {
|
||||
Civi::log()->info("$this->extensionName has created a new custom field.
|
||||
label: $this->label
|
||||
name: $this->name
|
||||
id: $this->id
|
||||
group: $this->custom_group_id"
|
||||
);
|
||||
return $this->result;
|
||||
}
|
||||
// If the field could not get created: log error
|
||||
else {
|
||||
if ($this->result['is_error'] == 0) {
|
||||
|
||||
// Set field id
|
||||
$this->id = $this->result['id'];
|
||||
|
||||
// Log field creation
|
||||
Civi::log()->info("$this->extensionName has created a new custom field.
|
||||
label: $this->label
|
||||
name: $this->name
|
||||
id: $this->id
|
||||
group: $this->custom_group_id"
|
||||
);
|
||||
return $this->result;
|
||||
}
|
||||
else {
|
||||
throw new CiviCRM_API3_Exception($this->result['error_message']);
|
||||
}
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
// If the field could not get created: log error
|
||||
if ($this->name && $this->custom_group_id) {
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not create new custom field
|
||||
\"$this->name\" for group \"$this->custom_group_id\":
|
||||
$this->result['error_message']");
|
||||
CRM_Utils_System::setUFMessage(E::ts('Creation of custom field \'%1\' failed. Find more information in the logs.', [1 => $this->name]));
|
||||
->error("$this->extensionName could not create new custom field \"$this->name\" for group \"$this->custom_group_id\": $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(E::ts('%1: Creation of custom field \'%2\' failed. Find more information in the logs.',
|
||||
[1 => $this->extensionName, 2 => $this->name]
|
||||
));
|
||||
}
|
||||
// If there is not enough information: log simple error message
|
||||
else {
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not create new custom field:
|
||||
$this->result['error_message']");
|
||||
->error("$this->extensionName could not create new custom field: $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(E::ts("Creation of custom field failed. Find more information in the logs."));
|
||||
}
|
||||
return $this->result;
|
||||
|
@ -127,6 +133,101 @@ class CRM_TwingleCampaign_BAO_CustomField {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing custom field
|
||||
*
|
||||
* @returns array Result of custom field creation api call
|
||||
*/
|
||||
public function update(): array {
|
||||
|
||||
try {
|
||||
$this->result = civicrm_api3(
|
||||
'CustomField',
|
||||
'create',
|
||||
$this->getSetAttributes());
|
||||
|
||||
// Log field creation
|
||||
if ($this->result['is_error'] == 0) {
|
||||
Civi::log()->info("$this->extensionName has updated a custom field.
|
||||
label: $this->label
|
||||
name: $this->name
|
||||
id: $this->id
|
||||
group: $this->custom_group_id"
|
||||
);
|
||||
return $this->result;
|
||||
}
|
||||
else {
|
||||
throw new CiviCRM_API3_Exception($this->result['error_message']);
|
||||
}
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
// If the field could not get created: log error
|
||||
$errorMessage = $e->getMessage();
|
||||
if ($this->name && $this->custom_group_id) {
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not create new custom field \"$this->name\" for group \"$this->custom_group_id\": $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(E::ts('Creation of custom field \'%1\' failed. Find more information in the logs.', [1 => $this->name]));
|
||||
}
|
||||
// If there is not enough information: log simple error message
|
||||
else {
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not create new custom field: $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(E::ts("Creation of custom field failed. Find more information in the logs."));
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add additional options to custom field
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function addOptions(array $options): array {
|
||||
$result = [];
|
||||
|
||||
try {
|
||||
$option_group_id = civicrm_api3(
|
||||
'CustomField',
|
||||
'getsingle',
|
||||
['id' => $this->id]
|
||||
)['option_group_id'];
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not get get option group id for custom field \"$this->name\": $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(
|
||||
E::ts('%1 could not get option group id for custom field \'%2\'. Find more information in the logs.',
|
||||
[1 => $this->extensionName, 2 => $this->name])
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
foreach ($options as $key => $value) {
|
||||
$result[] = civicrm_api3(
|
||||
'OptionValue',
|
||||
'create',
|
||||
[
|
||||
'option_group_id' => $option_group_id,
|
||||
'value' => $key,
|
||||
'label' => $value,
|
||||
]
|
||||
);
|
||||
}
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
Civi::log()
|
||||
->error("$this->extensionName could not create additional option values for custom field \"$this->name\": $errorMessage");
|
||||
CRM_Utils_System::setUFMessage(
|
||||
E::ts('%1 could not create additional option values for custom field \'%2\'. Find more information in the logs.',
|
||||
[1 => $this->extensionName, 2 => $this->name])
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the set attributes of the object and returns them as an array.
|
||||
*
|
||||
|
@ -143,7 +244,6 @@ class CRM_TwingleCampaign_BAO_CustomField {
|
|||
return $setAttributes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an instance of a CustomField by its name or get an array with all
|
||||
* custom fields by leaving parameters empty.
|
||||
|
@ -362,6 +462,13 @@ class CRM_TwingleCampaign_BAO_CustomField {
|
|||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}#
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $option_values
|
||||
*/
|
||||
public function setOptionValues($option_values): void {
|
||||
$this->option_values = $option_values;
|
||||
}
|
||||
|
||||
}
|
|
@ -53,32 +53,39 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
|||
|
||||
if (parent::create()) {
|
||||
|
||||
// check for existence
|
||||
$result = civicrm_api3('Case', 'get', [
|
||||
'contact_id' => $this->formattedValues['contact'],
|
||||
'case_type_id' => Configuration::get('twinglecampaign_start_case'),
|
||||
'subject' => $this->formattedValues['title'] . ' | Event-ID: ' .
|
||||
$this->formattedValues['id'],
|
||||
]);
|
||||
// Get case type
|
||||
$parentProject = civicrm_api3(
|
||||
'TwingleProject',
|
||||
'getsingle',
|
||||
['id' => $this->values['parent_id']]
|
||||
);
|
||||
$caseType = $parentProject['case']
|
||||
?? Configuration::get('twinglecampaign_default_case');
|
||||
|
||||
// Open a case
|
||||
if (
|
||||
Configuration::get('twinglecampaign_start_case') &&
|
||||
$result['count'] == 0
|
||||
) {
|
||||
$result = civicrm_api3('Case', 'create', [
|
||||
if ($caseType) {
|
||||
// check for existence
|
||||
$result = civicrm_api3('Case', 'get', [
|
||||
'contact_id' => $this->formattedValues['contact'],
|
||||
'case_type_id' => Configuration::get('twinglecampaign_start_case'),
|
||||
'case_type_id' => $caseType,
|
||||
'subject' => $this->formattedValues['title'] . ' | Event-ID: ' .
|
||||
$this->formattedValues['id'],
|
||||
'start_date' => $this->formattedValues['created_at'],
|
||||
'status_id' => "Open",
|
||||
]);
|
||||
}
|
||||
if ($result['is_error'] != 0) {
|
||||
throw new Exception('Could not create case');
|
||||
}
|
||||
|
||||
// Open a case
|
||||
if ($result['count'] == 0) {
|
||||
$result = civicrm_api3('Case', 'create', [
|
||||
'contact_id' => $this->formattedValues['contact'],
|
||||
'case_type_id' => $caseType,
|
||||
'subject' => $this->formattedValues['title'] . ' | Event-ID: ' .
|
||||
$this->formattedValues['id'],
|
||||
'start_date' => $this->formattedValues['created_at'],
|
||||
'status_id' => "Open",
|
||||
]);
|
||||
}
|
||||
if ($result['is_error'] != 0) {
|
||||
throw new Exception('Could not create case');
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -4,6 +4,7 @@ use CRM_TwingleCampaign_BAO_Configuration as Configuration;
|
|||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
|
||||
include_once E::path() . '/CRM/TwingleCampaign/BAO/Configuration.php';
|
||||
include_once E::path() . '/CRM/TwingleCampaign/Utils/CaseTypes.php';
|
||||
|
||||
/**
|
||||
* Form controller class
|
||||
|
@ -32,9 +33,9 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
|
|||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'twinglecampaign_start_case',
|
||||
E::ts('Start a case for event initiators'),
|
||||
$this->getCaseTypes(),
|
||||
'twinglecampaign_default_case',
|
||||
E::ts('Default case to open for event initiators'),
|
||||
getCaseTypes(),
|
||||
['class' => 'crm-select2 huge']
|
||||
);
|
||||
|
||||
|
@ -92,30 +93,5 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
|
|||
return $xcmProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all case types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getCaseTypes(): array {
|
||||
$caseTypes = [NULL => E::ts('none')];
|
||||
try {
|
||||
$result = civicrm_api3('CaseType', 'get', [
|
||||
'sequential' => 1,
|
||||
'options' => ['limit' => 0]
|
||||
]);
|
||||
if (is_array($result['values'])) {
|
||||
foreach ($result['values'] as $case) {
|
||||
$caseTypes[$case['name']] = $case['title'];
|
||||
}
|
||||
}
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
Civi::log()->error(
|
||||
E::LONG_NAME . ' could not retrieve case types: ' .
|
||||
$e->getMessage());
|
||||
}
|
||||
return $caseTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
|
|||
* changed campaigns will get pulled from Twingle.
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public function upgrade_01(): bool {
|
||||
public function upgrade_02(): bool {
|
||||
|
||||
$campaign_info = require E::path() .
|
||||
'/CRM/TwingleCampaign/resources/campaigns.php';
|
||||
|
|
28
CRM/TwingleCampaign/Utils/CaseTypes.php
Normal file
28
CRM/TwingleCampaign/Utils/CaseTypes.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
|
||||
/**
|
||||
* Retrieves all case types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCaseTypes(): array {
|
||||
$caseTypes = [NULL => E::ts('none')];
|
||||
try {
|
||||
$result = civicrm_api3('CaseType', 'get', [
|
||||
'sequential' => 1,
|
||||
'options' => ['limit' => 0]
|
||||
]);
|
||||
if (is_array($result['values'])) {
|
||||
foreach ($result['values'] as $case) {
|
||||
$caseTypes[$case['name']] = $case['title'];
|
||||
}
|
||||
}
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
Civi::log()->error(
|
||||
E::LONG_NAME . ' could not retrieve case types: ' .
|
||||
$e->getMessage());
|
||||
}
|
||||
return $caseTypes;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
require_once E::path() . '/CRM/TwingleCampaign/Utils/CaseTypes.php';
|
||||
|
||||
return [
|
||||
"campaign_types" => [
|
||||
|
@ -121,6 +122,21 @@ return [
|
|||
"help_post" => E::ts("Choose the project type. Allow users to create own events or to pay a membership fee."),
|
||||
"default_value" => "default"
|
||||
],
|
||||
"twingle_project_case" => [
|
||||
"custom_group_id" => "Twingle_Project_Information",
|
||||
"label" => E::ts("Case"),
|
||||
"name" => "twingle_project_case",
|
||||
"is_required" => FALSE,
|
||||
"is_searchable" => 1,
|
||||
"data_type" => "String",
|
||||
"html_type" => "Select",
|
||||
"option_values" => getCaseTypes(),
|
||||
"text_length" => 32,
|
||||
"is_active" => 1,
|
||||
"is_view" => FALSE,
|
||||
"weight" => 3,
|
||||
"help_post" => E::ts("Which case should get opened for event creators?")
|
||||
],
|
||||
"twingle_project_allow_more" => [
|
||||
"custom_group_id" => "Twingle_Project_Information",
|
||||
"label" => E::ts("allow more"),
|
||||
|
|
BIN
l10n/de_DE/LC_MESSAGES/de_DE.mo
Normal file
BIN
l10n/de_DE/LC_MESSAGES/de_DE.mo
Normal file
Binary file not shown.
|
@ -7,17 +7,17 @@ msgstr ""
|
|||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.4.2\n"
|
||||
"X-Generator: Poedit 2.4.3\n"
|
||||
"Last-Translator: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: de_DE\n"
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid ""
|
||||
"Creation of custom field '%1' failed. Find more information in the logs."
|
||||
"%1: Creation of custom field '%2' failed. Find more information in the logs."
|
||||
msgstr ""
|
||||
"Erstellung von Custom Field '%1' fehlgeschlagen. Mehr Informationen in den "
|
||||
"Logs."
|
||||
"%1: Erstellen des benutzerdefinierten Feldes '%2' fehlgeschlagen. Mehr "
|
||||
"Informationen in den Logs."
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid "Creation of custom field failed. Find more information in the logs."
|
||||
|
@ -33,6 +33,29 @@ msgstr ""
|
|||
"Erstellung der Custom Field '%1' fehlgeschlagen, weil bereits eine Custom "
|
||||
"Field mit selbem Namen existiert. Mehr Informationen in den Logs."
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid ""
|
||||
"Creation of custom field '%1' failed. Find more information in the logs."
|
||||
msgstr ""
|
||||
"Erstellung von Custom Field '%1' fehlgeschlagen. Mehr Informationen in den "
|
||||
"Logs."
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid ""
|
||||
"%1 could not get option group id for custom field '%2'. Find more "
|
||||
"information in the logs."
|
||||
msgstr ""
|
||||
"%1 konnte die Option-Group-ID für das benutzerdefinierte Feld '%2' nicht "
|
||||
"finden. Mehr Informationen in den Logs."
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid ""
|
||||
"%1 could not create additional option values for custom field '%2'. Find "
|
||||
"more information in the logs."
|
||||
msgstr ""
|
||||
"%1 konnte dem benutzerdefinierte Feld '%2' keine zusätzlichen Optionen "
|
||||
"hinzufügen. Mehr Informationen in den Logs."
|
||||
|
||||
#: CRM/TwingleCampaign/BAO/CustomGroup.php
|
||||
msgid ""
|
||||
"Creation of custom group '%1' failed. Find more information in the logs."
|
||||
|
@ -120,8 +143,8 @@ msgid "XCM Profile to match event initiators"
|
|||
msgstr "XCM-Profil zum Abgleichen von Event-Initiatoren"
|
||||
|
||||
#: CRM/TwingleCampaign/Form/Settings.php
|
||||
msgid "Start a case for event initiators"
|
||||
msgstr "Einen Fall für Event-Initiatoren anlegen"
|
||||
msgid "Default case to open for event initiators"
|
||||
msgstr "Standarfdall, der für Event-Initiatoren eröffnet werden soll"
|
||||
|
||||
#: CRM/TwingleCampaign/Form/Settings.php
|
||||
msgid "Create soft credits for event initiators"
|
||||
|
@ -135,10 +158,6 @@ msgstr "Speichern"
|
|||
msgid "TwingleCampaign configuration saved"
|
||||
msgstr "TwingleCampaign Konfiguration gespeichert"
|
||||
|
||||
#: CRM/TwingleCampaign/Form/Settings.php
|
||||
msgid "none"
|
||||
msgstr "keine"
|
||||
|
||||
#: CRM/TwingleCampaign/Upgrader/Base.php
|
||||
msgid "Upgrade %1 to revision %2"
|
||||
msgstr "Upgrade %1 auf Revision %2"
|
||||
|
@ -182,6 +201,10 @@ msgstr ""
|
|||
msgid "Could not disable scheduled job \"TwingleSync\"."
|
||||
msgstr "Geplante Aufgabe \"TwingleSync\" konnte nicht deaktiviert werden."
|
||||
|
||||
#: CRM/TwingleCampaign/Utils/CaseTypes.php
|
||||
msgid "none"
|
||||
msgstr "keine"
|
||||
|
||||
#: CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Twingle Information"
|
||||
msgstr "Twingle Informationen"
|
||||
|
@ -250,6 +273,14 @@ msgstr ""
|
|||
"Wähle den Projekt-Typ: erlaube Benutzern ihre eigenen Spenden-Events "
|
||||
"anzulegen oder eine Mitgliedschaft zu bezahlen."
|
||||
|
||||
#: CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Case"
|
||||
msgstr "Fall"
|
||||
|
||||
#: CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Which case should get opened for event creators?"
|
||||
msgstr "Welcher Fall soll für Event-Initiatoren eröffnet werden?"
|
||||
|
||||
#: CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "allow more"
|
||||
msgstr "Mehr zulassen"
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
#: ./CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid "Creation of custom field '%1' failed. Find more information in the logs."
|
||||
msgid "%1: Creation of custom field '%2' failed. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/BAO/CustomField.php
|
||||
|
@ -10,6 +10,18 @@ msgstr ""
|
|||
msgid "Creation of custom field '%1' failed, because a custom field with that name already exists. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid "Creation of custom field '%1' failed. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid "%1 could not get option group id for custom field '%2'. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/BAO/CustomField.php
|
||||
msgid "%1 could not create additional option values for custom field '%2'. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/BAO/CustomGroup.php
|
||||
msgid "Creation of custom group '%1' failed. Find more information in the logs."
|
||||
msgstr ""
|
||||
|
@ -75,7 +87,7 @@ msgid "XCM Profile to match event initiators"
|
|||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/Form/Settings.php
|
||||
msgid "Start a case for event initiators"
|
||||
msgid "Default case to open for event initiators"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/Form/Settings.php
|
||||
|
@ -90,10 +102,6 @@ msgstr ""
|
|||
msgid "TwingleCampaign configuration saved"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/Form/Settings.php
|
||||
msgid "none"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/Upgrader/Base.php
|
||||
msgid "Upgrade %1 to revision %2"
|
||||
msgstr ""
|
||||
|
@ -126,6 +134,10 @@ msgstr ""
|
|||
msgid "Could not disable scheduled job \"TwingleSync\"."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/Utils/CaseTypes.php
|
||||
msgid "none"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Twingle Information"
|
||||
msgstr ""
|
||||
|
@ -186,6 +198,14 @@ msgstr ""
|
|||
msgid "Choose the project type. Allow users to create own events or to pay a membership fee."
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Case"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "Which case should get opened for event creators?"
|
||||
msgstr ""
|
||||
|
||||
#: ./CRM/TwingleCampaign/resources/campaigns.php
|
||||
msgid "allow more"
|
||||
msgstr ""
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="crm-section">
|
||||
<div class="label">{$form.twinglecampaign_start_case.label}</div>
|
||||
<div class="content">{$form.twinglecampaign_start_case.html}</div>
|
||||
<div class="label">{$form.twinglecampaign_default_case.label}</div>
|
||||
<div class="content">{$form.twinglecampaign_default_case.html}</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="crm-section">
|
||||
|
|
|
@ -4,6 +4,7 @@ use CRM_TwingleCampaign_Utils_ExtensionCache as ExtensionCache;
|
|||
use CRM_TwingleCampaign_BAO_TwingleProject as TwingleProject;
|
||||
use CRM_TwingleCampaign_BAO_TwingleApiCall as TwingleApiCall;
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use CRM_TwingleCampaign_BAO_CustomField as CustomField;
|
||||
|
||||
require_once 'twinglecampaign.civix.php';
|
||||
|
||||
|
@ -46,6 +47,14 @@ function twinglecampaign_civicrm_config(&$config) {
|
|||
}
|
||||
}
|
||||
|
||||
function twinglecampaign_civicrm_postSave_civicrm_case_type() {
|
||||
$twingle_project_case_custom_field =
|
||||
CustomField::fetch('twingle_project_case');
|
||||
$newCaseType = json_decode($_POST['json'], True);
|
||||
$twingle_project_case_custom_field->addOptions(
|
||||
[$newCaseType['name'] => $newCaseType['title']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_postSave_Campaign().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue