public function delete($useWhere = FALSE) { $id = $this->id; $result = parent::delete($useWhere); try { $custom_params['custom_group_id'] = civicrm_api3('CustomGroup', 'getvalue', array('name' => 'myemma', 'return' => 'id')); $custom_params['name'] = 'my_emmma_' . $id; $custom_field = civicrm_api3('CustomField', 'getsingle', $custom_params); civicrm_api3('CustomField', 'delete', array('id' => $custom_field['id'])); } catch (Exception $e) { //do nothing } return $result; }
/** * Returns the list of fields that can be exported * * @param bool $prefix * * @return array */ static function &export($prefix = false) { if (!self::$_export) { self::$_export = array(); $fields = self::fields(); foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['my_emma_account'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }