implement TwingleShop integration
This commit is contained in:
parent
ea46e6a747
commit
8cfa270dff
60 changed files with 5200 additions and 106 deletions
|
@ -43,6 +43,16 @@ class CRM_Twingle_Profile {
|
|||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* @var array $check_box_fields
|
||||
* List of check box fields
|
||||
*/
|
||||
public $check_box_fields = [
|
||||
'newsletter_double_opt_in',
|
||||
'enable_shop_integration',
|
||||
'shop_map_products',
|
||||
];
|
||||
|
||||
/**
|
||||
* CRM_Twingle_Profile constructor.
|
||||
*
|
||||
|
@ -197,6 +207,16 @@ class CRM_Twingle_Profile {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if Twingle Shop integration is enabled in general and
|
||||
* specifically for this profile.
|
||||
* @return bool
|
||||
*/
|
||||
public function isShopEnabled(): bool {
|
||||
return Civi::settings()->get('twingle_use_shop') &&
|
||||
$this->data['enable_shop_integration'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an attribute of the profile.
|
||||
*
|
||||
|
@ -532,6 +552,10 @@ class CRM_Twingle_Profile {
|
|||
'required_address_components' => ['required' => FALSE],
|
||||
'map_as_contribution_notes' => ['required' => FALSE],
|
||||
'map_as_contact_notes' => ['required' => FALSE],
|
||||
'enable_shop_integration' => ['required' => FALSE],
|
||||
'shop_financial_type' => ['required' => FALSE],
|
||||
'shop_donation_financial_type' => ['required' => FALSE],
|
||||
'shop_map_products' => ['required' => FALSE],
|
||||
],
|
||||
// Add payment methods.
|
||||
array_combine(
|
||||
|
@ -650,6 +674,10 @@ class CRM_Twingle_Profile {
|
|||
],
|
||||
'map_as_contribution_notes' => [],
|
||||
'map_as_contact_notes' => [],
|
||||
'enable_shop_integration' => FALSE,
|
||||
'shop_financial_type' => 1,
|
||||
'shop_donation_financial_type' => 1,
|
||||
'shop_map_products' => FALSE,
|
||||
]
|
||||
// Add contribution status for all payment methods.
|
||||
// phpcs:ignore Drupal.Formatting.SpaceUnaryOperator.PlusMinus
|
||||
|
@ -666,7 +694,7 @@ class CRM_Twingle_Profile {
|
|||
* @param string $project_id
|
||||
*
|
||||
* @return CRM_Twingle_Profile
|
||||
* @throws \CRM\Twingle\Exceptions\ProfileException
|
||||
* @throws \Civi\Twingle\Exceptions\ProfileException
|
||||
* @throws \Civi\Core\Exception\DBQueryException
|
||||
*/
|
||||
public static function getProfileForProject($project_id) {
|
||||
|
@ -683,7 +711,6 @@ class CRM_Twingle_Profile {
|
|||
}
|
||||
|
||||
// If none matches, use the default profile.
|
||||
$default_profile = $profiles['default'];
|
||||
if (!empty($default_profile)) {
|
||||
return $default_profile;
|
||||
}
|
||||
|
@ -780,5 +807,4 @@ class CRM_Twingle_Profile {
|
|||
}
|
||||
return $stats;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue