diff --git a/settings/twingle.setting.php b/settings/twingle.setting.php
index 164c97e..d703845 100644
--- a/settings/twingle.setting.php
+++ b/settings/twingle.setting.php
@@ -31,4 +31,32 @@ return array(
'is_contact' => 0,
'description' => 'Whether to provide CiviSEPA functionality for manual debit payment method. This requires the CiviSEPA (org.project60.sepa) extension be installed.',
),
+ 'twingle_protect_recurring' => array(
+ 'group_name' => 'de.systopia.twingle',
+ 'group' => 'de.systopia.twingle',
+ 'name' => 'twingle_protect_recurring',
+ 'type' => 'Boolean',
+ 'quick_form_type' => 'YesNo',
+ 'html_type' => 'radio',
+ 'title' => 'Protect Recurring Contributions',
+ 'default' => 0,
+ 'add' => '4.6',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'Will protect all recurring contributions created by Twingle from termination, since this does NOT terminate the Twingle collection process. Currently only works with a prefix',
+ ),
+ 'twingle_prefix' => array(
+ 'group_name' => 'de.systopia.twingle',
+ 'group' => 'de.systopia.twingle',
+ 'name' => 'twingle_prefix',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'text',
+ 'title' => 'Twingle ID Prefix',
+ 'default' => '',
+ 'add' => '4.6',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'You can use this setting to add a prefix to the Twingle transaction ID, in order to avoid collisions with other transaction ids.',
+ ),
);
diff --git a/templates/CRM/Twingle/Form/Profile.hlp b/templates/CRM/Twingle/Form/Profile.hlp
index f2c80e7..3e82883 100644
--- a/templates/CRM/Twingle/Form/Profile.hlp
+++ b/templates/CRM/Twingle/Form/Profile.hlp
@@ -16,6 +16,11 @@
{ts domain="de.systopia.twingle"}Select which location type to use for addresses for individuals, either when no organisation name is specified, or an organisation address can not be shared with the individual contact.{/ts}
{/htxt}
+{htxt id='id-project_ids'}
+ {ts domain="de.systopia.twingle"}Put your project's Twingle ID in here, to activate this profile for that project.{/ts}
+ {ts domain="de.systopia.twingle"}You can also provide multiple project IDs separated by a comma.{/ts}
+{/htxt}
+
{htxt id='id-location_type_id_organisation'}
{ts domain="de.systopia.twingle"}Select which location type to use for addresses for organisations and shared organisation addresses for individual contacts.{/ts}
{/htxt}
@@ -27,3 +32,17 @@
{htxt id='id-financial_type_id_recur'}
{ts domain="de.systopia.twingle"}Select which financial type to use for recurring contributions.{/ts}
{/htxt}
+
+{htxt id='id-custom_field_mapping'}
+ {ts domain="de.systopia.twingle"}Map Twingle custom fields to CiviCRM custom fields using the following format (each assignment in a separate line):
+ twingle_field_1=custom_123 twingle_field_2=custom_789
+ Always use the custom_[id]
notation for CiviCRM custom fields.
+ Only custom fields extending one of the following CiviCRM entities are allowed:
+
+ Contact – Will be set on the Individual contact
+ Individual – Will be set on the Individual contact
+ Organization – Will be set on the Organization contact, if an organisation name was submitted
+ Contribution – Will be set on the contribution
+ ContributionRecur – Will be set on the recurring contribution and deriving single contributions
+ {/ts}
+{/htxt}
diff --git a/templates/CRM/Twingle/Form/Profile.tpl b/templates/CRM/Twingle/Form/Profile.tpl
index c7ad9db..05cd32e 100644
--- a/templates/CRM/Twingle/Form/Profile.tpl
+++ b/templates/CRM/Twingle/Form/Profile.tpl
@@ -28,7 +28,23 @@
- {$form.selector.label}
+ {$form.selector.label}
+
+
{$form.selector.html}
@@ -151,8 +167,14 @@
@@ -161,7 +183,7 @@
- {ts domain="de.systopia.twingle"}Groups{/ts}
+ {ts domain="de.systopia.twingle"}Groups and Correlations{/ts}
diff --git a/templates/CRM/Twingle/Form/Settings.hlp b/templates/CRM/Twingle/Form/Settings.hlp
index 2f0a45a..8b5ef1b 100644
--- a/templates/CRM/Twingle/Form/Settings.hlp
+++ b/templates/CRM/Twingle/Form/Settings.hlp
@@ -15,3 +15,11 @@
{htxt id='id-twingle_use_sepa'}
{ts domain="de.systopia.twingle" 1="CiviSEPA (org.project60.sepa ) extension "}When the %1 is enabled and one of its payment instruments is assigned to a Twingle payment method (practically the debit_manual payment method), submitting a Twingle donation through the API will create a SEPA mandate with the given data.{/ts}
{/htxt}
+
+{htxt id='id-twingle_protect_recurring'}
+ {ts domain="de.systopia.twingle"}Will protect all recurring contributions created by Twingle from termination, since this does NOT terminate the Twingle collection process{/ts}
+{/htxt}
+
+{htxt id='id-twingle_prefix'}
+ {ts domain="de.systopia.twingle"}You can use this setting to add a prefix to the Twingle transaction ID, in order to avoid collisions with other transaction ids.{/ts}
+{/htxt}
diff --git a/templates/CRM/Twingle/Page/Profiles.tpl b/templates/CRM/Twingle/Page/Profiles.tpl
index 3b935a7..30dbfce 100644
--- a/templates/CRM/Twingle/Page/Profiles.tpl
+++ b/templates/CRM/Twingle/Page/Profiles.tpl
@@ -39,6 +39,7 @@
{ts domain="de.systopia.twingle"}Edit{/ts}
+ {ts domain="de.systopia.twingle"}Copy{/ts}
{if $profile_name == 'default'}
{ts domain="de.systopia.twingle"}Reset{/ts}
{else}
diff --git a/twingle.php b/twingle.php
index c2a064e..214d041 100644
--- a/twingle.php
+++ b/twingle.php
@@ -3,6 +3,15 @@
require_once 'twingle.civix.php';
use CRM_Twingle_ExtensionUtil as E;
+/**
+ * Implements hook_civicrm_pre().
+ */
+function twingle_civicrm_pre($op, $objectName, $id, &$params) {
+ if ($objectName == 'ContributionRecur' && $op == 'edit') {
+ CRM_Twingle_Tools::checkRecurringContributionChange($id, $params);
+ }
+}
+
/**
* Implements hook_civicrm_config().
*