progressivetech / net.ourpowerbase.sumfields

The Summary Fields extension creates read-only custom data fields that extend Contact and are automatically populated with up-to-date totals such as total lifetime contributions, last contribution amount, last attended event, etc.
Other
8 stars 29 forks source link

Fatal error on first submit of settings form #12

Closed twomice closed 5 years ago

twomice commented 8 years ago

CiviCRM version: 4.6, with debugging and backtraces enabled.

To reproduce:

  1. Install extension from in-app Manage Extensions interface.
  2. Navigate to /civicrm/admin/setting/sumfields
  3. Check all checkboxes, and select "When I submit this form" under "When should these changes be applied?"
  4. Click "Save"
  5. Observe the following fatal error:
backTrace

#0 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/test1/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/test1/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: value count on row", -22, 16, (Array:2), "INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#4 /var/www/test1/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-22, 16, (Array:2), "INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#5 /var/www/test1/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -22, NULL, NULL, "INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...", "DB_Error", TRUE)
#6 /var/www/test1/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-22, NULL, NULL, NULL, "1136 ** Column count doesn't match value count at row 1")
#7 /var/www/test1/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /var/www/test1/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#9 /var/www/test1/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#10 /var/www/test1/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#11 /var/www/test1/sites/all/modules/civicrm/CRM/Core/DAO.php(321): DB_DataObject->query("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#12 /var/www/test1/sites/all/modules/civicrm/CRM/Core/DAO.php(1180): CRM_Core_DAO->query("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...", TRUE)
#13 /var/www/test1/sites/default/files/civicrm/extensions/net.ourpowerbase.sumfields/sumfields.php(490): CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id...")
#14 /var/www/test1/sites/default/files/civicrm/extensions/net.ourpowerbase.sumfields/sumfields.php(1274): sumfields_generate_data_based_on_current_data()
#15 /var/www/test1/sites/default/files/civicrm/extensions/net.ourpowerbase.sumfields/CRM/Sumfields/Form/SumFields.php(266): sumfields_gen_data((Array:0))
#16 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Form.php(345): CRM_Sumfields_Form_SumFields->postProcess()
#17 /var/www/test1/sites/all/modules/civicrm/CRM/Core/StateMachine.php(164): CRM_Core_Form->mainProcess()
#18 /var/www/test1/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Sumfields_Form_SumFields), "next", "Next")
#19 /var/www/test1/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Sumfields_Form_SumFields), "next")
#20 /var/www/test1/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Sumfields_Form_SumFields), "next")
#21 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("next")
#22 /var/www/test1/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(115): CRM_Core_Controller->run()
#23 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Sumfields_Form_SumFields", "SumFields", NULL)
#24 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
#25 /var/www/test1/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:4))
#26 /var/www/test1/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:4))
#27 [internal function](): civicrm_invoke("admin", "setting", "sumfields")
#28 /var/www/test1/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
#29 /var/www/test1/index.php(21): menu_execute_active_handler()
#30 {main}
Sorry but we are not able to provide this at the moment.
DB Error: value count on row
Error Details
Database Error Code: Column count doesn't match value count at row 1, 1136
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -22
    [message] => DB Error: value count on row
    [mode] => 16
    [debug_info] => INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id,
(SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND civicrm_event.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND e.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
    [type] => DB_Error
    [user_info] => INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id,
(SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND civicrm_event.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND e.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
    [to_string] => [db_error: message="DB Error: value count on row" code=-22 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO `civicrm_temp_24ca0b0a5a5845b5a58659f4eea14311` SELECT contact_id,
(SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND civicrm_event.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
      AND e.event_type_id IN (1,2,3,4,5,6) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2,8,4,12,3,7,14,10,6,5,9,13,15,1,11)
  AND e.event_type_id IN (1,2,3,4,5,6)), 0) / IFNULL((SELECT COUNT(id) AS summary_value FROM civicrm_participant WHERE contact_id = t2.contact_id), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]"]
)
jackaponte commented 6 years ago

I'm getting a very similar error when I try to save the Summary Fields settings form, but I don't think it's the first time the form has been saved. CiviCRM 4.6.33, Summary Fields 3.1.1 OR 3.1.3.

jmcclelland commented 6 years ago

I suspect this is a 4.6 error (since I can't replicate in 4.7). Do you also get "Column count doesn't match value count at row 1, 1136"? That error suggests that somehow we are mis-counting the number of fields that should be in the temporary table. I'm not sure how that is happening or why it would only happen in 4.6.

jackaponte commented 6 years ago

I suspect this is a 4.6 error (since I can't replicate in 4.7).

I've not seen this error on any 4.7 sites yet either. I'll try to find another 4.6 site where I can try to replicate the error.

Do you also get "Column count doesn't match value count at row 1, 1136"?

Yup. Here's what I see in my Civi log:

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

    [code] => -22
    [message] => DB Error: value count on row
    [mode] => 16
    [debug_info] => INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
    [type] => DB_Error
    [user_info] => INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
    [to_string] => [db_error: message="DB Error: value count on row" code=-22 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
      FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
      WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
      t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
      AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
  t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
  AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
 t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]"]
)

That error suggests that somehow we are mis-counting the number of fields that should be in the temporary table. I'm not sure how that is happening or why it would only happen in 4.6.

Hmm. Any idea whether one can safely blow away that temporary table to try to overcome the error? No idea where that table comes from so don't know what the other ramifications might be, but I may try that on a test site!

jackaponte commented 6 years ago

Hmm. Any idea whether one can safely blow away that temporary table to try to overcome the error? No idea where that table comes from so don't know what the other ramifications might be, but I may try that on a test site!

Found that I can't "blow away" a temporary table that is temporary and seems to only exist while the SumFields settings page is being saved. :)

I checked out a few other CiviCRM 4.6.x sites with Summary Fields installed and none of them have this problem. Unsure of how to proceed from here!

jmcclelland commented 6 years ago

This is mysterious. The code should be reading the configuration from custom.php and creating a temporary table with a field for each record in custom.php that is enabled in your configuration, has trigger_table set to civicrm_participant, and has a trigger_sql field. Then, it should insert the results of each sql statement into this table.

Can you take a screen shot of the Events section of your sumfields settings page on the site with this problem? I wonder if there is some combination of settings that might be causing the problem?

Another idea would be to disable and uninstall the extension and try it again with the same settings- this isn't a rational suggestion :) - but it seems to work a lot.

scoobird commented 6 years ago

Hi hullo, working with Jack on the same site. Can confirm uninstalling and re-installing either 3.1.1 or 3.1.3 produces the same error.

Screenshot attached. I removed some custom event types from this screen for privacy but we're trying to save for all event types. This site does have custom participant statuses that are not shown and don't need to be part of the calculations, not sure if that might be a factor. Site also has civi database logging enabled. sumfields_events_screen

jmcclelland commented 5 years ago

Sorry I dropped the ball on this. Are you still having this trouble? See https://github.com/progressivetech/net.ourpowerbase.sumfields/issues/42 for some steps I recently went through to fully rid a system of summary fields so it could be re-installed.

scoobird commented 5 years ago

Thanks for checking up on this! This particular issue has not recurred for me at least. I have had to manually delete the summary fields tables and related log tables as you describe, when moving a site recently. But unfortunately I didn't take very detailed notes of what happened when I ran into that issue.

jmcclelland commented 5 years ago

Thanks for the update. I will consider this issue closed then.