Add managed saved searches

This commit is contained in:
Rich Lott / Artful Robot 2025-04-01 20:21:50 +01:00
parent d5ee875aef
commit 699436c75b
16 changed files with 1035 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_0_2_Locus',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_0_2_Locus',
'label' => E::ts('ContactCategories 0.2 Locus'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
],
'orderBy' => [],
'where' => [
['created_date', '>=', 'now - 12 month'],
],
'groupBy' => [],
'join' => [],
'having' => [],
],
'description' => E::ts('0.2 Interested
entry into database < 12 months - no activity'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,58 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_1',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_1',
'label' => E::ts('ContactCategories Locus 1.1'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'MAX(Contact_Contribution_contact_id_01.receive_date) AS MAX_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'MAX_Contact_Contribution_contact_id_01_receive_date',
'<',
'now - 36 month',
],
],
],
'description' => E::ts('1.1 Occasional donor: expired
last donation 36 + months before today'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,61 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_2',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_2',
'label' => E::ts('ContactCategories Locus 1.2'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'MAX(Contact_Contribution_contact_id_01.receive_date) AS MAX_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'MAX_Contact_Contribution_contact_id_01_receive_date',
'BETWEEN',
['now - 26 month', 'now - 24 month'],
],
],
],
'description' => E::ts('1.2 Occasional donor: critical
last donation 24 36 months before today'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,66 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_3',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_3',
'label' => E::ts('ContactCategories Locus 1.3'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'MIN(Contact_Contribution_contact_id_01.receive_date) AS MIN_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'MIN_Contact_Contribution_contact_id_01_receive_date',
'BETWEEN',
['now - 24 month', 'now - 12 month'],
],
[
'COUNT_Contact_Contribution_contact_id_01_id',
'=',
1,
],
],
],
'description' => E::ts('1.3 Occasional Donor: one-time
- first and only donation 12 24 months before today'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,61 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_4',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_4',
'label' => E::ts('ContactCategories Locus 1.4'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'MIN(Contact_Contribution_contact_id_01.receive_date) AS MIN_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'MIN_Contact_Contribution_contact_id_01_receive_date',
'>',
'now - 12 month',
],
],
],
'description' => E::ts('1.4 Occasional Donor: new
first donation within last 12 months'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,65 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_5',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_5',
'label' => E::ts('ContactCategories Locus 1.5'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
[
'Contact_Contribution_contact_id_01.receive_date',
'>',
'"now - 24 month"',
],
],
],
'having' => [
[
'COUNT_Contact_Contribution_contact_id_01_id',
'=',
2,
],
],
],
'description' => E::ts('1.5 Occasional Donor: two-time
2 donations within last 24 months'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,65 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_1_6',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_1_6',
'label' => E::ts('ContactCategories Locus 1.6'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
[
'Contact_Contribution_contact_id_01.receive_date',
'>',
'"now - 24 month"',
],
],
],
'having' => [
[
'COUNT_Contact_Contribution_contact_id_01_id',
'>=',
3,
],
],
],
'description' => E::ts('1.6 Occasional Donor: multiple-time
3+ donations within last 24 months'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,65 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_2_1',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_2_1',
'label' => E::ts('ContactCategories Locus 2.1'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'ContributionRecur AS Contact_ContributionRecur_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_ContributionRecur_contact_id_01.contact_id',
],
[
'Contact_ContributionRecur_contact_id_01.contribution_status_id:name',
'=',
'"Cancelled"',
],
],
[
'Contribution AS Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01',
'INNER',
[
'Contact_ContributionRecur_contact_id_01.id',
'=',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_recur_id',
],
[
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [],
],
'description' => E::ts('anyone with an expired regular giving that yielded at least one completed contribution. Note: they may also have non-expired regular giving, but this is the catch all below those criteria.'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,73 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_2_2',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_2_2',
'label' => E::ts('ContactCategories Locus 2.2'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'ContributionRecur AS Contact_ContributionRecur_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_ContributionRecur_contact_id_01.contact_id',
],
[
'Contact_ContributionRecur_contact_id_01.contribution_status_id:name',
'=',
'"In Progress"',
],
[
'Contact_ContributionRecur_contact_id_01.start_date',
'>',
'"now - 12 month"',
],
],
[
'Contribution AS Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01',
'INNER',
[
'Contact_ContributionRecur_contact_id_01.id',
'=',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_recur_id',
],
[
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [],
],
'description' => E::ts('new regular donor
- started giving regular donations max. 12 months ago
- at least one completed contribution.'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,72 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_2_3',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_2_3',
'label' => E::ts('ContactCategories Locus 2.3'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'ContributionRecur AS Contact_ContributionRecur_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_ContributionRecur_contact_id_01.contact_id',
],
[
'Contact_ContributionRecur_contact_id_01.contribution_status_id:name',
'=',
'"In Progress"',
],
[
'Contact_ContributionRecur_contact_id_01.start_date',
'<=',
'"now - 12 month"',
],
],
[
'Contribution AS Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01',
'INNER',
[
'Contact_ContributionRecur_contact_id_01.id',
'=',
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_recur_id',
],
[
'Contact_ContributionRecur_contact_id_01_ContributionRecur_Contribution_contribution_recur_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [],
],
'description' => E::ts('active regular donor
- started and continued giving regular donations 12+ months ago'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,54 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_0_expired_major_donor',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_0_expired_major_donor',
'label' => E::ts('ContactCategories Locus 3.0 expired major donor'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'MAX(Contact_Contribution_contact_id_01.total_amount) AS MAX_Contact_Contribution_contact_id_01_total_amount',
'MAX(Contact_Contribution_contact_id_01.receive_date) AS MAX_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
],
],
'having' => [
[
'MAX_Contact_Contribution_contact_id_01_receive_date',
'<=',
'now - 36 month',
],
],
],
'description' => E::ts('- last donation 36+ months before today
- 1+ donation of 500+ EUR'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,58 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_1',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_1',
'label' => E::ts('ContactCategories Locus 3.1'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'MAX(Contact_Contribution_contact_id_01.total_amount) AS MAX_Contact_Contribution_contact_id_01_total_amount',
'MAX(Contact_Contribution_contact_id_01.receive_date) AS MAX_Contact_Contribution_contact_id_01_receive_date',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
],
],
'having' => [
[
'MAX_Contact_Contribution_contact_id_01_total_amount',
'=',
'',
],
[
'MAX_Contact_Contribution_contact_id_01_receive_date',
'BETWEEN',
['now - 36 month', 'now - 12 month'],
],
],
],
'description' => E::ts('Major donor: critical
- last donation 24 36 months before today
- 1+ donation of 500+ EUR'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,69 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_2',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_2',
'label' => E::ts('ContactCategories Locus 3.2'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'MAX(Contact_Contribution_contact_id_01.total_amount) AS MAX_Contact_Contribution_contact_id_01_total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
],
],
'having' => [
[
'COUNT_Contact_Contribution_contact_id_01_id',
'>=',
2,
],
[
'OR',
[
[
'MAX_Contact_Contribution_contact_id_01_total_amount',
'>=',
'500',
],
[
'SUM_Contact_Contribution_contact_id_01_total_amount',
'=',
'1000',
],
],
],
],
],
'description' => E::ts('Major donor: two-time
- 2+ donations within last 24 months
AND 1+ donation of 500+ EUR OR sum of all donations within last 24 months 1,000+'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,70 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_3',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_3',
'label' => E::ts('ContactCategories Locus 3.3'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'MIN(Contact_Contribution_contact_id_01.receive_date) AS MIN_Contact_Contribution_contact_id_01_receive_date',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'COUNT_Contact_Contribution_contact_id_01_id',
'=',
1,
],
[
'MIN_Contact_Contribution_contact_id_01_receive_date',
'BETWEEN',
['now - 24 month', 'now - 12 month'],
],
[
'SUM_Contact_Contribution_contact_id_01_total_amount',
'>=',
'500',
],
],
],
'description' => E::ts('Major donor: one-time
- first and only donation
- was 12 24 months before today
- amount 500+'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,79 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_4',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_4',
'label' => E::ts('ContactCategories Locus 3.4'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'sort_name',
'contact_type:label',
'contact_sub_type:label',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'MIN(Contact_Contribution_contact_id_01.receive_date) AS MIN_Contact_Contribution_contact_id_01_receive_date',
'MAX(Contact_Contribution_contact_id_01.total_amount) AS MAX_Contact_Contribution_contact_id_01_total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
],
],
'having' => [
[
'MIN_Contact_Contribution_contact_id_01_receive_date',
'>=',
'now - 12 month',
],
[
'OR',
[
[
'MAX_Contact_Contribution_contact_id_01_total_amount',
'>=',
'500',
],
[
'SUM_Contact_Contribution_contact_id_01_total_amount',
'>=',
'1000',
],
],
],
],
],
'description' => E::ts('Major donor: new
- First donation within last 12 months
AND
- 1+ donation of 500+ EUR
OR
- sum of all donations 1,000+ EUR'),
],
'match' => ['name'],
],
],
];

