Allow a "source" for contributions be configured per profile.

This commit is contained in:
Jens Schuppe 2019-01-21 11:24:11 +01:00
parent 5ce76eae5f
commit d28248723b
4 changed files with 17 additions and 0 deletions

View file

@ -209,6 +209,13 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
array('class' => 'crm-select2 huge') array('class' => 'crm-select2 huge')
); );
$this->add(
'text', // field type
'contribution_source', // field name
E::ts('Contribution source'), // field label
array()
);
$this->addButtons(array( $this->addButtons(array(
array( array(
'type' => 'submit', 'type' => 'submit',

View file

@ -188,6 +188,7 @@ class CRM_Twingle_Profile {
'postinfo_groups', 'postinfo_groups',
'donation_receipt_groups', 'donation_receipt_groups',
'campaign', 'campaign',
'contribution_source',
); );
} }
@ -244,6 +245,7 @@ class CRM_Twingle_Profile {
'postinfo_groups' => NULL, 'postinfo_groups' => NULL,
'donation_receipt_groups' => NULL, 'donation_receipt_groups' => NULL,
'campaign' => NULL, 'campaign' => NULL,
'contribution_source' => NULL,
)); ));
} }

View file

@ -451,6 +451,9 @@ function civicrm_api3_twingle_donation_Submit($params) {
if (!empty($campaign = $profile->getAttribute('campaign'))) { if (!empty($campaign = $profile->getAttribute('campaign'))) {
$contribution_data['campaign_id'] = $campaign; $contribution_data['campaign_id'] = $campaign;
} }
if (!empty($contribution_source = $profile->getAttribute('contribution_source'))) {
$contribution_data['source'] = $contribution_source;
}
if ( if (
CRM_Twingle_Submission::civiSepaEnabled() CRM_Twingle_Submission::civiSepaEnabled()

View file

@ -107,6 +107,11 @@
<td class="content">{$form.campaign.html}</td> <td class="content">{$form.campaign.html}</td>
</tr> </tr>
<tr class="crm-section">
<td class="label">{$form.contribution_source.label}</td>
<td class="content">{$form.contribution_source.html}</td>
</tr>
</table> </table>
</fieldset> </fieldset>