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 Drupal Modules (Moderator: Donald Lobo) »
  • Views table problem - but with separate dbs
Pages: [1]

Author Topic: Views table problem - but with separate dbs  (Read 3246 times)

echoleaf

  • Guest
Views table problem - but with separate dbs
January 25, 2009, 06:08:59 pm
I am trying to create a View of Civi events but am getting this error:

Quote
user warning: Table 'db_civi.civicrm_event' doesn't exist query: SELECT civicrm_event.id AS id, civicrm_event.title AS civicrm_event_title, DATE_FORMAT((FROM_UNIXTIME(civicrm_event.start_date) + INTERVAL -18000 SECOND), '%Y%m%d') AS civicrm_event_start_date_day FROM civicrm_event civicrm_event ORDER BY civicrm_event_start_date_day ASC LIMIT 0, 10 in /home/.../sites/all/modules/views/includes/view.inc on line 725.

The table missing error is noted in the wiki, but the problem there occurs when Drupal & Civi share a db and a prefix is used to differentiate them.  In my case, Drupal & Civi have their own dbs.  Still, I tried the settings.php edit just to see if it made a difference and it did not.

fwiw, prior to creating the view, I created 4 events, all of which are active and have their own event pages.  Aside from this problem, Civi seems to be working great - no problem creating events, adding members, etc.

thanks,

Arp

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: Views table problem - but with separate dbs
January 25, 2009, 08:17:51 pm

actually the hack mentioned in the wiki is when drupal and civicrm are on different DB's. Luckily prefixing takes care of the different db case, and hence the hack works :)

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

echoleaf

  • Guest
Re: Views table problem - but with separate dbs
January 25, 2009, 08:28:34 pm
OK - I'll assume that something went awry with the settings.php I tried to edit, and will give it another go tomorrow!  Thanks!

HerbT

  • Guest
Re: Views table problem - but with separate dbs
March 01, 2009, 02:24:48 pm
Hm. I have a separate db, so I added the array that's listed in the global settings, druapl config page, and set the cookie domain. Both additions were inserted in the drupal settings.php file. Still having the same problem as posted above.

This is happening on 2.1.4 and 2.1.6, so it's pretty obvious it's something I'm doing wrong, but not sure what.

DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
Re: Views table problem - but with separate dbs
March 09, 2009, 08:04:38 am
Could it be that Views Integration works in 2.2.* but not in 2.1.*? You may try 2.2.beta4, it's quite stable for most of the tasks currently - and the final release will be soon...

Could you please try to import this view, works on Contributions:
Code: [Select]
$view = new view;
$view->name = 'civicrm_contributions';
$view->description = 'Test view for contributions';
$view->tag = 'civicrm';
$view->view_php = '';
$view->base_table = 'civicrm_contribution';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'currency' => array(
    'label' => 'Amount',
    'exclude' => 0,
    'id' => 'currency',
    'table' => 'civicrm_contribution',
    'field' => 'currency',
    'relationship' => 'none',
  ),
  'total_amount' => array(
    'label' => 'Total Amount',
    'set_precision' => FALSE,
    'precision' => 0,
    'decimal' => '.',
    'separator' => ',',
    'prefix' => '',
    'suffix' => '',
    'exclude' => 0,
    'id' => 'total_amount',
    'table' => 'civicrm_contribution',
    'field' => 'total_amount',
    'relationship' => 'none',
  ),
  'display_name' => array(
    'label' => 'Display Name',
    'link_to_civicrm_contact' => 1,
    'exclude' => 0,
    'id' => 'display_name',
    'table' => 'civicrm_contact',
    'field' => 'display_name',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'role',
  'role' => array(
    '4' => 4,
    '3' => 3,
  ),
));
$handler->override_option('title', 'Contributions list');
$handler->override_option('header', 'Alpha version');
$handler->override_option('header_format', '1');
$handler->override_option('header_empty', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'sort_name' => 'sort_name',
    'currency' => 'currency',
    'total_amount' => 'currency',
  ),
  'info' => array(
    'sort_name' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'currency' => array(
      'sortable' => 1,
      'separator' => ' ',
    ),
    'total_amount' => array(
      'sortable' => 1,
      'separator' => '',
    ),
  ),
  'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'contributions');
$handler->override_option('menu', array(
  'type' => 'normal',
  'title' => 'Contributions',
  'description' => '',
  'weight' => '20',
  'name' => 'menu-views-collection',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));


DanilaD

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 11
Re: Views table problem - but with separate dbs
March 09, 2009, 09:11:45 am
Checked the forum - Views should be working starting from somewhere in 2.1.3.

HerbT

  • Guest
Re: Views table problem - but with separate dbs
March 22, 2009, 01:54:20 pm
Found the problem, which was entirely of my doing. The array in settings.php was sitting *above* the DB path.

Thanks for the help.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views table problem - but with separate dbs

This forum was archived on 2017-11-26.