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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Custom searches not paging
Pages: [1]

Author Topic: Custom searches not paging  (Read 1433 times)

ceford

  • I’m new here
  • *
  • Posts: 20
  • Karma: 2
Custom searches not paging
October 18, 2009, 03:33:03 pm
This issue came up in CiviCRM 3.0.1 on Joomla 1.5.14

I composed a custom search component following the instructions in the documentation:

http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+Components

It worked fine except that it returned all of the data in the data set in a single page, 120 rows instead of the 50 I expected. Changing the Rows per Page value did not make any difference.  The same behaviour occurred with a couple of the Custom Searches in the distribution (I think ContributionAggregate and ...) except that they returned thousands of rows and locked up my browser. I can't find anything on this issue in the Forums. Is it a feature or a bug? I tried looking through the code of the various Custom Searches without being able to figure out how/where to apply a fix. Any pointers would be appreciated.

Cliff

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: Custom searches not paging
October 18, 2009, 04:55:09 pm

can u check:

http://drupal.demo.civicrm.org/civicrm/contact/search/custom?csid=6&reset=1

the custom search needs to use the offset and rowcount parameters in the returned sql

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

ceford

  • I’m new here
  • *
  • Posts: 20
  • Karma: 2
Re: Custom searches not paging
October 18, 2009, 07:39:34 pm
Actually, the demo link did not tell me anything. However, I had a look at the source of the Proximity search and the Base search that it extends and figured out that the lines that were missing were:

        if ( $rowcount > 0 && $offset >= 0 ) {
            $sql .= " LIMIT $offset, $rowcount ";
        }
Just before
        return $sql;

My custom search behaves properly now. I think it would be a good idea to put these lines into the ContributionAggregate and ContribSYBNT searches (and perhaps others) and in the example in the documentation.

Thanks for the pointer.

Cliff

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Custom searches not paging
October 19, 2009, 04:49:18 pm
Cliff - We'll add rowcount, offset to Contribution Aggregate search for 3.1:
http://issues.civicrm.org/jira/browse/CRM-5253

Feel free to add a "tip" to the doc page in the meantime (wiki is editable - just register for an account if u don't have one):
http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+Components
Protect your investment in CiviCRM by  becoming a Member!

obiuquido144

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 4
Re: Custom searches not paging
October 20, 2009, 06:48:38 am
Hi, I am new here, but currently also fighting to get my first custom search through.

If you will be updating the wiki page, it'd be great if there could be another setup link added to the green box below "Register your custom search component" - the current goes to an unrelated page if using non-clean URLS.
Out of my head, I think it's the same except that the questionmark has to be replaced with a slash (/)

i.e.
...civicrm/admin/options/custom_search/group=custom_search&reset=1

That would sure save future developers some time:)
Thanks, Boris

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: Custom searches not paging
October 20, 2009, 10:08:39 am

hey boris:

since the wiki is community editable, can you please do the needful of editing the wiki and adding the below tip

it helps us and will definitely help folks writing custom searches

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

ceford

  • I’m new here
  • *
  • Posts: 20
  • Karma: 2
Re: Custom searches not paging
October 20, 2009, 10:49:49 am
I added a few lines at the bottom of the custom search documentation under Testing. It looks like part of the original rather than a tip, but it makes the point without needing to be changed when the example custom searches get updated in 3.1.

Cliff

obiuquido144

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 4
Re: Custom searches not paging
October 20, 2009, 11:31:52 am
I added my part, too.
The correct URL is actually:

?q=civicrm/admin/options/custom_search&group=custom_search&reset=1

(i.e. an ampersand instead of the slash I mentioned earlier)

Cheers, Boris

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Custom searches not paging

This forum was archived on 2017-11-26.