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) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views filters on custom fields broken in 3.4
Pages: [1]

Author Topic: Views filters on custom fields broken in 3.4  (Read 1589 times)

adharris

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 3.4
  • CMS version: Drupal 6
  • MySQL version: dunno 5.something?
  • PHP version: 5.2
Views filters on custom fields broken in 3.4
April 06, 2011, 02:04:03 pm
For custom fields with an option group which only have a single value, the patch applied to 3.4 for issue #CRM-7516 seems to have broken views filters.

The patch adds the civicrm value separator to the beginning and end of all the parameters passed to the filter, resulting in the SQL being something like 'WHERE column LIKE '%<seperator><value><seperator>%'.  But for custom fields with a single value the separator is not added to the field when its stored in the database, and so the where clause matches no records.

I think this can be fixed by telling views to use a separate handler for multivalue fields and single value fields, but I wanted to check if this was known/being worked on before tackling it myself.

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Views filters on custom fields broken in 3.4
April 21, 2011, 05:59:39 pm
I'm seeing the same thing in an upgrade from CiviCRM v3.3 to CiviCRM v3.4.  Where in v3.3 the views filter sql contained the snippet:
Code: [Select]
WHERE (civicrm_contact.contact_type in ('Organization'))
   AND (civicrm_value_initiatives_4.initiative_15 in ('2'))
   AND ((civicrm_contact.contact_sub_type) = ('Program'))
in v3.4 the same snippet looks like:
Code: [Select]
WHERE (civicrm_contact.contact_type in ('Organization'))
   AND (civicrm_value_initiatives_4.initiative_15 LIKE '%2%' )
   AND ((civicrm_contact.contact_sub_type) = ('Program'))
This breaks the view.  No fix yet.

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Views filters on custom fields broken in 3.4
April 22, 2011, 09:09:10 am
I'm getting this fixed over here, http://issues.civicrm.org/jira/browse/CRM-7952.

As of now I have it fixed for D7/CiviCRM 4.0/ Views 3.  Note you will have to celar the cache a bunch for the fix to take affect
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Views filters on custom fields broken in 3.4
April 22, 2011, 09:39:35 am
I closed the issue and attached a patch for D6/views 2
http://www.rootyhollow.com

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Re: Views filters on custom fields broken in 3.4
April 22, 2011, 09:49:57 am
Tested the patch on D6/Views 2 - it works.  Thanks, @jalama!

annaleevk

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 3
  • Carpe Noctem!
    • Women in Development, New York
  • CiviCRM version: 3.4.5
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.48
  • PHP version: 5.2.14
Re:3.4.1 view broken
May 31, 2011, 05:42:45 am
Hi!  I just upgraded to 3.4.1 and my civicrm view based on member type and member status suddenly stopped working.  I just tested it again by adding someone else to the membership and it is not updating.  Nothing in the view had changed since I created it in 3.4.

Any ideas?  Here's the sql from the view.

SELECT civicrm_contact.id AS id,
   civicrm_contact.organization_name AS civicrm_contact_organization_name,
   civicrm_contact.display_name AS civicrm_contact_display_name,
   civicrm_contact.last_name AS civicrm_contact_last_name,
   civicrm_contact.first_name AS civicrm_contact_first_name
 FROM civicrm_contact civicrm_contact
 LEFT JOIN civicrm_membership civicrm_membership ON civicrm_contact.id = civicrm_membership.contact_id
 WHERE (civicrm_membership.membership_type_id in ('3')) AND (civicrm_membership.status_id in ('1', '2'))
   ORDER BY civicrm_contact_last_name ASC, civicrm_contact_first_name ASC
« Last Edit: May 31, 2011, 05:52:10 am by annaleevk »
Annalee Van Kleeck
Lyric Systems, LLC
201 951.8711
annalee@lyricsystems.com

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Views filters on custom fields broken in 3.4
May 31, 2011, 06:09:20 am
I am looking at this issue (on this very site) and I can add that when I run that SQL directly against the DB, one row is indeed returned.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

annaleevk

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 3
  • Carpe Noctem!
    • Women in Development, New York
  • CiviCRM version: 3.4.5
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.48
  • PHP version: 5.2.14
Re: Views filters on custom fields STILL BROKEN in 3.4.2
June 12, 2011, 08:57:55 pm
This view is still not working.  Anyone have any ideas?  Hershel and I are stumped at the moment.

- Annalee
Annalee Van Kleeck
Lyric Systems, LLC
201 951.8711
annalee@lyricsystems.com

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Views filters on custom fields broken in 3.4
June 13, 2011, 06:03:32 am
Turns out this was a user error actually--incorrect use of "Exclude from display" and "Rewrite the output of this field"

CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

annaleevk

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 3
  • Carpe Noctem!
    • Women in Development, New York
  • CiviCRM version: 3.4.5
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.48
  • PHP version: 5.2.14
Re: Views filters on custom fields broken in 3.4
June 13, 2011, 07:47:01 am
Not quite correct but we will look into it further before posting again.
Annalee Van Kleeck
Lyric Systems, LLC
201 951.8711
annalee@lyricsystems.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views filters on custom fields broken in 3.4

This forum was archived on 2017-11-26.