Create evidence entity

Created on 14 March 2025, 26 days ago

Problem/Motivation

Declarations, cancellations, change of address and misc correspondence all share the concept of carrying "evidence", i.e. supporting information such as images, documents, recordings or words.

There are multiple types such as "telephone", "conversation", "email", "written". The module will provide defaults that admins can customise.

Proposed resolution

Create a new Evidence entity type with bundles. This replaces declaration type.

Evidence type

  • Replace "written_record_required" with "method" field with 3 states: oral; written; web.
  • Web types are provided by code, which relies on the existence of specific fields. Perhaps we should make the types locked in the UI, or at least prevent deletion of key parts. Don't allow creating new types with method "web" in the UI because they are useless without code.
  • Create some default types for a new install, by means of files in config/install, see #3.
  • For the web types, we create a field that stores (or links to) the exact wording of the message that was shown to the donor. For the commerce one, we also add a reference field that links to the order. This bullet might be deferred to a separate issue.

Default bundles (optional and alterable):

  • commerce (i.e. checkout)
  • web (i.e. self declare by web UI)
  • email (staff declare)
  • phone (staff declare)
  • face to face (staff declare)
  • letter (staff declare)
  • paper form (staff declare)

Evidence entity

  • Declared date
  • Type: declaration / cancellation / change of address / misc correspondence

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom adamps

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @adamps
  • 🇬🇧United Kingdom adamps
  • 🇬🇧United Kingdom adamps

    @jonathanshaw

    I updated the "Default bundles" list in the IS to add info about fields. Please can you review? At the moment there are two pairs of identical ones, so we could potentially combine them.

  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    These provided bundles are to be helpful, customisation is expected, so let's not overinvest in them. Given that, yes to everything except:

    Block staff access to create/edit declarations with evidence type "web".

    Better:
    - block staff access to create/edit evidence with type 'web'
    - block staff access to edit a declaration whose owner is the declarant

  • Merge request !8Issue #3512942: Create evidence entity → (Open) created by adamps
  • 🇬🇧United Kingdom adamps

    I'm seeing some very strange errors

    For example admin/gift-aid/evidence-type/add gives

    The "default" form handler of the "gift_aid_evidence_type" entity type specifies a non-existent class "Drupal\gift_aid\Form\Evidence\EvidenceTypeForm"

    If I call class_exists from drush eval it works. If I call it from a web-page it fails. If I randomly move the file to a different directory then it works.

    Similar for admin/gift-aid/evidence/add/

    @jonathanshaw Any chance you could try it on your own server when you get a chance please?

  • 🇬🇧United Kingdom adamps

    Don't worry - it was fixed by a webserver restart.

  • 🇬🇧United Kingdom adamps

    I have some doubts about usability. With inline-entity-form it could be good - staff ideally won't even notice there are 2 entities.

    Without that it seems pretty bad. The evidence entity it hard/impossible to refer to or select. My current implementation has no fields for donor, no declared date, no "record type" because I realise that they would all be duplication of the declaration. Nor does it have a label, and I don't see any sensible way to create one.

    Even with inline-entity-form, we are adding complexity. It could be quite a lot simpler if we just let staff upload any file that they like (in other words use a file field). I agree it's a bit of a hack. And it doesn't work so well with the self-declarations, but I guess we could add a different field for those (which doesn't need a form UI because they are generated in code).

    So I don't have a clear suggestion, I'm just putting it out for discussion if you feel. I'll have a quick try with IEF.

Production build 0.71.5 2024