[#19] implementing membership postprocess call (WIP)

This commit is contained in:
B. Endres 2020-02-10 08:26:55 +01:00
parent 8a2f91f34a
commit 33ced7bbc3
5 changed files with 107 additions and 3 deletions

View file

@ -38,6 +38,17 @@
{ts domain="de.systopia.twingle"}Select which financial type to use for recurring contributions.{/ts}
{/htxt}
{htxt id='id-membership-postprocessing-call'}
{ts domain="de.systopia.twingle"}Some organisations have specific conventions on how a membership should be created. Since the Twingle-API can only create a "bare bone" membership object, you can enter a API Call (as 'Entity.Action') to adjust any newly created membership to your organisation's needs.{/ts}
{ts domain="de.systopia.twingle"}The API call would receive the following parameters:<ul>
<li><code>membership_id</code>: The ID of the newly created membership</li>
<li><code>contact_id</code>: The ID of the contact involved</li>
<li><code>organization_id</code>: The ID of the contact's organisation, potentially empty</li>
<li><code>contribution_id</code>: The ID contribution received, potentially empty</li>
<li><code>recurring_contribution_id</code>: The ID of the recurring contribution. If empty, this was only a one-off donation.</li>
</ul>{/ts}
{/htxt}
{htxt id='id-custom_field_mapping'}
{ts domain="de.systopia.twingle"}<p>Map Twingle custom fields to CiviCRM custom fields using the following format (each assignment in a separate line):</p>
<pre>twingle_field_1=custom_123<br />twingle_field_2=custom_789</pre>

View file

@ -236,6 +236,27 @@
<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 twingle-postprocess-call">
<td class="label">
{$form.membership_postprocess_call.label}
<a
onclick='
CRM.help(
"{ts domain="de.systopia.twingle"}Membership Postprocessing{/ts}",
{literal}{
"id": "id-membership-postprocessing-call",
"file": "CRM\/Twingle\/Form\/Profile"
}{/literal}
);
return false;
'
href="#"
title="{ts domain="de.systopia.twingle"}Help{/ts}"
class="helpicon"
></a>
</td>
<td class="content">{$form.membership_postprocess_call.html}</td>
</tr>
<tr class="crm-section">
<td class="label">{$form.contribution_source.label}</td>
@ -286,3 +307,27 @@
</div>
</div>
{literal}
<script>
/**
* Update the form fields based on whether membership creation is currently active
*/
function twingle_membership_active_changed() {
let active = cj('#membership_type_id').val() || cj('#membership_type_id_recur').val();
if (active) {
cj('#membership_postprocess_call').parent().parent().show();
} else {
cj('#membership_postprocess_call').val(''); // empty to avoid hidden validation fail
cj('#membership_postprocess_call').parent().parent().hide();
}
}
// register events and run once
cj(document).ready(function (){
cj('#membership_type_id').change(twingle_membership_active_changed);
cj('#membership_type_id_recur').change(twingle_membership_active_changed);
});
twingle_membership_active_changed();
</script>
{/literal}