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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
Pages: [1] 2

Author Topic: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities  (Read 4008 times)

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
October 28, 2010, 05:38:03 am
Hi guys,
In a recent upgrade from 3.1.3 to 3.2.3, new mailings that go out via CiviMail seem to no longer record themselves as activities.
This worked fine in 3.1.3. Aside from the upgrade the only change to the civiCRM configuration has been to setup an account for bounce handling in civimail, but this shouldn't affect the CiviMail activities because those get recorded at the time of sending right?
All other activities get recorded fine.
Running Drupal 6.16.

Is this is a deliberate change or is there something wrong with my setup?
If there is something wrong, any ideas what could be causing this, and why it worked before the upgrade and not now?

Things I have tried to no avail:
- giving bulk mailing user full permissions to everything
- running mailing queue url under administrator account

I have tried to debug the PHP to isolate the problem but I can't seem to track from bin/civimail.cronjob.php, where the activities are getting recorded. If someone could point me to the place where this happens I can try debugging?

Any help gratefully received :)

bails

  • Guest
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 01, 2010, 05:24:54 am
Hi we are seeing this on several sites upgraded from 3.1.3/4/5 to 3.2.3. Just wondering if anyone else has experienced the same and knows of a fix?

Thanks

Bails

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 01, 2010, 11:04:49 am
Ah good. It's not just me then!
Maybe the problem only occurs during an upgrade from specific point versions?
Is anyone else having this problem with a fresh 3.2.3 install?

I am happy to debug this, but I need a bit of a pointer where to start. I tried to trace back the commands from civimail.cronjob.php but I couldn't see which function/file was handling the activity creation. If someone could point me to a starting point file/function where the activities are supposed to be created during a civimail batch, I'll happily to to go through this.

This is quite a major problem for us, as it's negatively affecting our reporting.

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 01, 2010, 11:15:24 am
Hi Graham,

I raised this issue on IRC and Lobo has asked one of the team to look into it.

This forum post gives some pointers to the relevant code: http://forum.civicrm.org/index.php/topic,12517.msg55911.html#msg55911

Dave J

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 12:16:00 am
Hello,

I tried but not able to replicate on my local install.

Could you please put some debug statements so it would give us some valuable pointers.

activity creation process start from CRM/Mailing/BAO/Job.php - line around 401

here once we have $targetParams params ready,
we are calling civicrm_activity_create() function to create an activity record. - on line 435

you could check return values of this function like

$result = civicrm_activity_create($activity, 'Email');
crm_core_error::debug( 'result', $result );
exit( );

Main points about Mailing Activity.
1. We do create single activity record for each mailing. ( present in civicrm_activity table)
2. We do create target records for each recipient. ( present in civicrm_activity_target )

1. If civicrm_activity table fails to create record related to mailing - which implies activity creation it self fails.
2. If civicrm_activity_target fails to create record for each recipients - which implies fails to create activity target records.

Could you please take a closer look at db state before and after mailing process and let us know your observation.

Also does it related to any mailing batch limit ?
( when we have recipients > 1000 -> fails to create activity/target records )

thanks

kiran
You Are Designed To Choose... Defined By Choice.

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 04:29:47 am
Ok stage 1 debugging:

From line 402 in crm\mailing\bao\job.php
added some lines to print out the array states at various points

