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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • search builder for participants
Pages: [1]

Author Topic: search builder for participants  (Read 608 times)

kmarkley

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 14
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.24
  • MySQL version: 5.1.56
  • PHP version: 5.3.27
search builder for participants
February 08, 2011, 09:29:19 am
I'm having a new issue with search builder searches of the form

Participant        Event              IN               (1,3)

throwing an error "Please enter correct Data ( in valid format )."

This used to work for me and I have replicated the error on the demo server.

Bug?

Any quick-fix suggestions would be appreciated as I need t do a couple searches like this today.  Alternative seems to be to make smart groups for each event and then union them with the include/exclude search, but this would quickly become unwieldy. 

Thanks.

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: search builder for participants
February 10, 2011, 10:33:18 pm
Hi kmarkley,

It looks like a minor bug in search builder ( regarding preg match ),  you can use following patch.

Code: [Select]
Index: CRM/Contact/Form/Search/Builder.php
===================================================================
--- CRM/Contact/Form/Search/Builder.php (revision 32420)
+++ CRM/Contact/Form/Search/Builder.php (working copy)
@@ -230,9 +230,16 @@
                         if ( $v[1] == 'IN' ) {
                             $inVal = trim( $v[2] );
                             //checking for format to avoid db errors
-                            if (!preg_match( '/^[(][\']([A-Za-z0-9\'\,\s]+)[\'][)]$/', $inVal) ) {
-                                $errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data ( in valid format ).");
+                            if ( $type == 'Int' ) {
+                                if (!preg_match( '/^[(]([A-Za-z0-9\,]+)[)]$/', $inVal) ) {
+                                    $errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data ( in valid format ).");
+                                }
+                            } else {
+                                if (!preg_match( '/^[(][\']([A-Za-z0-9\'\,\s]+)[\'][)]$/', $inVal) ) {
+                                    $errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data ( in valid format ).");
+                                }
                             }


Rajan

kmarkley

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 14
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.24
  • MySQL version: 5.1.56
  • PHP version: 5.3.27
Re: search builder for participants
February 17, 2011, 01:18:25 pm
Thank you Rajan.

Sorry it took a while to try it out, but it seems to work great.  Should this get posted to the issues queue?

(I got a strange end of file error when I tried to patch the normal way - had to just make the change manually.  I doubt its relevant, but it sure has me curious.) 

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: search builder for participants
February 17, 2011, 08:55:11 pm
Hi kmarkley, thanks for point out this issue.
I did not created any issue regarding this, but I have fixed this issue as a minor bug fix in coming civicrm version ( CiviCRM3.4 alpha 1 ).

Thanks a lot,
Rajan

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • search builder for participants

This forum was archived on 2017-11-26.