View file

@ -0,0 +1,81 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_ContactCategories_Locus_3_5',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'ContactCategories_Locus_3_5',
'label' => E::ts('ContactCategories Locus 3.5'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'COUNT(Contact_Contribution_contact_id_01.id) AS COUNT_Contact_Contribution_contact_id_01_id',
'SUM(Contact_Contribution_contact_id_01.total_amount) AS SUM_Contact_Contribution_contact_id_01_total_amount',
'MAX(Contact_Contribution_contact_id_01.total_amount) AS MAX_Contact_Contribution_contact_id_01_total_amount',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'Contribution AS Contact_Contribution_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_Contribution_contact_id_01.contact_id',
],
[
'Contact_Contribution_contact_id_01.receive_date',
'>=',
'"now - 24 month"',
],
[
'Contact_Contribution_contact_id_01.contribution_status_id:name',
'=',
'"Completed"',
],
[
'Contact_Contribution_contact_id_01.is_test',
'=',
FALSE,
],
],
],
'having' => [
[
'COUNT_Contact_Contribution_contact_id_01_id',
'>=',
3,
],
[
'OR',
[
[
'MAX_Contact_Contribution_contact_id_01_total_amount',
'>=',
NULL,
],
[
'SUM_Contact_Contribution_contact_id_01_total_amount',
'>=',
NULL,
],
],
],
],
],
'description' => E::ts('Multiple time major donors.'),
],
'match' => ['name'],
],
],
];