CRM-17690 Grant fields being retrieved by default when completely irrelevant

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6, 4.7
    • Fix Version/s: 4.6.17, 4.7
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      If you do a contribution search - ie from the contribution search screen the query includes retrieving grant fields - even though these are not relevant (& have a performance cost). The sql includes "civicrm_grant.amount_requested as grant_amount_requested, civicrm_grant.amount_granted as grant_amount_granted, civicrm_grant.amount_total as grant_amount_total, civicrm_grant.application_received_date as grant_application_received_date , civicrm_grant.grant_report_received as grant_report_received, civicrm_grant.money_transfer_date as grant_money_transfer_date FROM civicrm_contact contact_a"

      This was added here - the commit doesn't have a JIRA ref in it and I'm unsure why it made sense to stop checking what component was being queried. We need to start being much more careful about making really frequent queries add fields and data that they don't need because it slows the system down for people

      https://github.com/civicrm/civicrm-core/commit/8ae90f855a4acf9d7dade1b846bf0b563ce97928#diff-f5e872367f13e067d643ef634b73ba14R55

        Attachments

          Activity

          [CRM-17690] Grant fields being retrieved by default when completely irrelevant
          David Greenberg added a comment -

          Can you check the change referenced by Eileen McNaughton and either let us know why it was needed OR fix it Thanks!

          Jitendra Purohit added a comment -

          This was a fix for the CRM-15568 to perform multiple grant search in Search Builder.

          I've included a fix for this ticket at https://github.com/civicrm/civicrm-core/pull/7431. Thanks for pointing this out Eileen McNaughton.

          David Greenberg added a comment -
          Andrew Hunt added a comment -

          This problem was introduced in 4.6, and it's still an issue there. Besides performance reasons, this causes mailing labels (and potentially other things) to produce fewer labels than selected contacts. If contacts have multiple grants, the query to produce the labels generates one row for each grant-contact combination. However, the query has a row limit of the number of contacts. For each extra grant that a contact has beyond the first one, another contact is excluded from the result.

          I added https://github.com/civicrm/civicrm-core/pull/8453, which is basically backporting the fix to 4.6, with a minor additional change at another spot I noticed grant fields weren't being excluded in the way that other components were.

          Andrew Hunt added a comment -

          Reopening and assigning to Eileen so you're aware of it re: 4.6.

          Andrew Hunt added a comment -

          I added that other minor change that isn't already in 4.7 as a new PR against 4.7: https://github.com/civicrm/civicrm-core/pull/8454

          Andrew Hunt added a comment -

          Turns out that "other minor change" prevents grant edits from working. I closed PR #8454 and made #8453 just be the part that was already merged into 4.7.

          Eileen McNaughton added a comment -

          Just FYI - I had chosen not to merge the 4.6 patch yet in order to treat the 4.6 branch like an rc. I'm not too worried about it - but in general am not merging to 4.6 after test week starts (but this round with many exceptions)

          Coleman Watts added a comment -

          Oops. Didn't realize we're not doing an RC for LTS.

            People

            • Assignee:
              Eileen McNaughton
              Reporter:
              Eileen McNaughton

              Dates

              • Created:
                Updated:
                Resolved: