Hi,

Civi 4.4 has a improved the way it stores relationships between activities and contact, but means the old tables (eg assigmenent) aren't there anymore... and this module still expect them

Do you have a plan to upgrade? The status is "actively maintained", but it doesn't seem they have been a lot of activitiy recently, including in the issue queue. Is the status still correct?

Comments

jlunning’s picture

Hi tttp,

I'm not a maintainer of this project (just a user), however, I have patched this module to work with CiviCRM 4.4 as I ran into the same problem you did.

You have to edit the file: /path-to-drupal/sites/all/modules/civicrm_activity_ical/functions.php

There is a "query" string variable containing an SQL SELECT statement starting at line 242 and ending at line 312. Basically just delete this SQL statement and replace it with the following which is compatible with 4.4. I tested with Google Calendar. Hope this helps.

 $query = "
 SELECT
    contact_primary.id as contact_id,
    civicrm_activity.id,
    source.id AS source_id,
    source.display_name AS `source_display_name`,
    GROUP_CONCAT(
      DISTINCT
      other_assignee.display_name
      SEPARATOR '; '
    ) AS other_assignees,
    GROUP_CONCAT(
      DISTINCT
      target.display_name
      SEPARATOR '; '
    ) AS targets,
    civicrm_activity.activity_type_id,
    activity_type.label AS activity_type,
    civicrm_activity.subject AS activity_subject,
    civicrm_activity.activity_date_time AS activity_date_time,
    civicrm_activity.duration AS activity_duration,
    civicrm_activity.location AS activity_location,
    civicrm_activity.details AS activity_details
    FROM civicrm_contact contact_primary

    LEFT JOIN civicrm_activity_contact activity_assignment 
		ON ( 
			activity_assignment.contact_id = contact_primary.id 
			AND activity_assignment.record_type_id = 1
		)
    LEFT JOIN civicrm_activity
      ON (
        civicrm_activity.id = activity_assignment.activity_id
        AND civicrm_activity.is_deleted = 0
        AND civicrm_activity.is_current_revision = 1
      )

	LEFT JOIN civicrm_activity_contact activity_source
	  ON (
			activity_source.activity_id = civicrm_activity.id
			AND activity_source.record_type_id = 2
		)

    INNER JOIN civicrm_contact source ON source.id = activity_source.contact_id

    LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type')
    LEFT JOIN civicrm_option_value activity_type
      ON (
        civicrm_activity.activity_type_id = activity_type.value
        AND option_group_activity_type.id = activity_type.option_group_id
      )

    LEFT JOIN civicrm_activity_contact other_activity_assignment 
	  ON (
		civicrm_activity.id = other_activity_assignment.activity_id
		AND other_activity_assignment.record_type_id = 1
	  )
    LEFT JOIN civicrm_contact other_assignee ON other_activity_assignment.contact_id = other_assignee.id AND other_assignee.is_deleted = 0 and other_assignee.id <> contact_primary.id

    LEFT JOIN civicrm_activity_contact activity_target 
	  ON (
		civicrm_activity.id = activity_target.activity_id
		AND activity_target.record_type_id = 3
	  )
    LEFT JOIN civicrm_contact target ON activity_target.contact_id = target.id

    WHERE civicrm_activity.status_id NOT IN (". implode(',', $placeholders['status']) . ") AND contact_primary.id = '{$placeholders['contact_id']}' AND civicrm_activity.is_test = 0

    GROUP BY civicrm_activity.id
    ORDER BY activity_date_time desc
";
TwoMice’s picture

Assigned: Unassigned » TwoMice
Status: Active » Needs work
TwoMice’s picture

Status: Needs work » Fixed

Fixed in 7.x-1.x, commit 28e2f535d87f8c7b82834e740846f20566e994f5. Thanks for the patch, jlunning!

TwoMice’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

CiviCRM doesn't officially support Drupal 6, but this should be easy enough to backport.

TwoMice’s picture

Fixed in 6.x-1.x.

Thanks again to jlunning for the original patch!

TwoMice’s picture

Status: Patch (to be ported) » Fixed
TwoMice’s picture

Status: Fixed » Closed (fixed)