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 (Moderator: Dave Greenberg) »
  • Activities/activity types: DB issue?
Pages: [1]

Author Topic: Activities/activity types: DB issue?  (Read 1246 times)

dbsavage

  • Guest
Activities/activity types: DB issue?
November 09, 2009, 12:02:30 pm
Hello:

I'm trying to configure activities in our CiviCRM installation, and am running into problems. To begin with, the activity dropdown doesn't show up when viewing user records (activities are enabled in site preferences). Additionally, the "activity type" dropdown in Contacts->New Activity (for example) doesn't provide any options. When I try to add an activity type, I get the following error:

DB Error: already exists
Database Error Code: Duplicate entry 'activity_type' for key 2, 1062

I'm guessing this is some sort of database issue having to do with how activity types are stored/matched with contact records, but I'm not sure how to go about diagnosing the specific problem. We recently upgraded from 2.2.3 to 3.0 - could that have something to do with it? I'd appreciate any advice.

Thanks -

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Activities/activity types: DB issue?
November 09, 2009, 02:33:45 pm
Do you see a list of your Activity Types when you go to Administer CiviCRM >> Option Lists >> Activity Types?

Activity types are stored in civicrm_option_value (along with lots of other stuff). They should all have civicrm_option_value.option_group_id = 2.

It sounds a bit like this got messed up in your upgrade ??

What does this SQL return in your site:
Code: [Select]
SELECT *
FROM `civicrm_option_group`
WHERE name = 'activity_type';

... it should return one row.

and what this this SQL return:
Code: [Select]
SELECT *
FROM `civicrm_option_value`
WHERE option_group_id in (SELECT id from civicrm_option_group WHERE name = 'activity_type');

it should return ~23 rows with all the defined activity types.
Protect your investment in CiviCRM by  becoming a Member!

dbsavage

  • Guest
Re: Activities/activity types: DB issue?
November 10, 2009, 09:34:27 am
Thanks for responding.

Yes, a list of activity types does show up in Option Lists->Activity Types.

And both of those SQL commands return what they're supposed to.

Below, I'm posting the debug info for the error message I get when I try to add an activity type. It seems like Civi is trying to create a row for 'activity_type' in civicrm_option_group, and is failing because that row already exists. I'm not sure why that would be happening, if that is indeed what is happening. Any ideas?

Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_option_group (name , is_active ) VALUES ('activity_type' ,  1 )  [nativecode=1062 ** Duplicate entry 'activity_type' for key 2]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_option_group (name , is_active ) VALUES ('activity_type' ,  1 )  [nativecode=1062 ** Duplicate entry 'activity_type' for key 2]
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_option_group (name , is_active ) VALUES ('activity_type' ,  1 )  [nativecode=1062 ** Duplicate entry 'activity_type' for key 2]"]
)
[/code]

dbsavage

  • Guest
Re: Activities/activity types: DB issue?
November 10, 2009, 09:39:51 am
Nevermind! I was able to fix this by manually setting the 'is_active' column for activity_type in civicrm_option_group to 1. I'm not sure why it was set to 0 before, but that's definitely what was causing the problem....

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Activities/activity types: DB issue?

This forum was archived on 2017-11-26.