CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.1 Release Testing (Moderator: Kurund Jalmi) »
  • Contribution search failure
Pages: [1]

Author Topic: Contribution search failure  (Read 1461 times)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Contribution search failure
December 07, 2011, 08:45:15 pm
So I get a fatal error for contribution searches (both the traditional search, and the "search" that happens when you click on a contact's contribution tab). For some reason the query seems to be left-joining every existing custom field group, not just those which are for contributions. Aside from causing a db error, this is horribly inefficient
Code: [Select]
[callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => SELECT  civicrm_contribution.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_contribution.id as contribution_id, civicrm_contribution.currency as `currency`, civicrm_contribution.receive_date as `receive_date`, civicrm_contribution.non_deductible_amount as `non_deductible_amount`, civicrm_contribution.total_amount as `total_amount`, civicrm_contribution.fee_amount as `fee_amount`, civicrm_contribution.net_amount as `net_amount`, civicrm_contribution.trxn_id as `trxn_id`, civicrm_contribution.invoice_id as `invoice_id`, civicrm_contribution.cancel_date as `cancel_date`, civicrm_contribution.cancel_reason as `cancel_reason`, civicrm_contribution.receipt_date as `receipt_date`, civicrm_contribution.thankyou_date as `thankyou_date`, civicrm_contribution.source as `contribution_source`, civicrm_contribution.amount_level as `amount_level`, civicrm_contribution.is_test as `is_test`, civicrm_contribution.is_pay_later as `is_pay_later`, civicrm_contribution.check_number as `check_number`, civicrm_contribution.campaign_id as contribution_campaign_id, civicrm_contribution_type.id as contribution_type_id, civicrm_contribution_type.name as contribution_type, civicrm_contribution_type.accounting_code as `accounting_code`, payment_instrument.id as instrument_id, payment_instrument.label as `payment_instrument`, civicrm_product.id as product_id, civicrm_product.name as `product_name`, civicrm_product.sku as `sku`, civicrm_contribution_product.id as contribution_product_id, civicrm_contribution_product.product_option as `product_option`, civicrm_contribution_product.fulfilled_date as `fulfilled_date`, civicrm_contribution_product.start_date as `contribution_start_date`, civicrm_contribution_product.end_date as `contribution_end_date`, civicrm_contribution.contribution_recur_id as `contribution_recur_id`, civicrm_note.note as contribution_note, contribution_status.value as contribution_status_id, contribution_status.label as contribution_status, payment_instrument.name as contribution_payment_instrument, civicrm_contribution.check_number as contribution_check_number, civicrm_value_additional_info_2.id as civicrm_value_additional_info_2_id, civicrm_value_additional_info_2.hs_graduation_date_4 as custom_4, civicrm_value_additional_info_2.previous_name_51 as custom_51, civicrm_value_semester_choices_3.id as civicrm_value_semester_choices_3_id, civicrm_value_semester_choices_3.semesters_5 as custom_5, civicrm_value_heard_about_woolman_4.id as civicrm_value_heard_about_woolman_4_id, civicrm_value_heard_about_woolman_4.what_did_they_hear_about_6 as custom_6, civicrm_value_heard_about_woolman_4.how_did_they_hear_about_it__7 as custom_7, civicrm_value_parent_child_5.id as civicrm_value_parent_child_5_id, civicrm_value_parent_child_5.parental_role_8 as custom_8, civicrm_value_spouse_type_6.id as civicrm_value_spouse_type_6_id, civicrm_value_spouse_type_6.spouse_type_9 as custom_9, civicrm_value_registration_questions_7.id as civicrm_value_registration_questions_7_id, civicrm_value_registration_questions_7.camper_question_1_10 as custom_10, civicrm_value_registration_questions_7.camper_question_2_12 as custom_12, civicrm_value_registration_questions_7.parent_question_1_13 as custom_13, civicrm_value_registration_questions_7.parent_question_2_14 as custom_14, civicrm_value_registration_questions_7.parent_15 as custom_15, civicrm_value_csa_membership_8.id as civicrm_value_csa_membership_8_id, civicrm_value_csa_membership_8.number_of_participants_16 as custom_16, civicrm_value_csa_membership_8.name_s_of_additional_participant_17 as custom_17, civicrm_value_medical_info_9.id as civicrm_value_medical_info_9_id, civicrm_value_medical_info_9.insurance_company_19 as custom_19, civicrm_value_medical_info_9.insurance_policy_or_certificate__20 as custom_20, civicrm_value_medical_info_9.group_id_21 as custom_21, civicrm_value_medical_info_9.individual_id_22 as custom_22, civicrm_value_medical_info_9.pre_authorization_phone___23 as custom_23, civicrm_value_medical_info_9.height_24 as custom_24, civicrm_value_medical_info_9.weight_25 as custom_25, civicrm_value_medical_info_9.medical_conditions_symptoms_26 as custom_26, civicrm_value_medical_info_9.explanation_of_medical_condition_27 as custom_27, civicrm_value_medical_info_9.current_medications_28 as custom_28, civicrm_value_medical_info_9.allergies_29 as custom_29, civicrm_value_medical_info_9.recent_hospitalizations_30 as custom_30, civicrm_value_medical_info_9.immunizations_31 as custom_31, civicrm_value_medical_info_9.therapy_or_counseling_32 as custom_32, civicrm_value_medical_info_9.swimming_ability_33 as custom_33, civicrm_value_medical_info_9.photo_release_34 as custom_34, civicrm_value_medical_info_9.permission_for_medical_treatment_35 as custom_35, civicrm_value_medical_info_9.terms_of_agreement_36 as custom_36, civicrm_value_medical_info_9.form_submitted_by_37 as custom_37, civicrm_value_medical_info_9.date_form_submitted_38 as custom_38, civicrm_value_medical_info_9.ip_address_39 as custom_39, civicrm_value_medical_info_9.physical_ability_level_47 as custom_47, civicrm_value_medical_info_9.over_the_counter_medications_48 as custom_48, civicrm_value_medical_info_9.other_49 as custom_49, civicrm_value_medical_info_9.social_security_number_50 as custom_50, civicrm_value_contribution_accounts_10.id as civicrm_value_contribution_accounts_10_id, civicrm_value_contribution_accounts_10.account_18 as custom_18, civicrm_value_shuttle_info_11.id as civicrm_value_shuttle_info_11_id, civicrm_value_shuttle_info_11.direction_40 as custom_40, civicrm_value_family_work_camp_13.id as civicrm_value_family_work_camp_13_id, civicrm_value_family_work_camp_13.dietary_needs_restrictions_44 as custom_44, civicrm_value_family_work_camp_13.date_of_arrival_45 as custom_45, civicrm_value_family_work_camp_13.date_of_departure_46 as custom_46, civicrm_value_student_info_14.id as civicrm_value_student_info_14_id, civicrm_value_student_info_14.reason_for_leaving_52 as custom_52, civicrm_value_donor_interaction_15.id as civicrm_value_donor_interaction_15_id, civicrm_value_donor_interaction_15.call_results_53 as custom_53  FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id  INNER JOIN civicrm_contribution_type ON civicrm_contribution.contribution_type_id = civicrm_contribution_type.id  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  LEFT JOIN civicrm_activity_target ON civicrm_activity_target.target_contact_id = contact_a.id  LEFT JOIN civicrm_activity ON ( civicrm_activity.id = civicrm_activity_target.activity_id
                            AND civicrm_activity.is_deleted = 0
                            AND civicrm_activity.is_current_revision = 1 ) LEFT  JOIN civicrm_contribution_product ON civicrm_contribution_product.contribution_id = civicrm_contribution.id LEFT  JOIN civicrm_product ON civicrm_contribution_product.product_id =civicrm_product.id  LEFT JOIN civicrm_relationship ON (civicrm_relationship.contact_id_a = contact_a.id ) LEFT JOIN civicrm_contact contact_b ON (civicrm_relationship.contact_id_b = contact_b.id )
LEFT JOIN civicrm_value_additional_info_2 ON civicrm_value_additional_info_2.entity_id = contact_a.id 
LEFT JOIN civicrm_value_contribution_accounts_10 ON civicrm_value_contribution_accounts_10.entity_id = civicrm_contribution.id 
LEFT JOIN civicrm_value_csa_membership_8 ON civicrm_value_csa_membership_8.entity_id = civicrm_contribution.id 
LEFT JOIN civicrm_value_donor_interaction_15 ON civicrm_value_donor_interaction_15.entity_id = civicrm_activity.id 
LEFT JOIN civicrm_value_family_work_camp_13 ON civicrm_value_family_work_camp_13.entity_id = civicrm_participant.id 
LEFT JOIN civicrm_value_heard_about_woolman_4 ON civicrm_value_heard_about_woolman_4.entity_id = civicrm_activity.id 
LEFT JOIN civicrm_value_medical_info_9 ON civicrm_value_medical_info_9.entity_id = contact_a.id 
LEFT JOIN civicrm_value_parent_child_5 ON civicrm_value_parent_child_5.entity_id = civicrm_relationship.id 
LEFT JOIN civicrm_value_registration_questions_7 ON civicrm_value_registration_questions_7.entity_id = civicrm_participant.id 
LEFT JOIN civicrm_value_semester_choices_3 ON civicrm_value_semester_choices_3.entity_id = civicrm_activity.id 
LEFT JOIN civicrm_value_spouse_type_6 ON civicrm_value_spouse_type_6.entity_id = civicrm_relationship.id 
LEFT JOIN civicrm_value_student_info_14 ON civicrm_value_student_info_14.entity_id = civicrm_relationship.id  LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contribution' AND
                                                    civicrm_contribution.id = civicrm_note.entity_id ) LEFT JOIN civicrm_option_group option_group_payment_instrument ON ( option_group_payment_instrument.name = 'payment_instrument') LEFT JOIN civicrm_option_value payment_instrument ON (civicrm_contribution.payment_instrument_id = payment_instrument.value
                               AND option_group_payment_instrument.id = payment_instrument.option_group_id )  LEFT JOIN civicrm_option_group option_group_contribution_status ON (option_group_contribution_status.name = 'contribution_status') LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.contribution_status_id = contribution_status.value
                               AND option_group_contribution_status.id = contribution_status.option_group_id )  WHERE  ( contact_a.id = 455 AND civicrm_contribution.is_test = 0 )  AND (contact_a.is_deleted = 0)   GROUP BY civicrm_contribution.id   ORDER BY receive_date desc, contact_a.id  LIMIT 0, 50  [nativecode=1054 ** Unknown column 'civicrm_value_shuttle_info_11.id' in 'field list']
    [type] => DB_Error
Try asking your question on the new CiviCRM help site.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution search failure
December 08, 2011, 07:06:07 am

this is from  regular search from the UI?

a bit surprised as to this since i thought we went to great lengths to avoid adding unneeded selects and left joins (for efficiency reasons)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Contribution search failure
December 08, 2011, 09:28:25 am
Yes, version 4.1 Alpha 2
Drupal 6
After upgrading from 3.4.7
Try asking your question on the new CiviCRM help site.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution search failure
December 08, 2011, 10:50:08 am

and the query for 3.4.7 seems reasonable? just want to get details before i start digging in :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Contribution search failure
December 09, 2011, 05:36:33 pm
I can confirm that it worked as it should in 3.4.7, although I could not find how to output the generated query.
Try asking your question on the new CiviCRM help site.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution search failure
December 09, 2011, 06:09:52 pm

I checked this on 3.4 and 4.1. i could reproduce the behavior on both versions :(

not very sure why we are including the custom fields in the search. definitely eliminating it will result in some good speedup. Can u file an issue. i'll take a look and hopefully find an easy fix for 4.1

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.1 Release Testing (Moderator: Kurund Jalmi) »
  • Contribution search failure

This forum was archived on 2017-11-26.