SuiteCRM icon indicating copy to clipboard operation
SuiteCRM copied to clipboard

Error when importing targets

Open josedpedroso opened this issue 4 years ago • 5 comments

Issue

I get the following error when importing a large CSV file, with around 13000 targets:

[4144][1][FATAL] Caught error: Trying to access array offset on value of type bool

The error is shown both in the import progress window and in the SuiteCRM log, though it only shows the origin of the error in the window. The origin is line 504 of /modules/Import/Importer.php.

Expected Behavior

All records in the CSV should be imported.

Actual Behavior

Only a few hundred records from the beginning of the file were actually imported.

Possible Fix

Not really a fix, but commenting out line 504 allowed me to get everything imported correctly.

        /*
        * Bug 34854: Added all conditions besides the empty check on date modified.
        */
        if ((!empty($focus->new_with_id) && !empty($focus->date_modified))/* ||
             (empty($focus->new_with_id) && $timedate->to_db($focus->date_modified) != $timedate->to_db($timedate->to_display_date_time($focus->fetched_row['date_modified'])))*/
        ) {
            $focus->update_date_modified = false;
        }

Steps to Reproduce

  1. Import a large amount of targets from a CSV file with only full name and e-mail fields.

Context

I was trying to import some 13000 targets for e-mail marketing campaigns. BTW, is it possible to associate targets with a target list when importing?

Your Environment

  • SuiteCRM 7.11.13
  • Firefox 76
  • PHP7, MariaDB, IIS

josedpedroso avatar May 19 '20 16:05 josedpedroso

Just to understand the context here.. where this was down the the amount of records imported or because they were new..

Did you see any patterns of the few hundred that were imported.. where they new records or modified records?

samus-aran avatar Jul 28 '20 14:07 samus-aran

I fixed this error by using ternary operation on line 504. /* * Bug 34854: Added all conditions besides the empty check on date modified. */ if ((!empty($focus->new_with_id) && !empty($focus->date_modified)) || (empty($focus->new_with_id) && $timedate->to_db($focus->date_modified) != $timedate->to_db($timedate->to_display_date_time( isset($focus->fetched_row['date_modified']) ? $focus->fetched_row['date_modified'] : false ))) ) { $focus->update_date_modified = false; }

mehmoodmalik avatar Dec 22 '20 10:12 mehmoodmalik

bump, am having the same issues on suitecrm8.6 / php8.2 /virtualmin/alma 8.9

rashaqqel avatar May 11 '24 18:05 rashaqqel

bump, am having the same issues on suitecrm8.6 / php8.2 /virtualmin/alma 8.9

Does the proposed fix solve your import issue?

chris001 avatar May 12 '24 16:05 chris001

It didnt fix the issue, i had to reinstall and now imports worked... I used basic fields and avoided importing weird fields types like currency/int/decimals not sure if it was causing a parsing error or what..

rashaqqel avatar May 12 '24 17:05 rashaqqel