Code: [Select]
//
        echo print_r($targetParams , true);


        if ( ! empty( $targetParams ) ) {
            // add activity record for every mail that is send
            $activityTypeID = CRM_Core_OptionGroup::getValue( 'activity_type',
                                                              'Bulk Email',
                                                              'name' );

            //
            echo print_r($activityTypeID , true);

            $activity = array('source_contact_id'    => $mailing->scheduled_id,
                              'target_contact_id'    => $targetParams,
                              'activity_type_id'     => $activityTypeID,
                              'source_record_id'     => $this->mailing_id,
                              'activity_date_time'   => $job_date,
                              'subject'              => $mailing->subject,
                              'status_id'            => 2,
                              'deleteActivityTarget' => false,
                              );

            //
            echo print_r($activity , true);

            //check whether activity is already created for this mailing.
            //if yes then create only target contact record.  
            $query  = "
SELECT id
FROM   civicrm_activity
WHERE  civicrm_activity.activity_type_id = %1
AND    civicrm_activity.source_record_id = %2";
        
            $queryParams = array( 1 => array( $activityTypeID  , 'Integer' ),
                                  2 => array( $this->mailing_id, 'Integer' ) );
            $activityID  = CRM_Core_DAO::singleValueQuery( $query,
                                                           $queryParams );    

            //
            echo print_r($activityID , true);

            if ( $activityID ) {
                $activity['id'] = $activityID;  
            }
        
            require_once 'api/v2/Activity.php';
            if ( is_a( civicrm_activity_create($activity, 'Email'), 'CRM_Core_Error' ) ) {
                echo print_r("error!" , true);
                return false;
            }

            echo print_r("not error" , true);

this results in:

Code: [Select]

Array
(
    [0] => 89530
    [1] => 89531
    [2] => 89532
    [3] => 89533
    [4] => 89534
    [5] => 89535
    [6] => 89536
    [7] => 89537
    [8] => 89538
    [9] => 89539
    [10] => 89541
    [11] => 89542
    [12] => 89543
    [13] => 89546
    [14] => 89547
    [15] => 89548
    [16] => 89549
    [17] => 89550
    [18] => 89551
    [19] => 89552
    [20] => 89553
    [21] => 89554
    [22] => 89555
    [23] => 89556
    [24] => 89557
    [25] => 89558
    [26] => 89559
    [27] => 89560
    [28] => 89561
    [29] => 89562
    [30] => 89563
    [31] => 89564
    [32] => 89565
    [33] => 89566
    [34] => 89567
    [35] => 89568
    [36] => 89569
    [37] => 89570
    [38] => 89571
    [39] => 89572
    [40] => 89573
    [41] => 89574
    [42] => 89575
    [43] => 89576
    [44] => 89577
    [45] => 89578
    [46] => 89579
    [47] => 89580
    [48] => 89581
    [49] => 89582
)
34
Array
(
    [source_contact_id] => 89144
    [target_contact_id] => Array
        (
            [0] => 89530
            [1] => 89531
            [2] => 89532
            [3] => 89533
            [4] => 89534
            [5] => 89535
            [6] => 89536
            [7] => 89537
            [8] => 89538
            [9] => 89539
            [10] => 89541
            [11] => 89542
            [12] => 89543
            [13] => 89546
            [14] => 89547
            [15] => 89548
            [16] => 89549
            [17] => 89550
            [18] => 89551
            [19] => 89552
            [20] => 89553
            [21] => 89554
            [22] => 89555
            [23] => 89556
            [24] => 89557
            [25] => 89558
            [26] => 89559
            [27] => 89560
            [28] => 89561
            [29] => 89562
            [30] => 89563
            [31] => 89564
            [32] => 89565
            [33] => 89566
            [34] => 89567
            [35] => 89568
            [36] => 89569
            [37] => 89570
            [38] => 89571
            [39] => 89572
            [40] => 89573
            [41] => 89574
            [42] => 89575
            [43] => 89576
            [44] => 89577
            [45] => 89578
            [46] => 89579
            [47] => 89580
            [48] => 89581
            [49] => 89582
        )
 
    [activity_type_id] => 34
    [source_record_id] => 170
    [activity_date_time] => 20101102094927
    [subject] => test of activity logging which appears to be broken
    [status_id] => 2
    [deleteActivityTarget] =>
)
not error

Watching the database, there no is no existing activity entry for this mailing, and nothing appears after it has completed.

So,
  • $targetparams is correctly an array of contact ids.
  • The bulk mailing activity id is identified correctly (in our case it's 34)
  • $activity array appears correct
  • civicrm_activity_create() does not produce an error

So. it looks like I now need to debug into the activity API. I will report back later once I've finished this!
« Last Edit: November 02, 2010, 04:44:11 am by grahamgilchrist »

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 04:49:26 am
Ok Step 2, debugging api\v2\Activity.php
function civicrm_activity_create()
Wierdly, this function only takes 1 parameter, the $params array, whereas CRM\mailing\bao\job.php above seems to be passing two parameters?

Anyway, I've added lines to printout what is happening:

Code: [Select]
function &civicrm_activity_create( &$params )
{
    echo print_r($params, true);

    _civicrm_initialize( );
    
    $errors = array( );
    
    // check for various error and required conditions
    $errors = _civicrm_activity_check_params( $params, true ) ;

    echo print_r($errors, true);

    if ( !empty( $errors ) ) {
        return $errors;
    }
    
    // processing for custom data
    $values = array();
    _civicrm_custom_format_params( $params, $values, 'Activity' );
    if ( ! empty($values['custom']) ) {
        $params['custom'] = $values['custom'];
    }

    echo print_r($params, true);

    // create activity
    $activity = CRM_Activity_BAO_Activity::create( $params );

    echo print_r($activity, true);

    if ( !is_a( $activity, 'CRM_Core_Error' ) && isset( $activity->id ) ) {
        $activityArray = array( 'is_error' => 0 );
    } else {
        $activityArray = array( 'is_error' => 1 );
    }

    echo print_r($activityArray, true);

    _civicrm_object_to_array( $activity, $activityArray);

    echo print_r($activityArray, true);

    return $activityArray;
}

The results of this are:

Code: [Select]

Array
(
    [source_contact_id] => 102
    [target_contact_id] => Array
        (
            [0] => 102
            [1] => 48852
        )
 
    [activity_type_id] => 34
    [source_record_id] => 174
    [activity_date_time] => 20101102114303
    [subject] => test of activity logging which appears to be broken
    [status_id] => 2
    [deleteActivityTarget] =>
)
Array
(
    [is_error] => 1
    [error_message] => Invalid Target Contact Id
)

So, it seems it thinks there is an invalid target contact id. I have checked both contact Id's and they definitely exist and are comtacts in the system. I can get to their contact view pages using those Id's, and they are in the civicrm_contact table.
Also, another wierd thing. If this is then returning the $errors array immediately (and thus not processing the activities), why is CRM\mailing\bao\job.php not recognising these errors and returning false in the lines?

Code: [Select]
   require_once 'api/v2/Activity.php';
   if ( is_a( civicrm_activity_create($activity, 'Email'), 'CRM_Core_Error' ) ) {
       return false;
   }

This should return false, but it does not as my debugging in step 2 showed code that ran after these lines in the function.

Now, step 3. Debug why _civicrm_activity_check_params()  is giving this error...
« Last Edit: November 02, 2010, 04:54:18 am by grahamgilchrist »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 04:56:46 am
Hi,

Thanks for digging on it, this is getting closer!


Quote
            require_once 'api/v2/Activity.php';
            if ( is_a( civicrm_activity_create($activity, 'Email'), 'CRM_Core_Error' ) ) {
                echo print_r("error!" , true);
                return false;
            }

This is weird/a bug, API ALWAYS take a single param in input.


X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 05:31:05 am
Ok, time for step 3!
Debugging api\v2\Activity.php
function _civicrm_activity_check_params ()

Again, I have added debug lines to observe the array status as it works through.

Code: [Select]
function _civicrm_activity_check_params ( &$params, $addMode = false )
{
    // return error if we do not get any params
    if ( empty( $params ) ) {
        return civicrm_create_error( ts( 'Input Parameters empty' ) );
    }

    $contactIds = array( 'source'   => CRM_Utils_Array::value( 'source_contact_id', $params ),
                         'assignee' => CRM_Utils_Array::value( 'assignee_contact_id', $params ),
                         'target'   => CRM_Utils_Array::value( 'target_contact_id', $params )
                         );

    echo print_r($contactIds, true);

    foreach ( $contactIds as $key => $value ) {
        echo print_r($key, true).", ";
        echo print_r($value, true)."\r\n";
        //if ($debug) echo CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' );

        if ( $value &&
             !CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' ) ) {
            return civicrm_create_error( ts( 'Invalid %1 Contact Id', array( 1 => ucfirst( $key ) ) ) );
        }
    }

.....

this results in the following output:

Code: [Select]
Array
(
    [source] => 102
    [assignee] =>
    [target] => Array
        (
            [0] => 102
            [1] => 48852
        )
 
)
source, 102
assignee,
target, Array
(
    [0] => 102
    [1] => 48852
)
Array
(
    [is_error] => 1
    [error_message] => Invalid Target Contact Id
)

So....

Assignee contact ids are empty. This should be correct as there is no assignee for bulk mailing. Source id is correct as the contact who created the mailing. Target(s) is still an array, but has existing and correct contact IDs. Another possible bug I noticed here, is that if $value is empty (such as in the case of assignee here), $value takes on the


The offending line here is:

Code: [Select]
if ( $value && !CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' ) ) {

$value is set, but CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' ) returns a CRM error when passed the target contact ids array as $value.
You can see in the code above I commented out a line:
Code: [Select]
echo CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' );

For $key = 'target', this returned blank (i.e. false.). Also wierdly, trying to echo the value for $key = 'assignee' resulted in printing out the html page for a CRM fatal error (see below) and ending execution, but as long as I didn't try to echo the value it was fine...


So, step 4, why does CRM\core\dao.php generate an error when passed this array. Does it expect a single value?
It seems to have problems when passed an array, or when passed nothing (as in when $key = 'assignee')

I'll report back when I've worked the next stage out!
« Last Edit: November 02, 2010, 05:35:38 am by grahamgilchrist »

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 05:56:48 am
Step 4 - debugging CRM\core\dao.php, function getFieldValue()

Firstly, I see that if the second parameter is empty, the function generates a core error and returns null. This is obviously why I get a fatal error when trying to print out a value for it when the $key = 'assignee'. Is this intentional, or do we need some error trapping in _civicrm_activity_check_params to make sure we don't pass a blank value into this function when there is no 'assignee'? If so, how do we deal with the case when we need an assignee to be validated?

Onto the main problem. Once again, added debug output lines to crm\core\dao.php

Code: [Select]
    static function getFieldValue( $daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id' )
    {

        echo print_r($daoName, true);
        echo print_r($searchValue, true);
        echo print_r($returnColumn, true);
        echo print_r($searchColumn, true);

        if ( empty( $searchValue ) ) {
            // adding this year since developers forget to check for an id
            // and hence we get the first value in the db
            CRM_Core_Error::fatal( );
            return null;
        }
       
        require_once(str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php");
        $code = '$object   = new ' . $daoName . '( );';
        echo print_r($code, true);

        eval( $code);

        echo print_r($object, true);

        $object->$searchColumn =  $searchValue;
        $object->selectAdd( );
        if ( $returnColumn == 'id' ) {
            $object->selectAdd( 'id' );
        } else {
            $object->selectAdd( "id, $returnColumn" );
        }

        echo print_r($object, true);

        $result = null;
        if ( $object->find( true ) ) {
            echo 'find true';
            echo print_r($object, true);
            $result = $object->$returnColumn;
        }
        echo print_r($result, true);
        $object->free( );
        return $result;
    }

debugging through this, the key bit appears to be the line:

Code: [Select]
$object->$searchColumn =  $searchValue;
Observing the output of $object after this assignment gives this:

Code: [Select]
CRM_Contact_DAO_Contact Object
(
    [id] => Array
        (
            [0] => 102
            [1] => 48852
        )
 
    [contact_type] =>
    [contact_sub_type] =>
    [do_not_email] =>
    [do_not_phone] =>
    [do_not_mail] =>
    [do_not_sms] =>
    [do_not_trade] =>
    [is_opt_out] =>
    [legal_identifier] =>
    [external_identifier] =>
    [sort_name] =>
    [display_name] =>
    [nick_name] =>
    [legal_name] =>
    [image_URL] =>
    [preferred_communication_method] =>
    [preferred_language] =>
    [preferred_mail_format] =>
    [hash] =>
    [api_key] =>
    [source] =>
    [first_name] =>
    [middle_name] =>
    [last_name] =>
    [prefix_id] =>
    [suffix_id] =>
    [email_greeting_id] =>
    [email_greeting_custom] =>
    [email_greeting_display] =>
    [postal_greeting_id] =>
    [postal_greeting_custom] =>
    [postal_greeting_display] =>
    [addressee_id] =>
    [addressee_custom] =>
    [addressee_display] =>
    [job_title] =>
    [gender_id] =>
    [birth_date] =>
    [is_deceased] =>
    [deceased_date] =>
    [mail_to_household_id] =>
    [household_name] =>
    [primary_contact_id] =>
    [organization_name] =>
    [sic_code] =>
    [user_unique_id] =>
    [employer_id] =>
    [is_deleted] =>
    [_DB_DataObject_version] => 1.8.12
    [__table] => civicrm_contact
    [N] => 0
    [_database_dsn] =>
    [_database_dsn_md5] => 6221c29fbc474553ed93278ca745cea5
    [_database] => linksscrm
    [_query] => Array
        (
            [condition] =>
            [group_by] =>
            [order_by] =>
            [having] =>
            [limit_start] =>
            [limit_count] =>
            [data_select] =>  id
        )
 
    [_DB_resultid] =>
    [_resultFields] =>
    [_link_loaded] =>
    [_join] =>
    [_lastError] =>
)

I suspect this is where the error is. Probably CRM_Contact_DAO_Contact only takes one value for contact Id, but i will check this next.

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 06:01:20 am
Quote from: grahamgilchrist on November 02, 2010, 05:31:05 am

Code: [Select]
Array
(
    [source] => 102
    [assignee] =>
    [target] => Array
        (
            [0] => 102
            [1] => 48852
        )
 
)

...Target(s) is still an array, but has existing and correct contact IDs.


Certainly looks as though civicrm_activity_create is being called incorrectly, on two counts:
- Passed 2 arguments instead of one.
- AFAICS civicrm_activity_create /  _civicrm_activity_check_params expect to be passed single ids rather than arrays for *_contact_id .

Dave J

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 06:15:28 am
Quote from: davej on November 02, 2010, 06:01:20 am
Certainly looks as though civicrm_activity_create is being called incorrectly, on two counts:
- Passed 2 arguments instead of one.
- AFAICS civicrm_activity_create /  _civicrm_activity_check_params expect to be passed single ids rather than arrays for *_contact_id .

Hi Dave,
Yes I think you are right. I've dug about as far as I can go now, right down to packages\DB\DataObject.php which the is the core DB access object which CRM_Contact_DAO_Contact inherits.
That is a really complex class and beyond me for the moment (and I have to pop off to a meeting now), but it certainly seems like that only expects a single value to be passed in (rather than an array), so taking this back up the chain:

CRM\Core\DAO.php function getFieldValue()
Code: [Select]
        $object->$searchColumn =  $searchValue;
$searchvalue is an array

API\v2\Activity.php, function _civicrm_activity_check_params()
Code: [Select]
if ( $value &&
             !CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $value, 'id' ) ) {
$value is an array because $params['target_contact_id'] is an array

API\v2\Activity.php, function civicrm_activity_create()
Code: [Select]
    $errors = _civicrm_activity_check_params( $params, true ) ;
$params['target_contact_id'] is an array

CRM\Mailing\BAO\job.php, function deliverGroup()
Code: [Select]
            require_once 'api/v2/Activity.php';
            if ( is_a( civicrm_activity_create($activity, 'Email'), 'CRM_Core_Error' ) ) {
                return false;
            }
$activity['target_contact_id'] is an array.

So the question is. At what point along this chain should that array be converted to a loop for each target? Maybe one of the dev team could chip in here with their thoughts?
Would be good to get this patched ASAP :)

Also, another patch is probably needed for the other problem whereby this code:
CRM\Mailing\BAO\job.php, function deliverGroup()
Code: [Select]
            require_once 'api/v2/Activity.php';
            if ( is_a( civicrm_activity_create($activity, 'Email'), 'CRM_Core_Error' ) ) {
                return false;
            }
has an extra unnecesary parameter in the civicrm_activity_create call.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 06:18:03 am
Hello grahamgilchrist,

Great job w/ debug :)

Could u please fire this query w/ your db and let us know result,

query = select id from civicrm_contact where id IN ( 102, 48852 );

davej : If I'm not wrong api create should respect both single *_contact_id as well as an array of ids.

yes, we could safely drop second parameter to civicrm_create_activity( $activity, 'Email' );

thanks

kiran
You Are Designed To Choose... Defined By Choice.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 06:20:40 am
Hello grahamgilchrist,

feel free to catch core team on IRC : http://webchat.freenode.net/?channels=#civicrm

would be easy to debug.

thanks

kiran
You Are Designed To Choose... Defined By Choice.

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Upgrade 3.1.3-3.2.3 Civimail no longer recording activities
November 02, 2010, 06:27:38 am
Quote from: Kiran Jagtap on November 02, 2010, 06:18:03 am
Could u please fire this query w/ your db and let us know result,

query = select id from civicrm_contact where id IN ( 102, 48852 );

Yes indeed. I can confirm those two contacts exist. Results of that query gives two rows with
102
48852

Incidentally, I've just looked through the code for 3.1.3, and found out why we did not have this error before.
What has changed somewhere between 3.1.3 and 3.2.3 (sorry not sure exactly which version) is the _civicrm_activity_check_params() function in API\v2\Activity.php.

In 3.1.3, this function did only a check on valid source id's. However, the activities were still registered, as the call to CRM_Activity_BAO_Activity::create( $params ) did support an array of target contact ids.

Now in 3.2.3 it checks valid source, assignee, and target contact ids, then returns an error (because the targets are sent as an array). Presumably, if it got past this error checking, the activity create BAO call would still work (I've not checked this). This change is probably a result of unit testing and error trapping in the APIs (which is great), but it looks like we need to either:

1) update the API so that it can accept arrays of contact id's and check them appropriately (via a loop or something?)
2) update the API to have a flag for ignoring activities where assignee or target are not valid (are there any others apart from civimail?)
3) update the civimail BAO code to loop through each contact with an API call. This seems like it might produce a lot of extra overhead, so the prior options seem preferable

What do you guys think?
« Last Edit: November 02, 2010, 06:30:17 am by grahamgilchrist »

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade 3.1.3-3.2.3 Civimail no longer recording activities

This forum was archived on 2017-11-26.