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

Contribution Aggregate by Relationship report fails with custom contribution field

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.5
    • Fix Version/s: 4.5
    • Component/s: CiviReport
    • Labels:
      None

      Description

      If you create a searchable custom contribution field, the Contribution Aggregate by Relationship report will allow you to select that field as a display column. If you do, however, you get a backtrace:

      #0 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Error.php(149): CRM_Core_Error::backtrace()
      #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
      #2 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #4 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #5 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", "DB_Error", TRUE)
      #6 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'value_contributions_27_civireport.donor_responded_to_...")
      #7 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
      #8 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #9 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #10 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #11 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/DAO.php(160): DB_DataObject->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #12 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/DAO.php(908): CRM_Core_DAO->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", TRUE)
      #13 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Report/Form/Contribute/History.php(622): CRM_Core_DAO::executeQuery("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
      #14 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Report/Form/Contribute/History.php(555): CRM_Report_Form_Contribute_History->buildContributionRows((Array:50))
      #15 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Report/Form/Contribute/History.php(505): CRM_Report_Form_Contribute_History->buildRows((Array:0))
      #16 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Form.php(261): CRM_Report_Form_Contribute_History->postProcess()
      #17 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Submit.php(73): CRM_Core_Form->mainProcess()
      #18 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Submit->perform(Object(CRM_Report_Form_Contribute_History), "submit")
      #19 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Report_Form_Contribute_History), "submit")
      #20 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Controller.php(339): HTML_QuickForm_Page->handle("submit")
      #21 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
      #22 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Report/Page/Report.php(77): CRM_Utils_Wrapper->run("CRM_Report_Form_Contribute_History", NULL, NULL)
      #23 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Invoke.php(323): CRM_Report_Page_Report->run((Array:4), NULL)
      #24 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:14))
      #25 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
      #26 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:4))
      #27 [internal function](): civicrm_invoke("report", "contribute", "history")
      #28 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:3))
      #29 /var/aegir/platforms/master-ourpowerbase-d7-c4.4/index.php(21): menu_execute_active_handler()
      #30

      {main}

      Sorry but we are not able to provide this at the moment.
      DB Error: no such field

      Database Error Code: Unknown column 'value_contributions_27_civireport.donor_responded_to_154' in 'field list', 1054
      Additional Details:

      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -19
      [message] => DB Error: no such field
      [mode] => 16
      [debug_info] => SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, SUM(contribution_civireport.total_amount) as civicrm_contribution_total_amount, YEAR(contribution_civireport.receive_date) as civicrm_contribution_receive_date, value_contributions_27_civireport.donor_responded_to_154 as civicrm_value_contributions_27_custom_154
      FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
      ON contact_civireport.id = contribution_civireport.contact_id AND
      contribution_civireport.is_test = 0 WHERE contact_civireport.id IN (3,4,5,6,9,11,13,16,21,24,25,28,30,32,35,38,42,43,47,48,49,51,52,54,58,60,61,64,68,70,73,76,77,79,81,85,86,90,95,96,98,100,106,107,110,112,114,120,121,124) AND contribution_civireport.is_test = 0 AND ( contribution_civireport.contribution_status_id IN (1) ) GROUP BY contribution_civireport.contact_id, YEAR(contribution_civireport.receive_date) [nativecode=1054 ** Unknown column 'value_contributions_27_civireport.donor_responded_to_154' in 'field list']
      [type] => DB_Error
      [user_info] => SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, SUM(contribution_civireport.total_amount) as civicrm_contribution_total_amount, YEAR(contribution_civireport.receive_date) as civicrm_contribution_receive_date, value_contributions_27_civireport.donor_responded_to_154 as civicrm_value_contributions_27_custom_154
      FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
      ON contact_civireport.id = contribution_civireport.contact_id AND
      contribution_civireport.is_test = 0 WHERE contact_civireport.id IN (3,4,5,6,9,11,13,16,21,24,25,28,30,32,35,38,42,43,47,48,49,51,52,54,58,60,61,64,68,70,73,76,77,79,81,85,86,90,95,96,98,100,106,107,110,112,114,120,121,124) AND contribution_civireport.is_test = 0 AND ( contribution_civireport.contribution_status_id IN (1) ) GROUP BY contribution_civireport.contact_id, YEAR(contribution_civireport.receive_date) [nativecode=1054 ** Unknown column 'value_contributions_27_civireport.donor_responded_to_154' in 'field list']
      [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, SUM(contribution_civireport.total_amount) as civicrm_contribution_total_amount, YEAR(contribution_civireport.receive_date) as civicrm_contribution_receive_date, value_contributions_27_civireport.donor_responded_to_154 as civicrm_value_contributions_27_custom_154
      FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
      ON contact_civireport.id = contribution_civireport.contact_id AND
      contribution_civireport.is_test = 0 WHERE contact_civireport.id IN (3,4,5,6,9,11,13,16,21,24,25,28,30,32,35,38,42,43,47,48,49,51,52,54,58,60,61,64,68,70,73,76,77,79,81,85,86,90,95,96,98,100,106,107,110,112,114,120,121,124) AND contribution_civireport.is_test = 0 AND ( contribution_civireport.contribution_status_id IN (1) ) GROUP BY contribution_civireport.contact_id, YEAR(contribution_civireport.receive_date) [nativecode=1054 ** Unknown column 'value_contributions_27_civireport.donor_responded_to_154' in 'field list']"]
      )

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              jamie Jamie McClelland
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: