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

dev/core#1295 Add is_active field to civicrm_status_preference #15409

Merged
merged 2 commits into from
Oct 7, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Oct 6, 2019

Overview

Add is_active field to civicrm_status_pref per discussions in NYC this is to be api-accessible but not UI exposed.

Importantly the is_active field is checked BEFORE attempting the check rather than after

Before

No way to stop a check from running at all

After

is_active field can be set to zero to disable

Technical Details

For devs to disable a status check they would need to add or edit a row in civicrm_status_check for that check - e.g

 $this->callAPISuccess('StatusPreference', 'create', [
      'name' => 'checkDefaultMailbox',
      'is_active' => 0,
    ]);

Comments

@civibot
Copy link

civibot bot commented Oct 6, 2019

(Standard links)

@civibot civibot bot added the master label Oct 6, 2019
@seamuslee001
Copy link
Contributor

@@ -25,14 +25,44 @@
+--------------------------------------------------------------------+
*/


use Civi\Api4\StatusPreference;
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton why is this needed?

if (empty($this->checksConfig)) {
$this->checksConfig = Civi::cache('checks')->get('checksConfig', []);
if (empty($this->checksConfig)) {
$this->checksConfig = StatusPreference::get()->execute()->indexBy('name');
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton wouldn't you route through civicrm_api4 or similar or something?

@eileenmcnaughton eileenmcnaughton force-pushed the status branch 2 times, most recently from 6d240e2 to ac03bac Compare October 6, 2019 22:19
*/
public function checkAll() {
$messages = [];
foreach (get_class_methods($this) as $method) {
if ($method !== 'checkAll' && strpos($method, 'check') === 0) {
$r = $this->isDisabled($method);
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton what is this used for at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seamuslee001 thanks - fixed

Note this is done BEFORE doing checks in case it is for performance reasons
@seamuslee001 seamuslee001 added the merge ready PR will be merged after a few days if there are no objections label Oct 7, 2019
@seamuslee001
Copy link
Contributor

I've added merge ready as i think this is right but we may want to have a discussion about whether we want to be standardising on the OOP style API4 coding or use the traditional civicrm_api4 style. @colemanw any thoughts?

@seamuslee001 seamuslee001 added merge on pass and removed merge ready PR will be merged after a few days if there are no objections labels Oct 7, 2019
@seamuslee001 seamuslee001 merged commit 8632e9d into civicrm:master Oct 7, 2019
@seamuslee001 seamuslee001 deleted the status branch October 7, 2019 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants