Connect points types to contact types
Opened this issue · 3 comments
davidknoll commented
A points type may only be appropriate for certain contact types/subtypes. eg. if your primary members must be organisations, and you use points to track engagement, you may only want to grant points of that type to organisations.
davidknoll commented
Related: once points types can be restricted to contact types, show the points tabs on any appropriate contact, not just if they have previously been granted some points. (I made it only show a points tab if points have previously been granted to that contact, precisely because points may not be appropriate to every contact type.)
davidknoll commented
This may require points types to be stored in a new table rather than an option group.
davidknoll commented
Idea: a general table containing
- id auto increment
- entity_type / entity_table
** (in our case Points / civicrm_points)
** wondering if the mechanism for restrictions could be extended to other entity types besides points (and would that be necessary) - entity subtypes (eg points type IDs)
** separated by CRM_Core_DAO::VALUE_SEPARATOR
*** entity_sub_type like concat('%', char(1), %0, char(1), '%') or entity_sub_type = %0
** Or a single select
*** enforce (with a unique key) one rule per points type? - contact type(s?)
- contact subtypes
- is_active?
- enum allow/deny?
** likely to require a weight column and evaluating all rules in order in that case
** or could say that the absence of a record for that points type means it's not restricted, presence means it's restricted to those contact types only