Rewrite sync to use new features

This commit is contained in:
Rich Lott / Artful Robot 2025-02-24 13:16:05 +00:00
parent b0983603e5
commit 16f2b6235d
7 changed files with 502 additions and 365 deletions

View file

@ -1,6 +1,5 @@
# Contact Categories
This is an [extension for CiviCRM](https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/), licensed under [AGPL-3.0](LICENSE.txt).
It provides a way to categorise contacts by priority group; a contact only ever has one category, which is the most important one that applies.
@ -13,7 +12,7 @@ How categories are defined will depend on your organisation's needs. A real worl
4. "Loyal" - other regular donors
5. "Cooling" - people who recently cancelled regular giving
6. "Interested" - donated within last 3 months.
7. "Missed" 2+ donations over 3 months ago.
7. "Missed" 2+ donations over 3 months ago.
8. "Drifting" gave once over 3 months ago.
9. "Active" never given money, but done some other action recently.
10. "Dormant" never given money and not done anything else for a while.
@ -28,17 +27,22 @@ As well as giving you the opportunity for oversight metrics, this makes it reall
Example useful things you can do with this approach:
- avoid asking for money too soon after it's been given!
- contact all regulars (Amazing, Loyal) to ask for increased donations, notably excluding "buzzing" (would be rude) and "VIPs" (personal approach).
- contact all regulars (Amazing, Loyal) to ask for increased donations, notably excluding "buzzing" (would be rude) and "VIPs" (personal approach).
- ask those who gave before to start regular giving etc.
- send urgent actions to those most likely to respond urgently.
- follow up cancelled regulars to see if they can be rescued.
## Getting Started
Once installed, you'll find a (bit crude at the mo) Contact » Categories page that lets you specify your prioritised SearchKit searches to identify your contacts. A scheduled job needs to run to do the categorisation, so wait a day for that or run it manually.
You can also use SearchKit/FormBuilder to summarise people by categories, e.g. counts.
## Technical notes
This uses a settings keys to record unix timestamps as to when the last and previous assignment run happened.
- `contactcats_next_run`
- `contactcats_last_run`
It uses `ContactCategoryDefinition` entity to hold data about each configured category and `ContactCategory` entities join a Contact and a ContactCategoryDefinition.