[#15] Replace CRM_Core_BAO_Setting methods getItem and setItem with Civi::settings() methods.

This commit is contained in:
Jens Schuppe 2019-11-29 10:34:02 +01:00
parent f2b94b72e7
commit dfe433d545
3 changed files with 6 additions and 9 deletions

View file

@ -152,7 +152,7 @@ class CRM_Twingle_Profile {
* @return string CiviCRM transaction ID
*/
public function getTransactionID($twingle_id) {
$prefix = CRM_Core_BAO_Setting::getItem('de.systopia.twingle', 'twingle_prefix');
$prefix = Civi::settings()->get('twingle_prefix');
if (empty($prefix)) {
return $twingle_id;
} else {
@ -338,7 +338,7 @@ class CRM_Twingle_Profile {
public static function getProfiles() {
if (self::$_profiles === NULL) {
self::$_profiles = array();
if ($profiles_data = CRM_Core_BAO_Setting::getItem('de.systopia.twingle', 'twingle_profiles')) {
if ($profiles_data = Civi::settings()->get('twingle_profiles')) {
foreach ($profiles_data as $profile_name => $profile_data) {
self::$_profiles[$profile_name] = new CRM_Twingle_Profile($profile_name, $profile_data);
}
@ -363,6 +363,6 @@ class CRM_Twingle_Profile {
foreach (self::$_profiles as $profile_name => $profile) {
$profile_data[$profile_name] = $profile->data;
}
CRM_Core_BAO_Setting::setItem($profile_data, 'de.systopia.twingle', 'twingle_profiles');
Civi::settings()->set('twingle_profiles', $profile_data);
}
}

View file

@ -269,10 +269,7 @@ class CRM_Twingle_Submission {
'is_active' => 1,
));
return
CRM_Core_BAO_Setting::getItem(
'de.systopia.twingle',
'twingle_use_sepa'
)
Civi::settings()->get('twingle_use_sepa')
&& $sepa_extension['count'];
}

View file

@ -42,11 +42,11 @@ class CRM_Twingle_Tools {
if (self::$protection_suspended) return;
// currently only works with prefixes
$prefix = CRM_Core_BAO_Setting::getItem('de.systopia.twingle', 'twingle_prefix');
$prefix = Civi::settings()->get('twingle_prefix');
if (empty($prefix)) return;
// check if protection is turned on
$protection_on = CRM_Core_BAO_Setting::getItem('de.systopia.twingle', 'twingle_protect_recurring');
$protection_on = Civi::settings()->get('twingle_protect_recurring');
if (empty($protection_on)) return;
// load the recurring contribution