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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • How to re-use custom code page functionality in api?
Pages: [1]

Author Topic: How to re-use custom code page functionality in api?  (Read 399 times)

vinay_jadhav

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal
  • MySQL version: 5.6.17
  • PHP version: 5.5.12
How to re-use custom code page functionality in api?
December 15, 2015, 04:41:33 am
Hi,

I have to reuse existing custom code written for my desktop application for mobile app that is going to be developed soon by writing/exposing api.
I have a component/module of Donations custom made by ex-developer which has form and page structure like standard civicrm format.
I wish to reuse the page code CRF_Course_Page_SearchDonations rather than duplicating the code. Kindly guide on how this can be achived by writing api.
I have written api like this:

function civicrm_api3_funtwo_donationreport($params) {
   $result=array();
   require_once 'CRF/Course/Page/SearchDonations.php';
   $scondi = CRF_Course_Page_SearchDonations::browse($params);
      if($scondi)
     return $scondi;
   else
       return 0;
}

Now this page uses run which calls browse and wherclause internally how to make it use. Also my browse function in page doesnt have an argument i have written it manually just for testing functionality. I dont want to hamper my desktop application functionality or modify the code.

Kindly guide. ??? ??? :'( :'(

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • How to re-use custom code page functionality in api?

This forum was archived on 2017-11-26.