CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Campaign Survey Details report fails if Interviewer name displayed
Pages: [1]

Author Topic: Campaign Survey Details report fails if Interviewer name displayed  (Read 789 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Campaign Survey Details report fails if Interviewer name displayed
May 22, 2014, 08:43:15 am
This fails in 4.4.2 and is repeatable on the 4.4 demo.

To reproduce, bring up the Survey Details report, select the check box on the Interviewer Name display column, and CiviCRM throws a fatal error. The error message says: Unknown column 'activity_contact_civireport.contact_id' in 'field list'.

The following patch fixes this issue ...

Code: [Select]
--- /data/Download/CiviCRM/civicrm/CRM/Report/Form/Campaign/SurveyDetails.php 2014-02-07 14:29:30.000000000 +1100
+++ /var/www/citybibleforum/sites/all/modules/civicrm/CRM/Report/Form/Campaign/SurveyDetails.php 2014-05-23 01:33:13.406870200 +1000
@@ -84,7 +84,6 @@
         'fields' => array('contact_id' => array('title' => ts('Interviewer Name'))),
         'filters' => array(
           'contact_id' => array('name' => 'contact_id',
-            'alias' => 'civicrm_activity_assignment',
             'title' => ts('Interviewer Name'),
             'type' => CRM_Utils_Type::T_INT,
             'operatorType' =>
@@ -321,8 +320,8 @@
                       ( {$this->_aliases['civicrm_contact']}.id = civicrm_activity_target.contact_id AND civicrm_activity_target.record_type_id = {$targetID}) \n";
     $this->_from .= " INNER JOIN civicrm_activity {$this->_aliases['civicrm_activity']} ON
                       ( {$this->_aliases['civicrm_activity']}.id = civicrm_activity_target.activity_id )\n";
-    $this->_from .= " INNER JOIN civicrm_activity_contact civicrm_activity_assignment ON
-                      ( {$this->_aliases['civicrm_activity']}.id = civicrm_activity_assignment.activity_id  AND civicrm_activity_assignment.record_type_id = {$assigneeID} )\n";
+    $this->_from .= " INNER JOIN civicrm_activity_contact activity_contact_civireport ON
+                      ( {$this->_aliases['civicrm_activity']}.id = activity_contact_civireport.activity_id  AND activity_contact_civireport.record_type_id = {$assigneeID} )\n";
 
     //get the address table.
     $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON
@@ -612,8 +611,8 @@
       }
 
 
-      if (array_key_exists('civicrm_activity_assignment_assignee_contact_id', $row)) {
-        $rows[$rowNum]['civicrm_activity_assignment_assignee_contact_id'] = CRM_Utils_Array::value($row['civicrm_activity_assignment_assignee_contact_id'],
+      if (array_key_exists('civicrm_activity_contact_contact_id', $row)) {
+        $rows[$rowNum]['civicrm_activity_contact_contact_id'] = CRM_Utils_Array::value($row['civicrm_activity_contact_contact_id'],
           CRM_Campaign_BAO_Survey::getInterviewers()
         );
         $entryFound = TRUE;

There are 3 changes ...
  • Remove an alias 'civicrm_activity_assignment' from the filter for the civicrm_activity_contact column. It seemed to be in the wrong place.
  • Change the INNER JOINS that refer to 'civicrm_activity_assignment' and use 'activity_contact_civireport' which is the alias that CiviReport gives the table
  • Fix the array key, so the Interviewer's name is displayed rather than the Interviewer's Contact Id

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Campaign Survey Details report fails if Interviewer name displayed
May 22, 2014, 12:49:38 pm

Might want to file a PR for this. In general code changes are best done via PR's

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Campaign Survey Details report fails if Interviewer name displayed
May 28, 2014, 06:34:02 pm
OK. Though I understand the Core Team prefer people raise forum posts first?

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Campaign Survey Details report fails if Interviewer name displayed
June 06, 2014, 11:50:46 pm
Created issue https://issues.civicrm.org/jira/browse/CRM-14812 and PR https://github.com/civicrm/civicrm-core/pull/3452

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Campaign Survey Details report fails if Interviewer name displayed

This forum was archived on 2017-11-26.