make soft credits optional
This commit is contained in:
parent
6cac4882b5
commit
db15d5deb1
4 changed files with 26 additions and 3 deletions
|
@ -7,6 +7,7 @@ class CRM_TwingleCampaign_BAO_Configuration {
|
|||
'twingle_api_key',
|
||||
'twinglecampaign_xcm_profile',
|
||||
'twinglecampaign_start_case',
|
||||
'twinglecampaign_soft_credits'
|
||||
];
|
||||
|
||||
|
||||
|
@ -17,13 +18,19 @@ class CRM_TwingleCampaign_BAO_Configuration {
|
|||
* Expects an array with key => value for the setting
|
||||
*/
|
||||
public static function set(array $settings) {
|
||||
|
||||
// Set twinglecampaign_soft_credits to '0' if checkbox is unchecked
|
||||
if (!array_key_exists('twinglecampaign_soft_credits', $settings)) {
|
||||
Civi::settings()->set('twinglecampaign_soft_credits', 0);
|
||||
}
|
||||
|
||||
Civi::settings()->add($settings);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a specific value of a setting if the key is passed as parameter.
|
||||
* Else all settings will be returned als associative array.
|
||||
* Else all settings will be returned as associative array.
|
||||
*
|
||||
* @param null $key
|
||||
* The name of the setting or NULL
|
||||
|
@ -31,7 +38,7 @@ class CRM_TwingleCampaign_BAO_Configuration {
|
|||
* @return array|mixed|null
|
||||
*/
|
||||
public static function get($key = NULL) {
|
||||
if ($key) {
|
||||
if (!is_null($key)) {
|
||||
return Civi::settings()->get($key);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue