contactcats/managed/SavedSearch_ContactCategories_Locus_3_4.mgd.php
Rich Lott / Artful Robot 699436c75b Add managed saved searches
2025-04-01 20:21:50 +01:00

79 lines
2.3 KiB
PHP

<?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'],
],
],
];