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 CiviEvent (Moderator: Yashodha Chaku) »
  • Debug help
Pages: [1]

Author Topic: Debug help  (Read 1620 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Debug help
March 23, 2008, 05:00:08 pm
Hi,

I have a funny situation where searching by one of my event types doesn't return anything in the 'find event' search when it should. I'd like to capture the sql that is being used so I can figure out why - can anyone advise the easiest way to do this?

I believe the search form is :

civicrm\CRM\Event\Form\SearchEvent.php

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

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: Debug help
March 23, 2008, 06:49:20 pm

1. easiest way to find this, is to enable "query logging" in your mysql query log.

2. alternatively if that is not an option, you can uncomment out line 2280, packages/DB/DataObject.php. Note that this displays a LOT of debug output

3. the relevant query you are looking for is:

Code: [Select]
SELECT *
    FROM civicrm_event
   WHERE event_type_id IN (3,4,5,6) AND start_date >= '20080101000000' AND start_date <= '20081201235959' AND domain_id = 1
ORDER BY title asc
   LIMIT 0, 50

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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Debug help
March 24, 2008, 01:55:08 am
OK, my problem was that I had re-named whatever event types 1 & 2 were rather than creating new events.

1 & 2 don't show as reserved in the Manage Events but my experience & your query above suggest that they are.

Any ID above 2 seems to work fine in the search
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Debug help
March 24, 2008, 01:00:42 pm
Eileen - I think lobo's query above is just an example. I checked the event search code and I don't see any hard-coded usage of event type (1, 2 or any other). I did find a related issue where events NOT of the type selected are returned if they have no End Date (http://issues.civicrm.org/jira/browse/CRM-2889).

Bottom line is that you might want to revisit this - and see what might caused your issue other than event type assignments. You can see the exact query being generated by an Event Search by adding this debug line to CRM/Event/Page/ManageEvent.php just after line 242 (after the $query variable is defined):

Code: [Select]
        CRM_Core_Error::debug('query', $query); exit();

Let us know what u find.

Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Debug help
March 24, 2008, 04:21:36 pm
Hmm - it's not manageevent.php - that is for

index.php?q=civicrm/event/manage&reset=1

I'm looking for

index.php?q=civicrm/event/search/basic&reset=1

I'll keep looking
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Debug help
March 24, 2008, 05:30:37 pm
OK. I couldn't quite get to the bottom of debugging it but I managed to recreate it on the forum so I logged it - 2891.

I managed to determine this string in query.php:

civicrm_participant.event_id = civicrm_event.id and civicrm_event.event_type_id = '{$eventId}'";

was returning

civicrm_participant.event_id = civicrm_event.id and civicrm_event.event_type_id = '3'

on the working entry and

civicrm_participant.event_id = civicrm_event.id and civicrm_event.event_type_id = ''

on the not working one but debugging $eventId didn't return anything in either case and the values for $event_types & $values seemed correct
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Debug help

This forum was archived on 2017-11-26.