• Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:


      Activity History provides a mechanism for storing and displaying activities done by or to a contact. CA's can be registered by an external module (e.g. CivicSpace's Event or Volunteer modules), or by one of our modules (CiviCRM, Email Broadcast, Donations). Example CA's include "phone call", "email sent", "online donation", "event attended"....

      Implementation tasks are:
      1. Schema / DAO
      2. APIs (insert, get, update, delete)
      3. Form and Page for browse, add/edit activities
      4. Advanced Search integration


      1. Implement crm_history table and corresponding DAO
      1.1 Proposed schema
      NOTE: This is a modification from last rev of svn/crm/sql/Contacts.sql.DO_NOT_DELETE and Public Data Model

      DROP TABLE IF EXISTS crm_history;
      CREATE TABLE crm_activity(


      – Initially, activities will be linked to contacts, but later we can support other entities
      entity_table varchar(64) COMMENT 'physical tablename for entity being tagged, e.g. crm_contact',
      entity_id int unsigned NOT NULL COMMENT 'FK to entity table specified in entity_table column.',

      activity_type varchar(64) COMMENT 'sortable label for this activity assigned be registering module or user (e.g. Phone Call)',

      module VARCHAR(64) COMMENT 'Display name of module which registered this activity.',
      callback VARCHAR(64) COMMENT 'Function to call which will return URL for viewing details.',
      activity_id INT UNSIGNED NOT NULL COMMENT 'FK to details item - passed to callback',
      activity_summary VARCHAR(255) COMMENT 'brief description of activity for summary display - as populated by registering module',

      activity_date DATETIME DEFAULT 0 COMMENT 'when did this activity occur',

      relationship_id INT COMMENT 'OPTIONAL FK to Which relationship (of this contact) potentially triggered this activity, i.e. he donated because he was a Board Member of Org X / Employee of Org Y',
      group_id INT COMMENT 'OPTIONAL FK to Was this part of a group communication that triggered this activity?',

        • Drupal dev stds require using module as function name prefix, so that should take care of 'name-spacing' functions
        • Need indexes on entity_table + entity_id, also for module, activity_type, and for activity_date.


      2. Implement insert, get, update, and delete APIs (these will be used by our internal page calls AND by external modules)
      2.1 Draft specs for insert and get are at (but change 'actions' to 'history', etc.):


      3. Page and Form for browse Activity History
      3.1 Create an 'Activities' page. Initially this tab will have browser for Activity History. Subsequently, we will add an Open Activities section.
      3.1.1 this is a new tab (local task) for contact/view
      3.1.2 browse table columns are:
      Activity Type (crm_activity.label)
      Description (crm_activity.summary)
      Activity Date (crm_activity.activity_date)
      [action column links...]
      3.1.3 browse table requires pager and column sort capabilities for Activity Type and Date (will probably need filters by module, date and ?? at a later point)
      3.1.4 Action links are dependent on whether a 'callback' is present.

      • If callback present, include 'Details' link (this invokes the callback to get the URL and then relocates to the URL).
      • All rows include 'Delete' link

      3.2 Top 3 crm_history are exposed in the main Contact Summary page (contact/view) in a new section called 'Recent Activities'. Refer to mockup here:

        • Clone the existing 'Group Memberships' section in Contact.tpl for layout/display-hide behaviors


      4. Integration with Advanced Search
      4.1 Add 3 additional search criteria input to advanced search form/query (these form an 'AND' clause to the search when populated):

      • Activity Type (use similar matching logic as for 'sort_name', e.g. split on spaces and add % to front and back of each slice)
      • Activities Between: [dd][mon][yyyy] and [dd][mon][yyyy]
        (match is inclusive, no date filter if dates not specified, GTE or LTE if only begin or end date specified)




            • Assignee:
              yasheshb Yashesh Bhatia
              yasheshb Yashesh Bhatia
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: