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) »
  • possible problem with v2 api civicrm_custom_group_delete()
Pages: [1]

Author Topic: possible problem with v2 api civicrm_custom_group_delete()  (Read 2331 times)

dougall

  • Guest
possible problem with v2 api civicrm_custom_group_delete()
March 31, 2008, 08:04:17 am
hi,

i'm attempting to remove a custom group using the civicrm (v2.0.1) v2 api function
Code: [Select]
civicrm_custom_group_delete($params) but i get the error
Quote
Fatal error: Class 'CRM_Core_DAO_CustomGroup' not found in C:\wamp\www\drupal-5.7\sites\all\modules\civicrm\api\v2\CustomGroup.php on line 128

here's my code:
Code: [Select]
function performUninstall($customGroupId) {
   require_once(CIVICRM_SETTINGS_LOCATION."civicrm.settings.php");
   global $civicrm_root;
   
   require_once($civicrm_root.'/CRM/Core/Config.php');
   $config =& CRM_Core_Config::singleton();

   require_once($civicrm_root."/api/v2/CustomGroup.php");
   $params = array ( "id" => $customGroupId);
   $res = civicrm_custom_group_delete($params);
   return ($res==null);
 }

so, am i getting this error because i need to include/require another file? or should i add it as an issue?

thanks,
  dougall

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: possible problem with v2 api civicrm_custom_group_delete()
March 31, 2008, 11:12:44 am

this is now fixed and will be part of 2.0.2. You can add the missing require to that line if u'd rather not wait. The diff is:

Code: [Select]
--- api/v2/CustomGroup.php      (revision 13817)
+++ api/v2/CustomGroup.php      (working copy)
@@ -127,6 +127,7 @@
         return civicrm_create_error( 'Invalid or no value for Custom group ID' );
     }
     // convert params array into Object
+    require_once 'CRM/Core/DAO/CustomGroup.php';
     $values =& new CRM_Core_DAO_CustomGroup( );
     $values->id = $params['id'];
     $values->find(true);
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

dougall

  • Guest
Re: possible problem with v2 api civicrm_custom_group_delete()
April 01, 2008, 01:30:53 am
ok, thanks lobo

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • possible problem with v2 api civicrm_custom_group_delete()

This forum was archived on 2017-11-26.