SuiteCRM
SuiteCRM copied to clipboard
Error when importing targets
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
- 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
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?
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; }
bump, am having the same issues on suitecrm8.6 / php8.2 /virtualmin/alma 8.9
bump, am having the same issues on suitecrm8.6 / php8.2 /virtualmin/alma 8.9
Does the proposed fix solve your import issue?
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..