code cleanup

This commit is contained in:
Marc Michalsky forumZFD 2021-03-04 17:56:27 +01:00
parent db15d5deb1
commit e5a0400b34
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 12 additions and 13 deletions

View file

@ -16,21 +16,24 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
public function buildQuickForm() { public function buildQuickForm() {
$this->addElement('text', $this->addElement(
'text',
'twingle_api_key', 'twingle_api_key',
E::ts('Twingle API key') E::ts('Twingle API key')
); );
$this->addElement('select', $this->addElement(
'select',
'twinglecampaign_xcm_profile', 'twinglecampaign_xcm_profile',
E::ts('XCM Profile to match event initiator'), E::ts('XCM Profile to match event initiators'),
$this->getXCMProfiles(), $this->getXCMProfiles(),
['class' => 'crm-select2 huge'] ['class' => 'crm-select2 huge']
); );
$this->addElement('select', $this->addElement(
'select',
'twinglecampaign_start_case', 'twinglecampaign_start_case',
E::ts('Start a case for event initiator'), E::ts('Start a case for event initiators'),
$this->getCaseTypes(), $this->getCaseTypes(),
['class' => 'crm-select2 huge'] ['class' => 'crm-select2 huge']
); );
@ -75,7 +78,7 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
* *
* @return array * @return array
*/ */
private function getXCMProfiles() { private function getXCMProfiles(): array {
$xcmProfiles = []; $xcmProfiles = [];
if (method_exists('CRM_Xcm_Configuration', 'getProfileList')) { if (method_exists('CRM_Xcm_Configuration', 'getProfileList')) {
$profiles = CRM_Xcm_Configuration::getProfileList(); $profiles = CRM_Xcm_Configuration::getProfileList();
@ -91,7 +94,7 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
* *
* @return array * @return array
*/ */
private function getCaseTypes() { private function getCaseTypes(): array {
$caseTypes = [NULL => E::ts('none')]; $caseTypes = [NULL => E::ts('none')];
try { try {
$result = civicrm_api3('CaseType', 'get', [ $result = civicrm_api3('CaseType', 'get', [
@ -104,7 +107,7 @@ class CRM_TwingleCampaign_Form_Settings extends CRM_Core_Form {
} }
} catch (CiviCRM_API3_Exception $e) { } catch (CiviCRM_API3_Exception $e) {
Civi::log()->error( Civi::log()->error(
'TwingleCampaign could not retrieve case types: ' . E::LONG_NAME . ' could not retrieve case types: ' .
$e->getMessage()); $e->getMessage());
} }
return $caseTypes; return $caseTypes;

View file

@ -55,10 +55,6 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
$ov = new OptionValue($option_value); $ov = new OptionValue($option_value);
$ov->create(); $ov->create();
} }
// Create XCM-Profile
// TODO: create XCM-Profil
} }
/** /**