[#5] Add a setting for differentiating membership types depending on donation rhythm
This commit is contained in:
parent
cd7c7e7d12
commit
bc9baea6f2
5 changed files with 38 additions and 17 deletions
|
@ -325,6 +325,14 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
FALSE, // is not required
|
FALSE, // is not required
|
||||||
array('class' => 'crm-select2 huge')
|
array('class' => 'crm-select2 huge')
|
||||||
);
|
);
|
||||||
|
$this->add(
|
||||||
|
'select', // field type
|
||||||
|
'membership_type_id_recur', // field name
|
||||||
|
E::ts('Create membership of type (recurring)'), // field label
|
||||||
|
array('' => E::ts('- none -')) + static::getMembershipTypes(), // list of options
|
||||||
|
FALSE, // is not required
|
||||||
|
array('class' => 'crm-select2 huge')
|
||||||
|
);
|
||||||
|
|
||||||
$this->add(
|
$this->add(
|
||||||
'text', // field type
|
'text', // field type
|
||||||
|
|
|
@ -214,6 +214,7 @@ class CRM_Twingle_Profile {
|
||||||
'contribution_source',
|
'contribution_source',
|
||||||
'custom_field_mapping',
|
'custom_field_mapping',
|
||||||
'membership_type_id',
|
'membership_type_id',
|
||||||
|
'membership_type_id_recur',
|
||||||
),
|
),
|
||||||
// Add payment methods.
|
// Add payment methods.
|
||||||
array_keys(static::paymentInstruments()),
|
array_keys(static::paymentInstruments()),
|
||||||
|
@ -283,6 +284,7 @@ class CRM_Twingle_Profile {
|
||||||
'contribution_source' => NULL,
|
'contribution_source' => NULL,
|
||||||
'custom_field_mapping' => NULL,
|
'custom_field_mapping' => NULL,
|
||||||
'membership_type_id' => NULL,
|
'membership_type_id' => NULL,
|
||||||
|
'membership_type_id_recur' => NULL,
|
||||||
)
|
)
|
||||||
// Add contribution status for all payment methods.
|
// Add contribution status for all payment methods.
|
||||||
+ array_fill_keys(array_map(function($attribute) {
|
+ array_fill_keys(array_map(function($attribute) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ project ID from any other profile. Therefore the default profile will be used
|
||||||
for all newly created Twingle projects.
|
for all newly created Twingle projects.
|
||||||
|
|
||||||
| Label | Description |
|
| Label | Description |
|
||||||
|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Profile name | Internal name, used inside the extension. |
|
| Profile name | Internal name, used inside the extension. |
|
||||||
| Project IDs | Twingle project IDs. Separate multiple IDs with commas. |
|
| Project IDs | Twingle project IDs. Separate multiple IDs with commas. |
|
||||||
| Location type | Specify how the address data sent by the form should be categorised in CiviCRM. The list is based on your CiviCRM configuration. |
|
| Location type | Specify how the address data sent by the form should be categorised in CiviCRM. The list is based on your CiviCRM configuration. |
|
||||||
|
@ -54,7 +54,8 @@ for all newly created Twingle projects.
|
||||||
| Record *Payment method* as | Specifiy the payment methods mapping for incoming donations for each Twingle payment method. |
|
| Record *Payment method* as | Specifiy the payment methods mapping for incoming donations for each Twingle payment method. |
|
||||||
| Sign up for groups | Whenever the donor checked the newsletter/postal mailing/donation receipt checkbox on the Twingle form, the contact will be added to the groups listed here. |
|
| Sign up for groups | Whenever the donor checked the newsletter/postal mailing/donation receipt checkbox on the Twingle form, the contact will be added to the groups listed here. |
|
||||||
| Assign donation to campaign | The donation will be assigned to the selected campaign. If a campaign ID is being submitted using the `campaign_id` parameter, this setting will be overridden with the submitted value. |
|
| Assign donation to campaign | The donation will be assigned to the selected campaign. If a campaign ID is being submitted using the `campaign_id` parameter, this setting will be overridden with the submitted value. |
|
||||||
| Create membership of type | A membership of the selected type will be created for the Individual contact. If no membership type is selected, no membership will be created. |
|
| Create membership of type | A membership of the selected type will be created for the Individual contact for incoming one-time donations. If no membership type is selected, no membership will be created. |
|
||||||
|
| Create membership of type (recurring) | A membership of the selected type will be created for the Individual contact for incoming recurring donations. If no membership type is selected, no membership will be created. |
|
||||||
| Contribution source | The configured value will be set as the "Source" field for the contribution. |
|
| Contribution source | The configured value will be set as the "Source" field for the contribution. |
|
||||||
| Custom field mapping | Additional field values may be set to CiviCRM custom fields using a mapping. See the option's help text for the exact format. |
|
| Custom field mapping | Additional field values may be set to CiviCRM custom fields using a mapping. See the option's help text for the exact format. |
|
||||||
|
|
||||||
|
|
|
@ -648,7 +648,13 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create membership if a membership type is configured within the profile.
|
// Create membership if a membership type is configured within the profile.
|
||||||
if (!empty($membership_type_id = $profile->getAttribute('membership_type_id'))) {
|
if ($params['donation_rhythm'] != 'one_time') {
|
||||||
|
$membership_type_id = $profile->getAttribute('membership_type_id_recur');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$membership_type_id = $profile->getAttribute('membership_type_id');
|
||||||
|
}
|
||||||
|
if (!empty($membership_type_id)) {
|
||||||
$membership = civicrm_api3('Membership', 'create', array(
|
$membership = civicrm_api3('Membership', 'create', array(
|
||||||
'contact_id' => $contact_id,
|
'contact_id' => $contact_id,
|
||||||
'membership_type_id' => $membership_type_id,
|
'membership_type_id' => $membership_type_id,
|
||||||
|
|
|
@ -211,6 +211,10 @@
|
||||||
<td class="label">{$form.membership_type_id.label}</td>
|
<td class="label">{$form.membership_type_id.label}</td>
|
||||||
<td class="content">{$form.membership_type_id.html}</td>
|
<td class="content">{$form.membership_type_id.html}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="crm-section">
|
||||||
|
<td class="label">{$form.membership_type_id_recur.label}</td>
|
||||||
|
<td class="content">{$form.membership_type_id_recur.html}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr class="crm-section">
|
<tr class="crm-section">
|
||||||
<td class="label">{$form.contribution_source.label}</td>
|
<td class="label">{$form.contribution_source.label}</td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue