Merge branch 'dev_15'
[#15] Extension NOT COMPATIBLE with CiviCRM 5.19.3
This commit is contained in:
commit
3d5d6f0d97
4 changed files with 26 additions and 9 deletions
|
@ -152,7 +152,7 @@ class CRM_Twingle_Profile {
|
||||||
* @return string CiviCRM transaction ID
|
* @return string CiviCRM transaction ID
|
||||||
*/
|
*/
|
||||||
public function getTransactionID($twingle_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)) {
|
if (empty($prefix)) {
|
||||||
return $twingle_id;
|
return $twingle_id;
|
||||||
} else {
|
} else {
|
||||||
|
@ -338,7 +338,7 @@ class CRM_Twingle_Profile {
|
||||||
public static function getProfiles() {
|
public static function getProfiles() {
|
||||||
if (self::$_profiles === NULL) {
|
if (self::$_profiles === NULL) {
|
||||||
self::$_profiles = array();
|
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) {
|
foreach ($profiles_data as $profile_name => $profile_data) {
|
||||||
self::$_profiles[$profile_name] = new CRM_Twingle_Profile($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) {
|
foreach (self::$_profiles as $profile_name => $profile) {
|
||||||
$profile_data[$profile_name] = $profile->data;
|
$profile_data[$profile_name] = $profile->data;
|
||||||
}
|
}
|
||||||
CRM_Core_BAO_Setting::setItem((object) $profile_data, 'de.systopia.twingle', 'twingle_profiles');
|
Civi::settings()->set('twingle_profiles', $profile_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,10 +269,7 @@ class CRM_Twingle_Submission {
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
));
|
));
|
||||||
return
|
return
|
||||||
CRM_Core_BAO_Setting::getItem(
|
Civi::settings()->get('twingle_use_sepa')
|
||||||
'de.systopia.twingle',
|
|
||||||
'twingle_use_sepa'
|
|
||||||
)
|
|
||||||
&& $sepa_extension['count'];
|
&& $sepa_extension['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,11 @@ class CRM_Twingle_Tools {
|
||||||
if (self::$protection_suspended) return;
|
if (self::$protection_suspended) return;
|
||||||
|
|
||||||
// currently only works with prefixes
|
// 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;
|
if (empty($prefix)) return;
|
||||||
|
|
||||||
// check if protection is turned on
|
// 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;
|
if (empty($protection_on)) return;
|
||||||
|
|
||||||
// load the recurring contribution
|
// load the recurring contribution
|
||||||
|
|
|
@ -143,4 +143,24 @@ class CRM_Twingle_Upgrader extends CRM_Twingle_Upgrader_Base {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert serialized settings from objects to arrays.
|
||||||
|
*
|
||||||
|
* @link https://civicrm.org/advisory/civi-sa-2019-21-poi-saved-search-and-report-instance-apis
|
||||||
|
*/
|
||||||
|
public function upgrade_5011() {
|
||||||
|
// Do not use CRM_Core_BAO::getItem() or Civi::settings()->get().
|
||||||
|
// Extract and unserialize directly from the database.
|
||||||
|
$twingle_profiles_query = CRM_Core_DAO::executeQuery("
|
||||||
|
SELECT `value`
|
||||||
|
FROM `civicrm_setting`
|
||||||
|
WHERE `name` = 'twingle_profiles';");
|
||||||
|
if ($twingle_profiles_query->fetch()) {
|
||||||
|
$profiles = unserialize($twingle_profiles_query->value);
|
||||||
|
Civi::settings()->set('twingle_profiles', (array) $profiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue