Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAE-230: Set default manual direct debit configurations #2

Merged
merged 2 commits into from
Feb 4, 2021

Conversation

ahed-compucorp
Copy link
Contributor

Overview

This PR will create default and sensible configurations for uk.co.compucorp.manualdirectdebit extension.

Before

Screenshot from 2021-02-03 16-33-27

After

Screenshot from 2021-02-03 16-31-42

'manualdirectdebit_batch_submission_queue_limit' => 50,
];
foreach ($configFields as $name => $value) {
civicrm_api3('setting', 'create', [$name => $value]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahed-compucorp Would be better if we don't need foreach? We just civicrm_api3('setting', 'create', $configFields);

Copy link
Contributor Author

@ahed-compucorp ahed-compucorp Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that but It fired an error

[is_error] => 1
[error_message] => manualdirectdebit_default_reference_prefix,manualdirectdebit_minimum_reference_prefix_length,manualdirectdebit_new_instruction_run_dates,manualdirectdebit_payment_collection_run_dates,manualdirectdebit_minimum_days_to_first_payment,manualdirectdebit_days_in_advance_for_collection_reminder,manualdirectdebit_batch_submission_queue_limit not valid settings

Now I updated to use Civi::settings()->add instead and it works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not work because "Your setting will not be active until you run flush all caches (e.g cv flush or drush cvapi System.flush)" https://docs.civicrm.org/dev/en/latest/framework/setting/#adding-a-new-setting-to-civicrm-core but using Civi::settings()->add is okay too.

@ahed-compucorp ahed-compucorp force-pushed the MAE-230-set-default-manual-DD-configurations branch from 25faaa4 to 83a6eae Compare February 3, 2021 14:57
@ahed-compucorp ahed-compucorp merged commit cbdf624 into master Feb 4, 2021
@ahed-compucorp ahed-compucorp deleted the MAE-230-set-default-manual-DD-configurations branch February 4, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants