Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 1.4
-
Fix Version/s: 1.5
-
Component/s: Technical infrastructure
-
Labels:None
Description
I am attempting to work with a sorted results list.
Print just ignores the sort order and creates the print window sorted by name.
Export crashes if any sort order other than name is currently displayed.
Steps to reproduce on Demo
1) Log into demo.
2) Select civicrm
3) Select a group to find (I chose Foster Care MIN because it has 5 records)
4) Click on Search
5) Click on Postal to sort the list by zip (fails for Canadian Postal Codes, too )
6) Click on Print (hoping to get the Print list sorted by postal)
7) BUG: Print window opens up, sorted by name. It has ignored the chosen display sort)
8) Close Print window without printing.
9) Confirm sort order still Postal.
10) Select Export from drop list.
11) Click on GO.
12) Click Continue (will fail both for Primary or selected fields)
13) BUG: System fails with the following text displayed:
Find Contacts
unrecoverable error
Sorry. A non-recoverable error has occurred.
Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY civicrm_contact.id' at line 5, 1064
Return to CiviCRM menu.
error
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] => SELECT civicrm_contact.id as contact_id, civicrm_individual.id as individual_id, civicrm_individual.first_name as `first_name`, civicrm_individual.middle_name as `middle_name`, civicrm_individual.last_name as `last_name`, civicrm_individual.job_title as `job_title`, civicrm_individual.birth_date as `birth_date`, civicrm_individual.is_deceased as `is_deceased`, civicrm_individual_prefix.id as individual_prefix_id, civicrm_individual_prefix.name as `individual_prefix`, civicrm_individual_suffix.id as individual_suffix_id, civicrm_individual_suffix.name as `individual_suffix`, civicrm_gender.id as gender_id, civicrm_gender.name as `gender`, civicrm_household.id as household_id, civicrm_household.household_name as `household_name`, civicrm_organization.id as organization_id, civicrm_organization.organization_name as `organization_name`, civicrm_organization.legal_name as `legal_name`, civicrm_organization.sic_code as `sic_code`, civicrm_location.id as location_id, civicrm_address.id as address_id, civicrm_location_type.id as location_type_id, civicrm_location_type.name as `location_type`, civicrm_location.name as `name`, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.city as `city`, civicrm_address.postal_code as `postal_code`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_state_province.id as state_province_id, civicrm_state_province.abbreviation as `state_province`, civicrm_country.id as country_id, civicrm_country.name as `country`, civicrm_phone.id as phone_id, civicrm_phone.phone_type as phone_type, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_im_provider.id as im_provider_id, civicrm_im_provider.name as `im_provider`, civicrm_im.id as im_id, civicrm_im.name as `im`, civicrm_contact.id as `id`, civicrm_contact.legal_identifier as `legal_identifier`, civicrm_contact.external_identifier as `external_identifier`, civicrm_contact.nick_name as `nick_name`, civicrm_contact.home_URL as `home_URL`, civicrm_contact.preferred_communication_method as `preferred_communication_method`, civicrm_contact.preferred_mail_format as `preferred_mail_format`, civicrm_contact.do_not_phone as `do_not_phone`, civicrm_contact.do_not_email as `do_not_email`, civicrm_contact.do_not_mail as `do_not_mail`, civicrm_contact.do_not_trade as `do_not_trade`, civicrm_contact.is_opt_out as `is_opt_out`, civicrm_note.id as note_id, civicrm_note.note as `note`, GROUP_CONCAT(DISTINCT(civicrm_group.name)) AS groups, GROUP_CONCAT(DISTINCT(civicrm_tag.name)) AS tags, custom_value_15.id as custom_value_15_id, custom_value_15.char_data as custom_15, civicrm_group_contact.id as group_contact_id, civicrm_group_contact.status as status FROM civicrm_contact LEFT JOIN civicrm_individual ON (civicrm_contact.id = civicrm_individual.contact_id) LEFT JOIN civicrm_household ON (civicrm_contact.id = civicrm_household.contact_id) LEFT JOIN civicrm_organization ON (civicrm_contact.id = civicrm_organization.contact_id) LEFT JOIN civicrm_individual_prefix ON civicrm_individual.prefix_id = civicrm_individual_prefix.id LEFT JOIN civicrm_individual_suffix ON civicrm_individual.suffix_id = civicrm_individual_suffix.id LEFT JOIN civicrm_gender ON civicrm_individual.gender_id = civicrm_gender.id LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_location_type ON civicrm_location.location_type_id = civicrm_location_type.id LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_im_provider ON civicrm_im.provider_id = civicrm_im_provider.id LEFT JOIN civicrm_group_contact ON civicrm_contact.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_entity_tag ON ( civicrm_entity_tag.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_entity_tag.entity_id ) LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_note.entity_id ) LEFT JOIN civicrm_tag ON civicrm_entity_tag.tag_id = civicrm_tag.id
LEFT JOIN civicrm_custom_value custom_value_15 ON custom_value_15.custom_field_id = 15 AND custom_value_15.entity_table = 'civicrm_contact' AND custom_value_15.entity_id = civicrm_contact.id WHERE civicrm_contact.domain_id = 1 AND civicrm_group_contact.group_id IN (5) AND civicrm_group_contact.status IN ("Added") ORDER BY postal_code asc GROUP BY civicrm_contact.id [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY civicrm_contact.id' at line 5]
[type] => DB_Error
[user_info] => SELECT civicrm_contact.id as contact_id, civicrm_individual.id as individual_id, civicrm_individual.first_name as `first_name`, civicrm_individual.middle_name as `middle_name`, civicrm_individual.last_name as `last_name`, civicrm_individual.job_title as `job_title`, civicrm_individual.birth_date as `birth_date`, civicrm_individual.is_deceased as `is_deceased`, civicrm_individual_prefix.id as individual_prefix_id, civicrm_individual_prefix.name as `individual_prefix`, civicrm_individual_suffix.id as individual_suffix_id, civicrm_individual_suffix.name as `individual_suffix`, civicrm_gender.id as gender_id, civicrm_gender.name as `gender`, civicrm_household.id as household_id, civicrm_household.household_name as `household_name`, civicrm_organization.id as organization_id, civicrm_organization.organization_name as `organization_name`, civicrm_organization.legal_name as `legal_name`, civicrm_organization.sic_code as `sic_code`, civicrm_location.id as location_id, civicrm_address.id as address_id, civicrm_location_type.id as location_type_id, civicrm_location_type.name as `location_type`, civicrm_location.name as `name`, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.city as `city`, civicrm_address.postal_code as `postal_code`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_state_province.id as state_province_id, civicrm_state_province.abbreviation as `state_province`, civicrm_country.id as country_id, civicrm_country.name as `country`, civicrm_phone.id as phone_id, civicrm_phone.phone_type as phone_type, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_im_provider.id as im_provider_id, civicrm_im_provider.name as `im_provider`, civicrm_im.id as im_id, civicrm_im.name as `im`, civicrm_contact.id as `id`, civicrm_contact.legal_identifier as `legal_identifier`, civicrm_contact.external_identifier as `external_identifier`, civicrm_contact.nick_name as `nick_name`, civicrm_contact.home_URL as `home_URL`, civicrm_contact.preferred_communication_method as `preferred_communication_method`, civicrm_contact.preferred_mail_format as `preferred_mail_format`, civicrm_contact.do_not_phone as `do_not_phone`, civicrm_contact.do_not_email as `do_not_email`, civicrm_contact.do_not_mail as `do_not_mail`, civicrm_contact.do_not_trade as `do_not_trade`, civicrm_contact.is_opt_out as `is_opt_out`, civicrm_note.id as note_id, civicrm_note.note as `note`, GROUP_CONCAT(DISTINCT(civicrm_group.name)) AS groups, GROUP_CONCAT(DISTINCT(civicrm_tag.name)) AS tags, custom_value_15.id as custom_value_15_id, custom_value_15.char_data as custom_15, civicrm_group_contact.id as group_contact_id, civicrm_group_contact.status as status FROM civicrm_contact LEFT JOIN civicrm_individual ON (civicrm_contact.id = civicrm_individual.contact_id) LEFT JOIN civicrm_household ON (civicrm_contact.id = civicrm_household.contact_id) LEFT JOIN civicrm_organization ON (civicrm_contact.id = civicrm_organization.contact_id) LEFT JOIN civicrm_individual_prefix ON civicrm_individual.prefix_id = civicrm_individual_prefix.id LEFT JOIN civicrm_individual_suffix ON civicrm_individual.suffix_id = civicrm_individual_suffix.id LEFT JOIN civicrm_gender ON civicrm_individual.gender_id = civicrm_gender.id LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_location_type ON civicrm_location.location_type_id = civicrm_location_type.id LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_im_provider ON civicrm_im.provider_id = civicrm_im_provider.id LEFT JOIN civicrm_group_contact ON civicrm_contact.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_entity_tag ON ( civicrm_entity_tag.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_entity_tag.entity_id ) LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_note.entity_id ) LEFT JOIN civicrm_tag ON civicrm_entity_tag.tag_id = civicrm_tag.id
LEFT JOIN civicrm_custom_value custom_value_15 ON custom_value_15.custom_field_id = 15 AND custom_value_15.entity_table = 'civicrm_contact' AND custom_value_15.entity_id = civicrm_contact.id WHERE civicrm_contact.domain_id = 1 AND civicrm_group_contact.group_id IN (5) AND civicrm_group_contact.status IN ("Added") ORDER BY postal_code asc GROUP BY civicrm_contact.id [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY civicrm_contact.id' at line 5]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT civicrm_contact.id as contact_id, civicrm_individual.id as individual_id, civicrm_individual.first_name as `first_name`, civicrm_individual.middle_name as `middle_name`, civicrm_individual.last_name as `last_name`, civicrm_individual.job_title as `job_title`, civicrm_individual.birth_date as `birth_date`, civicrm_individual.is_deceased as `is_deceased`, civicrm_individual_prefix.id as individual_prefix_id, civicrm_individual_prefix.name as `individual_prefix`, civicrm_individual_suffix.id as individual_suffix_id, civicrm_individual_suffix.name as `individual_suffix`, civicrm_gender.id as gender_id, civicrm_gender.name as `gender`, civicrm_household.id as household_id, civicrm_household.household_name as `household_name`, civicrm_organization.id as organization_id, civicrm_organization.organization_name as `organization_name`, civicrm_organization.legal_name as `legal_name`, civicrm_organization.sic_code as `sic_code`, civicrm_location.id as location_id, civicrm_address.id as address_id, civicrm_location_type.id as location_type_id, civicrm_location_type.name as `location_type`, civicrm_location.name as `name`, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.city as `city`, civicrm_address.postal_code as `postal_code`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_state_province.id as state_province_id, civicrm_state_province.abbreviation as `state_province`, civicrm_country.id as country_id, civicrm_country.name as `country`, civicrm_phone.id as phone_id, civicrm_phone.phone_type as phone_type, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_im_provider.id as im_provider_id, civicrm_im_provider.name as `im_provider`, civicrm_im.id as im_id, civicrm_im.name as `im`, civicrm_contact.id as `id`, civicrm_contact.legal_identifier as `legal_identifier`, civicrm_contact.external_identifier as `external_identifier`, civicrm_contact.nick_name as `nick_name`, civicrm_contact.home_URL as `home_URL`, civicrm_contact.preferred_communication_method as `preferred_communication_method`, civicrm_contact.preferred_mail_format as `preferred_mail_format`, civicrm_contact.do_not_phone as `do_not_phone`, civicrm_contact.do_not_email as `do_not_email`, civicrm_contact.do_not_mail as `do_not_mail`, civicrm_contact.do_not_trade as `do_not_trade`, civicrm_contact.is_opt_out as `is_opt_out`, civicrm_note.id as note_id, civicrm_note.note as `note`, GROUP_CONCAT(DISTINCT(civicrm_group.name)) AS groups, GROUP_CONCAT(DISTINCT(civicrm_tag.name)) AS tags, custom_value_15.id as custom_value_15_id, custom_value_15.char_data as custom_15, civicrm_group_contact.id as group_contact_id, civicrm_group_contact.status as status FROM civicrm_contact LEFT JOIN civicrm_individual ON (civicrm_contact.id = civicrm_individual.contact_id) LEFT JOIN civicrm_household ON (civicrm_contact.id = civicrm_household.contact_id) LEFT JOIN civicrm_organization ON (civicrm_contact.id = civicrm_organization.contact_id) LEFT JOIN civicrm_individual_prefix ON civicrm_individual.prefix_id = civicrm_individual_prefix.id LEFT JOIN civicrm_individual_suffix ON civicrm_individual.suffix_id = civicrm_individual_suffix.id LEFT JOIN civicrm_gender ON civicrm_individual.gender_id = civicrm_gender.id LEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_location.entity_id AND civicrm_location.is_primary = 1) LEFT JOIN civicrm_location_type ON civicrm_location.location_type_id = civicrm_location_type.id LEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id LEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (civicrm_location.id = civicrm_phone.location_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (civicrm_location.id = civicrm_im.location_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_im_provider ON civicrm_im.provider_id = civicrm_im_provider.id LEFT JOIN civicrm_group_contact ON civicrm_contact.id = civicrm_group_contact.contact_id LEFT JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id LEFT JOIN civicrm_entity_tag ON ( civicrm_entity_tag.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_entity_tag.entity_id ) LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
civicrm_contact.id = civicrm_note.entity_id ) LEFT JOIN civicrm_tag ON civicrm_entity_tag.tag_id = civicrm_tag.id
LEFT JOIN civicrm_custom_value custom_value_15 ON custom_value_15.custom_field_id = 15 AND custom_value_15.entity_table = 'civicrm_contact' AND custom_value_15.entity_id = civicrm_contact.id WHERE civicrm_contact.domain_id = 1 AND civicrm_group_contact.group_id IN (5) AND civicrm_group_contact.status IN ("Added") ORDER BY postal_code asc GROUP BY civicrm_contact.id [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY civicrm_contact.id' at line 5]"]
)