Skip to content

Commit

Permalink
Add a setting for grouping by financial types
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Sep 13, 2024
1 parent d4d95ed commit 7407b42
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CRM/Admin/Form/Setting/SepaSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function buildQuickForm( ) {

// look up some values
$async_batch = CRM_Sepa_Logic_Settings::getGenericSetting('sdd_async_batching');
$financial_type_grouping = CRM_Sepa_Logic_Settings::getGenericSetting('sdd_financial_type_grouping');
$skip_closed = CRM_Sepa_Logic_Settings::getGenericSetting('sdd_skip_closed');
$no_draftxml = CRM_Sepa_Logic_Settings::getGenericSetting('sdd_no_draft_xml');
$excld_we = CRM_Sepa_Logic_Settings::getGenericSetting('exclude_weekends');
Expand All @@ -157,6 +158,7 @@ public function buildQuickForm( ) {
$this->addElement('checkbox', 'is_test_creditor', E::ts("Is a Test Creditor"), "", array('value' =>'0'));
$this->addElement('checkbox', 'exclude_weekends', E::ts("Exclude Weekends"), "", ($excld_we?array('checked'=>'checked'):array()));
$this->addElement('checkbox', 'sdd_async_batching', E::ts("Large Groups"), "", ($async_batch?array('checked'=>'checked'):array()));
$this->addElement('checkbox', 'sdd_financial_type_grouping', E::ts('Groups by Financial Types'), "", ($financial_type_grouping?array('checked'=>'checked'):array()));
$this->addElement('checkbox', 'sdd_skip_closed', E::ts("Only Completed Contributions"), "", ($skip_closed?array('checked'=>'checked'):array()));
$this->addElement('checkbox', 'sdd_no_draft_xml', E::ts("No XML drafts"), "", ($no_draftxml?array('checked'=>'checked'):array()));
$this->addElement('text', 'pp_buffer_days', E::ts("Buffer Days"), array('size' => 2, 'value' => $bffrdays));
Expand Down Expand Up @@ -252,6 +254,7 @@ function postProcess() {

CRM_Sepa_Logic_Settings::setSetting((isset($values['exclude_weekends']) ? "1" : "0"), 'exclude_weekends');
CRM_Sepa_Logic_Settings::setSetting((isset($values['sdd_async_batching']) ? "1" : "0"), 'sdd_async_batching');
CRM_Sepa_Logic_Settings::setSetting((isset($values['sdd_financial_type_grouping']) ? "1" : "0"), 'sdd_financial_type_grouping');
CRM_Sepa_Logic_Settings::setSetting((isset($values['sdd_skip_closed']) ? "1" : "0"), 'sdd_skip_closed');
CRM_Sepa_Logic_Settings::setSetting((isset($values['sdd_no_draft_xml']) ? "1" : "0"), 'sdd_no_draft_xml');
CRM_Sepa_Logic_Settings::setSetting((isset($values['pp_buffer_days']) ? (int) $values['pp_buffer_days'] : "0"), 'pp_buffer_days');
Expand Down
13 changes: 12 additions & 1 deletion settings/sepa.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@
'is_contact' => 0,
'description' => 'Enables asychronous batching',
),
'sdd_financial_type_grouping' => array(
'group_name' => 'SEPA Direct Debit Preferences',
'group' => 'org.project60',
'name' => 'sdd_financial_type_grouping',
'type' => 'Boolean',
'html_type' => 'checkbox',
'default' => 0,
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Groups by Financial Types.',
),
'sdd_skip_closed' => array(
'group_name' => 'SEPA Direct Debit Preferences',
'group' => 'org.project60',
Expand Down Expand Up @@ -308,4 +319,4 @@
'description' => "Contribution page buffer (in days) before debit needs to be collected",
'help_text' => "Contribution page buffer (in days) before debit needs to be collected",
)
);
);
7 changes: 6 additions & 1 deletion templates/CRM/Admin/Form/Setting/SepaSettings.hlp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
<p>{ts}This option will activate a runner page with a progress bar for these critical processes. There shouldn't be any timeouts, but you have to keep that open until it's done.{/ts}</p>
{/htxt}

{htxt id='id-financial-type-grouping'}
<p>{ts}Whether to group transactions by financial types additionally.{/ts}</p>
<p>{ts}Enable this settings if you use the Financial ACLs extension, as transaction groups with mixed financial type contributions can cause issues with overlapping Financial ACLs' permissions.{/ts}</p>
{/htxt}

{htxt id='id-creditor-type'}
<p>{ts}Always use <code>SEPA</code> if you want to do SEPA style direct debit.{/ts}</p>
<p>{ts}<code>PSP</code> can help you to use this extension for other direct debit systems or payment service providers (PSP), but all SEPA style validations and tools are then disabled.{/ts}</p>
Expand Down Expand Up @@ -178,4 +183,4 @@
<p>{ts}CUC-code ("Codice Univoco CBI") of the financial institution of the creditor. It is only required for CBIBdySDDReq SEPA file format.{/ts}</p>
<p>{ts}<strong>Be careful when changing this!</strong>{/ts}</p>
{/htxt}
{/crmScope}
{/crmScope}
6 changes: 6 additions & 0 deletions templates/CRM/Admin/Form/Setting/SepaSettings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ div.sdd-add-creditor {
{$form.sdd_async_batching.html}
</td>
</tr>
<tr class="crm-alternative_batching-form-block-financial-type-grouping">
<td class="label">{$form.sdd_financial_type_grouping.label} <a onclick='CRM.help("{ts}Groups by Financial Types{/ts}", {literal}{"id":"id-financial-type-grouping","file":"CRM\/Admin\/Form\/Setting\/SepaSettings"}{/literal}); return false;' href="#" title="{ts}Help{/ts}" class="helpicon">&nbsp;</a></td>
<td>
{$form.sdd_financial_type_grouping.html}
</td>
</tr>
</table>
<br/>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
Expand Down

0 comments on commit 7407b42

Please sign in to comment.