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) »
  • Advanced Search 'Changelog' section
Pages: [1]

Author Topic: Advanced Search 'Changelog' section  (Read 3332 times)

davesage

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 3
  • CiviCRM version: 3.4 & 4.1
  • CMS version: Joomla 1.5 & 2.5
  • MySQL version: 5.1
  • PHP version: 5.3
Advanced Search 'Changelog' section
September 09, 2011, 02:43:02 pm
Hi,

I was doing an advanced search today for contacts added in a certain date range it seemed to pick up contacts that were modified in the date range as well as added?

I ran the same search but selecting 'modified' instead of 'added' and I got the same results, can anyone confirm this behaviour?

If so, I'll raise an issue.

Cheers,

Dave

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: Advanced Search 'Changelog' section
September 09, 2011, 05:09:31 pm

Would be great if you can take a look at the code and figure out what the issue is with the query. I think the code is at:

CRM/Contact/BAO/Query.php, function changeLog

that would increase the chances of the bug getting patches in the next release

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

SNtialMKB

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
    • SNtial Technologies
  • CiviCRM version: clients on 2.2.8 to 3.4.8
  • CMS version: Drupal 6
  • MySQL version: 5.x
  • PHP version: 5.x
Re: Advanced Search 'Changelog' section
April 09, 2012, 09:47:12 pm
Was this issue resolved?  We've got an installation (Drupal/ Civi 3.4.8 ) causing the same problem for our client.  They're trying to pull all contacts added in a date range, and the query is including contacts whose records have been changed during that time too.  We took a look at the code identified above and we see this. 

function changeLog ( &$values )
    {
        list( $name, $op, $value, $grouping, $wildcard ) = $values;
       
        $targetName = $this->getWhereValues( 'changed_by', $grouping );
        if ( ! $targetName ) {
            return;
        }

        $name = trim( $targetName[2] );
        $name = strtolower( CRM_Core_DAO::escapeString( $name ) );
        $name = $targetName[4] ? "%$name%" : $name;
        $this->_where[$grouping][] = "contact_b_log.sort_name LIKE '%$name%'";
        $this->_tables['civicrm_log'] = $this->_whereTables['civicrm_log'] = 1;
        $this->_qill[$grouping][] = ts('Changed by') . ": $name";
    }

Any suggestions?
Thanks,
-Mary Kay

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: Advanced Search 'Changelog' section
April 10, 2012, 07:37:07 am

hey mary kay:

Dont know if this has been fixed, but i took a look at the code and there seems to be code to deal with this situation. You will need to look at the function modifiedDates and the variables added_log in that file. If you do discover the bug, please do file an issue. You can also test this on our demo server to see if 4.1 fixes it

thanx

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

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Advanced Search 'Changelog' section
April 10, 2012, 09:11:22 am
I'm having a similar problem with the date range search box in advanced search. 

When I select "Added" and include a date range in the Change Log area of the advanced search, the results only return contacts created after the first of date range, but seems to ignore the second. 

Further, I replicated the problem in the Joomla-CiviCRM4.1 demo site.  I've attached screencap's of both.   

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Advanced Search 'Changelog' section
April 23, 2012, 03:24:40 pm
Sorry to do this, but anyone have a suggestion on how to move forward here? Should we just hope this is fixed in the next release?

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: Advanced Search 'Changelog' section
April 23, 2012, 04:34:26 pm

Would be great if you can get your developer / consultant to take a look at the query code and see if they can spot the error. If you do so, please submit a patch with the issue

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

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: Advanced Search 'Changelog' section
April 23, 2012, 09:40:37 pm

can u try the patch attached to this post. I suspect this will work :)

However the query used for this is quite bad and I dont think will scale beyond a few hundred or thousand contacts. So definitely if someone needs to use this for large DB's tey are better off restructuring the query / doing it a different way

If it does work, can you please file an issue and we'll fix in 4.2

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

joshstuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ACORN Canada
  • CiviCRM version: 4.0
  • CMS version: Joomla 1.6
Re: Advanced Search 'Changelog' section
April 25, 2012, 04:13:23 pm
Thanks for the replies Lobo, I appreciate it.

I'll try the patch, though we've got way more contacts than that... and no developer :(.

Thanks!
Josh

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
Re: Advanced Search 'Changelog' section
March 27, 2013, 06:39:38 am
I just want to follow this. I'm working with Version 4.2.6 on Drupal and noticed that the Added Date search isn't working. I've looked at records within Civicrm and noticed that the Change Log only has change dates, not an added date. I've also added in some records to test and still don't get added dates.

I'll upgrade to the latest version and test again - but it seems like it isn't working. I'll also look at the records through the database back end to see what's happening.

matthewbushue

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.4.0
  • CMS version: Drupal
  • MySQL version: ?
  • PHP version: ?
Re: Advanced Search 'Changelog' section
March 18, 2014, 03:03:05 pm
I tried using Search >Custom Searches >Contacts By Date Added, and if I narrow it down by a specific group the search results will show the correct results.

However, when I try to export these contacts or add them to a group, it will export ALL contacts (disregarding the group setting).

E.g. The search results will show 1600 contacts (all contacts by date added within a range AND in a group), but the export will export 2500 contacts (all contacts by date added within a range).

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Advanced Search 'Changelog' section
March 18, 2014, 03:23:54 pm
Would be good if you could upgrade to 4.4.4 as there have been many bug fixes since 4.4.0 and this could be one of them. 

Are you able to reproduce this result on http://drupal.demo.civicrm.org/?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Advanced Search 'Changelog' section

This forum was archived on 2017-11-26.