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

Change log doesn't work with real dataset (ie. more than 50 changes)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.4
    • Fix Version/s: 4.3.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Contact Change log tab shows as blank if for all contacts EXCEPT for the first 50 to be changed after turning on Change logging.

      e.g.
      http://sandbox.drupal.civicrm.org/civicrm/contact/view?reset=1&cid=106

      To reproduce -
      1) turn on logging
      2) update > 50 contacts via batch profile (contact fields only)
      3) update a contact not already updated (contact fields only) - the change will not show on their log

      The contact log is left joined agains the first 50 non-initialization entries in each table so if you change tables other than contact you will need to create a load more data to do this test.

      Code is coming from

      CRM_Logging_ReportSummary::postProcess

      foreach ( $this->_logTables as $entity => $detail ) {
      $tableName = CRM_Utils_Array::value('table_name', $detail, $entity);
      $clause = CRM_Utils_Array::value('entity_table', $detail);
      $clause = $clause ? "entity_table = 'civicrm_contact' AND" : null;
      $sql = "
      INSERT IGNORE INTO civicrm_temp_civireport_logsummary ( contact_id )
      SELECT DISTINCT {$detail['fk']} FROM `{$this->loggingDB}`.{$tableName}
      WHERE {$clause} log_action != 'Initialization' {$logDateClause} LIMIT {$rowCount}";
      CRM_Core_DAO::executeQuery($sql);
      }

      This table then becomes the 'subject' of an INNER JOIN

      "SELECT SQL_CALC_FOUND_ROWS entity_log_civireport.id AS log_civicrm_entity_id, entity_log_civireport.log_action AS log_civicrm_entity_log_action, entity_log_civireport.log_type AS log_civicrm_entity_log_type, entity_log_civireport.log_user_id AS log_civicrm_entity_log_user_id, entity_log_civireport.log_date AS log_civicrm_entity_log_date, modified_contact_civireport.display_name AS log_civicrm_entity_altered_contact, modified_contact_civireport.id AS log_civicrm_entity_altered_contact_id, entity_log_civireport.log_conn_id AS log_civicrm_entity_log_conn_id, modified_contact_civireport.is_deleted AS log_civicrm_entity_is_deleted, altered_by_contact_civireport.display_name AS altered_by_contact_display_name
      FROM `wct`.log_civicrm_entity_tag entity_log_civireport
      INNER JOIN civicrm_temp_civireport_logsummary temp ON (entity_log_civireport.entity_id = temp.contact_id) ......."

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h