Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21806 Search builder NOT Empty does not work #11746

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 2, 2018

Overview

Incorrect empty results on Search builder search

Before

Steps to recreate the issue:

  1. Go to Administer>Customize Data and Screens>Profiles. Add a new profile of the type "Search View"
  2. Add several contact fields to the new profile.
  3. Go to Search>Advanced Search and select the new profile in Search Views. Press Search.
  4. Click on one of the contact fields in the search results to sort the column.
  5. Observe that you are brought back to Advanced Search field selection screen and it displays that no records are found.

After

Results show

Technical Details

Replaces hacky method of guessing the select clause (which turned out to be wrong)

Comments

I took a look at this because it was marked critical but have not determined if it was a regression or a never worked. I'm also concious we probably need a unit test to make this mergeable but I'm also feeling unable to do that on this at the moment as my unfunded time is a bit tight (ie. I don't have any skin in this - I looked at it because it is a critical issue). I don't have an answer for that - ie. I don't think it should be merged without a test but don't know that a test is iminent


@colemanw
Copy link
Member

colemanw commented Mar 2, 2018

@civicrm-builder retest this please

@eileenmcnaughton
Copy link
Contributor Author

FYI - I have spoken to @lcdservices about him assigning a resource (guess who :-) to write a UT for this since they have an interest

@JKingsnorth
Copy link
Contributor

There is definitely a regression in search builder - it's not just the 'not empty' clause either. I couldn't get any of search builder to work in the latest master.

@lcdservices
Copy link
Contributor

Yes, we've seen the issue to be broader than just NOT EMPTY. Working on a fix.

@monishdeb
Copy link
Member

monishdeb commented Mar 2, 2018

(Baking) UT will be ready soon :) On my initial test result this patch fix the regression not only for NOT EMPTY but for all other operators.

@JKingsnorth you can test the patch on the test build instance - http://core-11746-6snv5.test-ubu1204-5.civicrm.org/ (creds - pradmin / pradmin1234)

@monishdeb
Copy link
Member

Added unit test #11751 for this fix

@JKingsnorth
Copy link
Contributor

Hiah, I'm not able to do a full QA on this at the moment. But I can confirm that search builder does appear to be working again on that build, thanks @monishdeb

@monishdeb
Copy link
Member

Merging as it fixes the issue and doesn't cause any unintended regression to other Search forms. Also the UT is added in #11751

@adanielvv
Copy link
Contributor

This commit breaks the CiviRules custom search.

Database Error Code: Unknown column 'contact_a.id' in 'field list', 1054

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => SELECT contact_a.id as contact_id 
      FROM civirule_rule crr
LEFT JOIN civirule_trigger crtrigger ON crr.trigger_id = crtrigger.id
LEFT JOIN civirule_rule_tag crtag ON crr.id = crtag.rule_id
LEFT JOIN civicrm_contact contact ON crr.created_user_id = contact.id WHERE crr.is_active = 1 ORDER BY `rule_label` asc LIMIT 0, 500  [nativecode=1054 ** Unknown column 'contact_a.id' in 'field list']
    [type] => DB_Error
    [user_info] => SELECT contact_a.id as contact_id 
      FROM civirule_rule crr
LEFT JOIN civirule_trigger crtrigger ON crr.trigger_id = crtrigger.id
LEFT JOIN civirule_rule_tag crtag ON crr.id = crtag.rule_id
LEFT JOIN civicrm_contact contact ON crr.created_user_id = contact.id WHERE crr.is_active = 1 ORDER BY `rule_label` asc LIMIT 0, 500  [nativecode=1054 ** Unknown column 'contact_a.id' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT contact_a.id as contact_id 
      FROM civirule_rule crr
LEFT JOIN civirule_trigger crtrigger ON crr.trigger_id = crtrigger.id
LEFT JOIN civirule_rule_tag crtag ON crr.id = crtag.rule_id
LEFT JOIN civicrm_contact contact ON crr.created_user_id = contact.id WHERE crr.is_active = 1 ORDER BY `rule_label` asc LIMIT 0, 500  [nativecode=1054 ** Unknown column 'contact_a.id' in 'field list']"]
)

@monishdeb
Copy link
Member

@danielVV there is a followup PR #11769 which I think might resolve your issue.

@adanielvv
Copy link
Contributor

Does not help.
Current master throws error.
Changing file to version before #11769 and #11746 fixes this for me.

@adanielvv
Copy link
Contributor

@monishdeb I am running Ubuntu 17.10 with civicrm current master via buildkit.

@eileenmcnaughton
Copy link
Contributor Author

@danielVV can you please test #11829 - it is pending review but I am trying to get it into 5.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants