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

Sorting the results of Find Cases by status gives fatal error

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.3.3
    • Component/s: CiviCase
    • Labels:
      None

      Description

      Reproduced on drupal.demo.civicrm.org

      Under Cases choose Find Cases.
      Leave blank to just search for all.
      Sort the results by status.

      Sorry. A non-recoverable error has occurred.
      DB Error: no such field
      Error Details
      Database Error Code: Unknown column 'case_status_id' in 'order clause', 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 DISTINCT ( civicrm_case.id ), contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_case.id as case_id, case_type.label as case_type, case_status.label as case_status, civicrm_case.is_deleted as case_deleted, case_relation_type.label_b_a as case_role, case_activity.activity_date_time as case_recent_activity_date, case_activity.activity_date_time as case_scheduled_activity_date, rec_activity_type.label as case_recent_activity_type FROM civicrm_contact contact_a LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 103 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND
      case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id
      AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type') LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_type ON (option_group_case_type.name = 'case_type') LEFT JOIN civicrm_option_value case_type ON (civicrm_case.case_type_id = case_type.value AND option_group_case_type.id = case_type.option_group_id ) WHERE ( civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_case.id ORDER BY case_status_id asc LIMIT 0, 50 [nativecode=1054 ** Unknown column 'case_status_id' in 'order clause']
      [type] => DB_Error
      [user_info] => SELECT DISTINCT ( civicrm_case.id ), contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_case.id as case_id, case_type.label as case_type, case_status.label as case_status, civicrm_case.is_deleted as case_deleted, case_relation_type.label_b_a as case_role, case_activity.activity_date_time as case_recent_activity_date, case_activity.activity_date_time as case_scheduled_activity_date, rec_activity_type.label as case_recent_activity_type FROM civicrm_contact contact_a LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 103 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND
      case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id
      AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type') LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_type ON (option_group_case_type.name = 'case_type') LEFT JOIN civicrm_option_value case_type ON (civicrm_case.case_type_id = case_type.value AND option_group_case_type.id = case_type.option_group_id ) WHERE ( civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_case.id ORDER BY case_status_id asc LIMIT 0, 50 [nativecode=1054 ** Unknown column 'case_status_id' in 'order clause']
      [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT ( civicrm_case.id ), contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_case.id as case_id, case_type.label as case_type, case_status.label as case_status, civicrm_case.is_deleted as case_deleted, case_relation_type.label_b_a as case_role, case_activity.activity_date_time as case_recent_activity_date, case_activity.activity_date_time as case_scheduled_activity_date, rec_activity_type.label as case_recent_activity_type FROM civicrm_contact contact_a LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 103 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND
      case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id
      AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type') LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_type ON (option_group_case_type.name = 'case_type') LEFT JOIN civicrm_option_value case_type ON (civicrm_case.case_type_id = case_type.value AND option_group_case_type.id = case_type.option_group_id ) WHERE ( civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_case.id ORDER BY case_status_id asc LIMIT 0, 50 [nativecode=1054 ** Unknown column 'case_status_id' in 'order clause']"]
      )

      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Error.php, backtrace, 159
      , handle,
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/PEAR.php, call_user_func, 931
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB.php, PEAR_Error, 968
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/PEAR.php, DB_Error, 564
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/common.php, raiseError, 1903
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/mysql.php, raiseError, 898
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/mysql.php, mysqlRaiseError, 327
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/common.php, simpleQuery, 1216
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/DataObject.php, query, 2421
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/DB/DataObject.php, _query, 1607
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/DAO.php, query, 145
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/DAO.php, query, 868
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Contact/BAO/Query.php, executeQuery, 3380
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Case/Selector/Search.php, searchQuery, 285
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Selector/Controller.php, getRows, 373
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Selector/Controller.php, getRows, 322
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Case/Form/Search.php, run, 410
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Case/Form/Search.php, postProcess, 192
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Form.php, preProcess, 314
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/QuickForm/Action/Display.php, buildForm, 99
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/HTML/QuickForm/Controller.php, perform, 203
      /var/www/drupal.civicrm.org/svn/civicrm33/packages/HTML/QuickForm/Page.php, handle, 103
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Controller.php, handle, 284
      /var/www/drupal.civicrm.org/svn/civicrm33/CRM/Core/Invoke.php, run, 219
      /var/www/drupal.civicrm.org/svn/civicrm33/drupal/civicrm.module, invoke, 356
      , civicrm_invoke,
      /var/www/drupal.civicrm.org/public/includes/menu.inc, call_user_func_array, 348
      /var/www/drupal.civicrm.org/public/index.php, menu_execute_active_handler, 18

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              demeritcowboy Dave D
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: