Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11748

In Views, assignee and targets of activities return incorrect results

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.2.2
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)

      Description

      (You can tell I'm doing a ton of Views stuff, it will lead to something quite good for the Civi Community!)

      In civicrm.views.inc around lines 3320 to 3365

      $data['civicrm_activity_assignment']['table']['group'] = t('CiviCRM Activity Assignments');

      // Explain how this table joins to others.
      $data['civicrm_activity_assignment']['table']['join'] = array(
      // Directly links to event table
      'civicrm_activity' => array(
      'left_field' => 'id',
      'field' => 'activity_id',
      ),
      );

      $data['civicrm_activity_assignment']['assignee_contact_id'] = array(
      'title' => t('Assignee Contact ID'),
      'help' => t('The contact who is assigned the activity.'),
      'relationship' => array(
      'base' => 'civicrm_contact',
      'field' => 'id',
      'handler' => 'views_handler_relationship',
      'label' => t('CiviCRM Assignee Contact ID'),
      ),
      );

      // CHILLING OUT AT THE CIVICRM_ACTIVTY_ASSIGNMENT TABLE

      $data['civicrm_activity_target']['table']['group'] = t('CiviCRM Activity Targets');

      // Explain how this table joins to others.
      $data['civicrm_activity_target']['table']['join'] = array(
      // Directly links to event table
      'civicrm_activity' => array(
      'left_field' => 'id',
      'field' => 'activity_id',
      ),
      );

      $data['civicrm_activity_target']['target_contact_id'] = array(
      'title' => t('Target Contact ID'),
      'help' => t('The contact who is the activity\'s target.'),
      'relationship' => array(
      'base' => 'civicrm_contact',
      'field' => 'id',
      'handler' => 'views_handler_relationship',
      'label' => t('CiviCRM Target Contact ID'),
      ),
      );

      Should be…

      $data['civicrm_activity_assignment']['table']['group'] = t('CiviCRM Activity Assignments');

      // Explain how this table joins to others.
      $data['civicrm_activity_assignment']['table']['join'] = array(
      // Directly links to event table
      'civicrm_activity' => array(
      'left_field' => 'id',
      'field' => 'activity_id',
      ),
      );

      $data['civicrm_activity_assignment']['assignee_contact_id'] = array(
      'title' => t('Assignee Contact ID'),
      'help' => t('The contact who is assigned the activity.'),
      'relationship' => array(
      'base' => 'civicrm_contact',
      'field' => 'assignee_contact_id',
      'handler' => 'views_handler_relationship',
      'label' => t('CiviCRM Assignee Contact ID'),
      ),
      );

      // CHILLING OUT AT THE CIVICRM_ACTIVTY_ASSIGNMENT TABLE

      $data['civicrm_activity_target']['table']['group'] = t('CiviCRM Activity Targets');

      // Explain how this table joins to others.
      $data['civicrm_activity_target']['table']['join'] = array(
      // Directly links to event table
      'civicrm_activity' => array(
      'left_field' => 'id',
      'field' => 'activity_id',
      ),
      );

      $data['civicrm_activity_target']['target_contact_id'] = array(
      'title' => t('Target Contact ID'),
      'help' => t('The contact who is the activity\'s target.'),
      'relationship' => array(
      'base' => 'civicrm_contact',
      'field' => 'target_contact_id',
      'handler' => 'views_handler_relationship',
      'label' => t('CiviCRM Target Contact ID'),
      ),
      );

      With the previous code they were just pulling in meaningless connections.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chrischinchilla Chris Chinchilla
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: