Merge branch 'dev_5'
[#5] Create membership with configurable membership type
This commit is contained in:
commit
3e00a6a46b
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
|
||||
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(
|
||||
'text', // field type
|
||||
|
|
|
@ -214,6 +214,7 @@ class CRM_Twingle_Profile {
|
|||
'contribution_source',
|
||||
'custom_field_mapping',
|
||||
'membership_type_id',
|
||||
'membership_type_id_recur',
|
||||
),
|
||||
// Add payment methods.
|
||||
array_keys(static::paymentInstruments()),
|
||||
|
@ -283,6 +284,7 @@ class CRM_Twingle_Profile {
|
|||
'contribution_source' => NULL,
|
||||
'custom_field_mapping' => NULL,
|
||||
'membership_type_id' => NULL,
|
||||
'membership_type_id_recur' => NULL,
|
||||
)
|
||||
// Add contribution status for all payment methods.
|
||||
+ array_fill_keys(array_map(function($attribute) {
|
||||
|
|
33
README.md
33
README.md
|
@ -41,22 +41,23 @@ The *default* profile is used whenever the plugin cannot match the Twingle
|
|||
project ID from any other profile. Therefore the default profile will be used
|
||||
for all newly created Twingle projects.
|
||||
|
||||
| Label | Description |
|
||||
|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Profile name | Internal name, used inside the extension. |
|
||||
| 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 for organisations | Specify how the address data sent by the form should be categorised in CiviCRM for organisational donations. The list is based on your CiviCRM configuration. |
|
||||
| Financial type | Specify which financial type incoming one-time donations should be recorded with in CiviCRM. The list is based on your CiviCRM configuration. |
|
||||
| Financial type (recurring) | Specify which financial type incoming recurring donations should be recorded with in CiviCRM. The list is based on your CiviCRM configuration. |
|
||||
| CiviSEPA creditor | When enabled to integrate with CiviSEPA, specify the CiviSEPA creditor to use. |
|
||||
| Gender options | Specify which CiviCRM gender option the incoming Twingle gender value should be mapped to. The list is based on your CiviCRM configuration. |
|
||||
| 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. |
|
||||
| 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. |
|
||||
| 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. |
|
||||
| Label | Description |
|
||||
|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Profile name | Internal name, used inside the extension. |
|
||||
| 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 for organisations | Specify how the address data sent by the form should be categorised in CiviCRM for organisational donations. The list is based on your CiviCRM configuration. |
|
||||
| Financial type | Specify which financial type incoming one-time donations should be recorded with in CiviCRM. The list is based on your CiviCRM configuration. |
|
||||
| Financial type (recurring) | Specify which financial type incoming recurring donations should be recorded with in CiviCRM. The list is based on your CiviCRM configuration. |
|
||||
| CiviSEPA creditor | When enabled to integrate with CiviSEPA, specify the CiviSEPA creditor to use. |
|
||||
| Gender options | Specify which CiviCRM gender option the incoming Twingle gender value should be mapped to. The list is based on your CiviCRM configuration. |
|
||||
| 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. |
|
||||
| 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 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. |
|
||||
| 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. |
|
||||
|
||||
|
||||
## API documentation
|
||||
|
|
|
@ -648,7 +648,13 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
}
|
||||
|
||||
// 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(
|
||||
'contact_id' => $contact_id,
|
||||
'membership_type_id' => $membership_type_id,
|
||||
|
|
|
@ -211,6 +211,10 @@
|
|||
<td class="label">{$form.membership_type_id.label}</td>
|
||||
<td class="content">{$form.membership_type_id.html}</td>
|
||||
</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">
|
||||
<td class="label">{$form.contribution_source.label}</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue