Merge remote-tracking branch 'MarcMichalsky/minor_changes'
[#77] Minor changes/Code cleanup
This commit is contained in:
commit
df608dc3d0
2 changed files with 86 additions and 87 deletions
|
@ -278,22 +278,19 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
'select',
|
'select',
|
||||||
'prefix_male',
|
'prefix_male',
|
||||||
E::ts('Prefix option for submitted value "male"'),
|
E::ts('Prefix option for submitted value "male"'),
|
||||||
static::getPrefixOptions(),
|
static::getPrefixOptions()
|
||||||
FALSE
|
|
||||||
);
|
);
|
||||||
$this->add(
|
$this->add(
|
||||||
'select',
|
'select',
|
||||||
'prefix_female',
|
'prefix_female',
|
||||||
E::ts('Prefix option for submitted value "female"'),
|
E::ts('Prefix option for submitted value "female"'),
|
||||||
static::getPrefixOptions(),
|
static::getPrefixOptions()
|
||||||
FALSE
|
|
||||||
);
|
);
|
||||||
$this->add(
|
$this->add(
|
||||||
'select',
|
'select',
|
||||||
'prefix_other',
|
'prefix_other',
|
||||||
E::ts('Prefix option for submitted value "other"'),
|
E::ts('Prefix option for submitted value "other"'),
|
||||||
static::getPrefixOptions(),
|
static::getPrefixOptions()
|
||||||
FALSE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$payment_instruments = CRM_Twingle_Profile::paymentInstruments();
|
$payment_instruments = CRM_Twingle_Profile::paymentInstruments();
|
||||||
|
@ -302,7 +299,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
$this->add(
|
$this->add(
|
||||||
'select', // field type
|
'select', // field type
|
||||||
$pi_name, // field name
|
$pi_name, // field name
|
||||||
E::ts('Record %1 as', array(1 => $pi_label)), // field label
|
E::ts('Record %1 as', [1 => $pi_label]), // field label
|
||||||
static::getPaymentInstruments(), // list of options
|
static::getPaymentInstruments(), // list of options
|
||||||
TRUE // is required
|
TRUE // is required
|
||||||
);
|
);
|
||||||
|
@ -310,7 +307,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
$this->add(
|
$this->add(
|
||||||
'select',
|
'select',
|
||||||
$pi_name . '_status',
|
$pi_name . '_status',
|
||||||
E::ts('Record %1 donations with contribution status', array(1 => $pi_label)),
|
E::ts('Record %1 donations with contribution status', [1 => $pi_label]),
|
||||||
static::getContributionStatusOptions(),
|
static::getContributionStatusOptions(),
|
||||||
TRUE
|
TRUE
|
||||||
);
|
);
|
||||||
|
@ -331,7 +328,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
'newsletter_double_opt_in', // field name
|
'newsletter_double_opt_in', // field name
|
||||||
E::ts('Use Double-Opt-In for newsletter'), // field label
|
E::ts('Use Double-Opt-In for newsletter'), // field label
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array()
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
|
@ -340,7 +337,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
E::ts('Sign up for newsletter groups'), // field label
|
E::ts('Sign up for newsletter groups'), // field label
|
||||||
static::getNewsletterGroups(), // list of options
|
static::getNewsletterGroups(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge', 'multiple' => 'multiple')
|
['class' => 'crm-select2 huge', 'multiple' => 'multiple']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
|
@ -349,7 +346,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
E::ts('Sign up for postal mail groups'), // field label
|
E::ts('Sign up for postal mail groups'), // field label
|
||||||
static::getPostinfoGroups(), // list of options
|
static::getPostinfoGroups(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge', 'multiple' => 'multiple')
|
['class' => 'crm-select2 huge', 'multiple' => 'multiple']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
|
@ -358,16 +355,16 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
E::ts('Sign up for Donation receipt groups'), // field label
|
E::ts('Sign up for Donation receipt groups'), // field label
|
||||||
static::getDonationReceiptGroups(), // list of options
|
static::getDonationReceiptGroups(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge', 'multiple' => 'multiple')
|
['class' => 'crm-select2 huge', 'multiple' => 'multiple']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
'select', // field type
|
'select', // field type
|
||||||
'campaign', // field name
|
'campaign', // field name
|
||||||
E::ts('Default Campaign'), // field label
|
E::ts('Default Campaign'), // field label
|
||||||
array('' => E::ts('- none -')) + static::getCampaigns(), // list of options
|
['' => E::ts('- none -')] + static::getCampaigns(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge')
|
['class' => 'crm-select2 huge']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
|
@ -389,17 +386,17 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
'select', // field type
|
'select', // field type
|
||||||
'membership_type_id', // field name
|
'membership_type_id', // field name
|
||||||
E::ts('Create membership of type'), // field label
|
E::ts('Create membership of type'), // field label
|
||||||
array('' => E::ts('- none -')) + static::getMembershipTypes(), // list of options
|
['' => E::ts('- none -')] + static::getMembershipTypes(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge')
|
['class' => 'crm-select2 huge']
|
||||||
);
|
);
|
||||||
$this->add(
|
$this->add(
|
||||||
'select', // field type
|
'select', // field type
|
||||||
'membership_type_id_recur', // field name
|
'membership_type_id_recur', // field name
|
||||||
E::ts('Create membership of type (recurring)'), // field label
|
E::ts('Create membership of type (recurring)'), // field label
|
||||||
array('' => E::ts('- none -')) + static::getMembershipTypes(), // list of options
|
['' => E::ts('- none -')] + static::getMembershipTypes(), // list of options
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge')
|
['class' => 'crm-select2 huge']
|
||||||
);
|
);
|
||||||
$this->add(
|
$this->add(
|
||||||
'text',
|
'text',
|
||||||
|
@ -413,7 +410,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
'text', // field type
|
'text', // field type
|
||||||
'contribution_source', // field name
|
'contribution_source', // field name
|
||||||
E::ts('Contribution source'), // field label
|
E::ts('Contribution source'), // field label
|
||||||
array()
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
|
@ -434,16 +431,16 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
'textarea', // field type
|
'textarea', // field type
|
||||||
'custom_field_mapping', // field name
|
'custom_field_mapping', // field name
|
||||||
E::ts('Custom field mapping'), // field label
|
E::ts('Custom field mapping'), // field label
|
||||||
array()
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addButtons(array(
|
$this->addButtons([
|
||||||
array(
|
[
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'name' => E::ts('Save'),
|
'name' => E::ts('Save'),
|
||||||
'isDefault' => TRUE,
|
'isDefault' => TRUE,
|
||||||
),
|
],
|
||||||
));
|
]);
|
||||||
|
|
||||||
// Export form elements.
|
// Export form elements.
|
||||||
parent::buildQuickForm();
|
parent::buildQuickForm();
|
||||||
|
@ -547,7 +544,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public function setDefaultValues() {
|
public function setDefaultValues() {
|
||||||
$defaults = parent::setDefaultValues();
|
$defaults = parent::setDefaultValues();
|
||||||
if (in_array($this->_op, array('create', 'edit', 'copy'))) {
|
if (in_array($this->_op, ['create', 'edit', 'copy'])) {
|
||||||
$defaults['name'] = $this->profile->getName();
|
$defaults['name'] = $this->profile->getName();
|
||||||
$profile_data = $this->profile->getData();
|
$profile_data = $this->profile->getData();
|
||||||
foreach ($profile_data as $element_name => $value) {
|
foreach ($profile_data as $element_name => $value) {
|
||||||
|
@ -597,11 +594,11 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getLocationTypes() {
|
public static function getLocationTypes() {
|
||||||
if (!isset(static::$_locationTypes)) {
|
if (!isset(static::$_locationTypes)) {
|
||||||
static::$_locationTypes = array();
|
static::$_locationTypes = [];
|
||||||
$query = civicrm_api3('LocationType', 'get', array(
|
$query = civicrm_api3('LocationType', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $type) {
|
foreach ($query['values'] as $type) {
|
||||||
static::$_locationTypes[$type['id']] = $type['name'];
|
static::$_locationTypes[$type['id']] = $type['name'];
|
||||||
}
|
}
|
||||||
|
@ -616,10 +613,10 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getXCMProfiles() {
|
public static function getXCMProfiles() {
|
||||||
if (!isset(static::$_xcm_profiles)) {
|
if (!isset(static::$_xcm_profiles)) {
|
||||||
static::$_xcm_profiles = array(
|
|
||||||
'' => E::ts("<default profile>"),
|
|
||||||
);
|
|
||||||
if (method_exists('CRM_Xcm_Configuration', 'getProfileList')) {
|
if (method_exists('CRM_Xcm_Configuration', 'getProfileList')) {
|
||||||
|
static::$_xcm_profiles = array(
|
||||||
|
'' => E::ts("<select profile>"),
|
||||||
|
);
|
||||||
$profiles = CRM_Xcm_Configuration::getProfileList();
|
$profiles = CRM_Xcm_Configuration::getProfileList();
|
||||||
foreach ($profiles as $profile_key => $profile_name) {
|
foreach ($profiles as $profile_key => $profile_name) {
|
||||||
static::$_xcm_profiles[$profile_key] = $profile_name;
|
static::$_xcm_profiles[$profile_key] = $profile_name;
|
||||||
|
@ -639,12 +636,12 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getFinancialTypes() {
|
public static function getFinancialTypes() {
|
||||||
if (!isset(static::$_financialTypes)) {
|
if (!isset(static::$_financialTypes)) {
|
||||||
static::$_financialTypes = array();
|
static::$_financialTypes = [];
|
||||||
$query = civicrm_api3('FinancialType', 'get', array(
|
$query = civicrm_api3('FinancialType', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => 'id,name'
|
'return' => 'id,name'
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $type) {
|
foreach ($query['values'] as $type) {
|
||||||
static::$_financialTypes[$type['id']] = $type['name'];
|
static::$_financialTypes[$type['id']] = $type['name'];
|
||||||
}
|
}
|
||||||
|
@ -662,12 +659,12 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getMembershipTypes() {
|
public static function getMembershipTypes() {
|
||||||
if (!isset(static::$_membershipTypes)) {
|
if (!isset(static::$_membershipTypes)) {
|
||||||
static::$_membershipTypes = array();
|
static::$_membershipTypes = [];
|
||||||
$query = civicrm_api3('MembershipType', 'get', array(
|
$query = civicrm_api3('MembershipType', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => 'id,name'
|
'return' => 'id,name'
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $type) {
|
foreach ($query['values'] as $type) {
|
||||||
static::$_membershipTypes[$type['id']] = $type['name'];
|
static::$_membershipTypes[$type['id']] = $type['name'];
|
||||||
}
|
}
|
||||||
|
@ -685,16 +682,16 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getGenderOptions() {
|
public static function getGenderOptions() {
|
||||||
if (!isset(static::$_genderOptions)) {
|
if (!isset(static::$_genderOptions)) {
|
||||||
static::$_genderOptions = array();
|
static::$_genderOptions = [];
|
||||||
$query = civicrm_api3('OptionValue', 'get', array(
|
$query = civicrm_api3('OptionValue', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'option_group_id' => 'gender',
|
'option_group_id' => 'gender',
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => array(
|
'return' => [
|
||||||
'value',
|
'value',
|
||||||
'label',
|
'label',
|
||||||
),
|
],
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $gender) {
|
foreach ($query['values'] as $gender) {
|
||||||
static::$_genderOptions[$gender['value']] = $gender['label'];
|
static::$_genderOptions[$gender['value']] = $gender['label'];
|
||||||
}
|
}
|
||||||
|
@ -712,16 +709,16 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getPrefixOptions() {
|
public static function getPrefixOptions() {
|
||||||
if (!isset(static::$_prefixOptions)) {
|
if (!isset(static::$_prefixOptions)) {
|
||||||
static::$_prefixOptions = array('' => E::ts('none'));
|
static::$_prefixOptions = ['' => E::ts('none')];
|
||||||
$query = civicrm_api3('OptionValue', 'get', array(
|
$query = civicrm_api3('OptionValue', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'option_group_id' => 'individual_prefix',
|
'option_group_id' => 'individual_prefix',
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => array(
|
'return' => [
|
||||||
'value',
|
'value',
|
||||||
'label',
|
'label',
|
||||||
),
|
],
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $prefix) {
|
foreach ($query['values'] as $prefix) {
|
||||||
static::$_prefixOptions[$prefix['value']] = $prefix['label'];
|
static::$_prefixOptions[$prefix['value']] = $prefix['label'];
|
||||||
}
|
}
|
||||||
|
@ -738,11 +735,11 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getSepaCreditors() {
|
public static function getSepaCreditors() {
|
||||||
if (!isset(static::$_sepaCreditors)) {
|
if (!isset(static::$_sepaCreditors)) {
|
||||||
static::$_sepaCreditors = array();
|
static::$_sepaCreditors = [];
|
||||||
if (CRM_Twingle_Submission::civiSepaEnabled()) {
|
if (CRM_Twingle_Submission::civiSepaEnabled()) {
|
||||||
$result = civicrm_api3('SepaCreditor', 'get', array(
|
$result = civicrm_api3('SepaCreditor', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
));
|
]);
|
||||||
foreach ($result['values'] as $sepa_creditor) {
|
foreach ($result['values'] as $sepa_creditor) {
|
||||||
static::$_sepaCreditors[$sepa_creditor['id']] = $sepa_creditor['name'];
|
static::$_sepaCreditors[$sepa_creditor['id']] = $sepa_creditor['name'];
|
||||||
}
|
}
|
||||||
|
@ -761,13 +758,13 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getPaymentInstruments() {
|
public static function getPaymentInstruments() {
|
||||||
if (!isset(self::$_paymentInstruments)) {
|
if (!isset(self::$_paymentInstruments)) {
|
||||||
self::$_paymentInstruments = array();
|
self::$_paymentInstruments = [];
|
||||||
$query = civicrm_api3('OptionValue', 'get', array(
|
$query = civicrm_api3('OptionValue', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'option_group_id' => 'payment_instrument',
|
'option_group_id' => 'payment_instrument',
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => 'value,label'
|
'return' => 'value,label'
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $payment_instrument) {
|
foreach ($query['values'] as $payment_instrument) {
|
||||||
// Do not include CiviSEPA payment instruments, but add a SEPA option if
|
// Do not include CiviSEPA payment instruments, but add a SEPA option if
|
||||||
// enabled.
|
// enabled.
|
||||||
|
@ -799,14 +796,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
$query = civicrm_api3(
|
$query = civicrm_api3(
|
||||||
'OptionValue',
|
'OptionValue',
|
||||||
'get',
|
'get',
|
||||||
array(
|
[
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'option_group_id' => 'contribution_status',
|
'option_group_id' => 'contribution_status',
|
||||||
'return' => array(
|
'return' => [
|
||||||
'value',
|
'value',
|
||||||
'label',
|
'label',
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($query['values'] as $contribution_status) {
|
foreach ($query['values'] as $contribution_status) {
|
||||||
|
@ -828,20 +825,20 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getNewsletterGroups() {
|
public static function getNewsletterGroups() {
|
||||||
if (!isset(static::$_newsletterGroups)) {
|
if (!isset(static::$_newsletterGroups)) {
|
||||||
static::$_newsletterGroups = array();
|
static::$_newsletterGroups = [];
|
||||||
$group_types = civicrm_api3('OptionValue', 'get', array(
|
$group_types = civicrm_api3('OptionValue', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'option_group_id' => 'group_type',
|
'option_group_id' => 'group_type',
|
||||||
'name' => CRM_Twingle_Submission::GROUP_TYPE_NEWSLETTER,
|
'name' => CRM_Twingle_Submission::GROUP_TYPE_NEWSLETTER,
|
||||||
));
|
]);
|
||||||
if ($group_types['count'] > 0) {
|
if ($group_types['count'] > 0) {
|
||||||
$group_type = reset($group_types['values']);
|
$group_type = reset($group_types['values']);
|
||||||
$query = civicrm_api3('Group', 'get', array(
|
$query = civicrm_api3('Group', 'get', [
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'group_type' => array('LIKE' => '%' . CRM_Utils_Array::implodePadded($group_type['value']) . '%'),
|
'group_type' => ['LIKE' => '%' . CRM_Utils_Array::implodePadded($group_type['value']) . '%'],
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'return' => 'id,name'
|
'return' => 'id,name'
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $group) {
|
foreach ($query['values'] as $group) {
|
||||||
static::$_newsletterGroups[$group['id']] = $group['name'];
|
static::$_newsletterGroups[$group['id']] = $group['name'];
|
||||||
}
|
}
|
||||||
|
@ -862,12 +859,12 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getGroups() {
|
public static function getGroups() {
|
||||||
if (!isset(static::$_groups)) {
|
if (!isset(static::$_groups)) {
|
||||||
static::$_groups = array();
|
static::$_groups = [];
|
||||||
$query = civicrm_api3('Group', 'get', array(
|
$query = civicrm_api3('Group', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'return' => 'id,name'
|
'return' => 'id,name'
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $group) {
|
foreach ($query['values'] as $group) {
|
||||||
static::$_groups[$group['id']] = $group['name'];
|
static::$_groups[$group['id']] = $group['name'];
|
||||||
}
|
}
|
||||||
|
@ -908,14 +905,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
*/
|
*/
|
||||||
public static function getCampaigns() {
|
public static function getCampaigns() {
|
||||||
if (!isset(static::$_campaigns)) {
|
if (!isset(static::$_campaigns)) {
|
||||||
static::$_campaigns = array();
|
static::$_campaigns = [];
|
||||||
$query = civicrm_api3('Campaign', 'get', array(
|
$query = civicrm_api3('Campaign', 'get', [
|
||||||
'option.limit' => 0,
|
'option.limit' => 0,
|
||||||
'return' => array(
|
'return' => [
|
||||||
'id',
|
'id',
|
||||||
'title',
|
'title',
|
||||||
)
|
]
|
||||||
));
|
]);
|
||||||
foreach ($query['values'] as $campaign) {
|
foreach ($query['values'] as $campaign) {
|
||||||
static::$_campaigns[$campaign['id']] = $campaign['title'];
|
static::$_campaigns[$campaign['id']] = $campaign['title'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@ class CRM_Twingle_Profile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs (production) access to this profile
|
* Logs (production) access to this profile
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function logAccess() {
|
public function logAccess() {
|
||||||
CRM_Core_DAO::executeQuery("
|
CRM_Core_DAO::executeQuery("
|
||||||
|
@ -90,7 +88,7 @@ class CRM_Twingle_Profile {
|
||||||
$custom_field_mapping = [];
|
$custom_field_mapping = [];
|
||||||
if (!empty($custom_field_definition = $this->getAttribute('custom_field_mapping'))) {
|
if (!empty($custom_field_definition = $this->getAttribute('custom_field_mapping'))) {
|
||||||
foreach (preg_split('/\r\n|\r|\n/', $custom_field_definition, -1, PREG_SPLIT_NO_EMPTY) as $custom_field_map) {
|
foreach (preg_split('/\r\n|\r|\n/', $custom_field_definition, -1, PREG_SPLIT_NO_EMPTY) as $custom_field_map) {
|
||||||
list($twingle_field_name, $custom_field_name) = explode("=", $custom_field_map);
|
[$twingle_field_name, $custom_field_name] = explode("=", $custom_field_map);
|
||||||
$custom_field_mapping[$twingle_field_name] = $custom_field_name;
|
$custom_field_mapping[$twingle_field_name] = $custom_field_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,12 +131,7 @@ class CRM_Twingle_Profile {
|
||||||
* @return mixed | NULL
|
* @return mixed | NULL
|
||||||
*/
|
*/
|
||||||
public function getAttribute($attribute_name, $default = NULL) {
|
public function getAttribute($attribute_name, $default = NULL) {
|
||||||
if (isset($this->data[$attribute_name])) {
|
return $this->data[$attribute_name] ?? $default;
|
||||||
return $this->data[$attribute_name];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,7 +274,6 @@ class CRM_Twingle_Profile {
|
||||||
'pi_paypal' => E::ts('PayPal'),
|
'pi_paypal' => E::ts('PayPal'),
|
||||||
'pi_sofortueberweisung' => E::ts('SOFORT Überweisung'),
|
'pi_sofortueberweisung' => E::ts('SOFORT Überweisung'),
|
||||||
'pi_amazonpay' => E::ts('Amazon Pay'),
|
'pi_amazonpay' => E::ts('Amazon Pay'),
|
||||||
'pi_paydirekt' => E::ts('paydirekt'),
|
|
||||||
'pi_applepay' => E::ts('Apple Pay'),
|
'pi_applepay' => E::ts('Apple Pay'),
|
||||||
'pi_googlepay' => E::ts('Google Pay'),
|
'pi_googlepay' => E::ts('Google Pay'),
|
||||||
'pi_paydirekt' => E::ts('Paydirekt'),
|
'pi_paydirekt' => E::ts('Paydirekt'),
|
||||||
|
@ -310,7 +302,7 @@ class CRM_Twingle_Profile {
|
||||||
'financial_type_id_recur' => 1, // "Donation"
|
'financial_type_id_recur' => 1, // "Donation"
|
||||||
'pi_banktransfer' => 5, // "EFT"
|
'pi_banktransfer' => 5, // "EFT"
|
||||||
'pi_debit_manual' => NULL,
|
'pi_debit_manual' => NULL,
|
||||||
'pi_debit_automatic' => 3, // Debit
|
'pi_debit_automatic' => 2, // Debit
|
||||||
'pi_creditcard' => 1, // "Credit Card"
|
'pi_creditcard' => 1, // "Credit Card"
|
||||||
'pi_mobilephone_germany' => NULL,
|
'pi_mobilephone_germany' => NULL,
|
||||||
'pi_paypal' => NULL,
|
'pi_paypal' => NULL,
|
||||||
|
@ -319,7 +311,6 @@ class CRM_Twingle_Profile {
|
||||||
'pi_paydirekt' => NULL,
|
'pi_paydirekt' => NULL,
|
||||||
'pi_applepay' => NULL,
|
'pi_applepay' => NULL,
|
||||||
'pi_googlepay' => NULL,
|
'pi_googlepay' => NULL,
|
||||||
'pi_paydirekt' => NULL,
|
|
||||||
'pi_twint' => NULL,
|
'pi_twint' => NULL,
|
||||||
'pi_ideal' => NULL,
|
'pi_ideal' => NULL,
|
||||||
'pi_post_finance' => NULL,
|
'pi_post_finance' => NULL,
|
||||||
|
@ -359,6 +350,8 @@ class CRM_Twingle_Profile {
|
||||||
* @param $project_id
|
* @param $project_id
|
||||||
*
|
*
|
||||||
* @return CRM_Twingle_Profile
|
* @return CRM_Twingle_Profile
|
||||||
|
* @throws \CRM\Twingle\Exceptions\ProfileException
|
||||||
|
* @throws \Civi\Core\Exception\DBQueryException
|
||||||
*/
|
*/
|
||||||
public static function getProfileForProject($project_id) {
|
public static function getProfileForProject($project_id) {
|
||||||
$profiles = self::getProfiles();
|
$profiles = self::getProfiles();
|
||||||
|
@ -370,7 +363,16 @@ class CRM_Twingle_Profile {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If none matches, use the default profile.
|
// If none matches, use the default profile.
|
||||||
return $profiles['default'];
|
$default_profile = $profiles['default'];
|
||||||
|
if (!empty($default_profile)) {
|
||||||
|
return $default_profile;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new ProfileException(
|
||||||
|
'Could not find default profile',
|
||||||
|
ProfileException::ERROR_CODE_DEFAULT_PROFILE_NOT_FOUND
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue