Suitecrm: Error importing Accounts limiting imports to 100 at a time

Created on 27 Nov 2019  路  10Comments  路  Source: salesagility/SuiteCRM



When importing Accounts from a CSV file we get the following error:

NOTICE: [8] Array to string conversion on line 630 in file /modules/jjwg_Maps/jjwg_Maps.php

Issue



Line 630

$GLOBALS['log']->debug(__METHOD__.' $aInfo: '.$aInfo);
$aInfo is returned a couple of lines above from the function: defineMapsAddress.

defineMapsAddress returns an array OR false, hence if you get an array into $aInfo you get an array to string conversion error.

Expected Behavior

Actual Behavior


Should not get this error, without the error the import will process properly.

Possible Fix


replicate the standard code used in the line above this one for adding to the debug log:

$GLOBALS['log']->debug(__METHOD__.' $aInfo: '.print_r($aInfo,true));

Steps to Reproduce


  1. Geocoding Turned ON
    2.Pre-existing Addresses already Geocoded
    3.Address Caching Turned ON
    4.Use an Address already in the Cache
  2. Import file with aforementioned address already in cache (probably as a new account)

Context



Probably a medium to high priority, as potential users start using SuiteCRM they will be default be importing data, this would be a hurdle for them that wouldn't be hard to fix.

Your Environment

  • SuiteCRM Version used: 7.11.x
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome/FF/NA
  • Environment name and version (e.g. MySQL, PHP 7): MariaDB 10/PHP7.1
  • Operating System and version (e.g Ubuntu 16.04):Debian Stretch
Module Fix Proposed Bug

Most helpful comment

@pgorod

Hi, yes I was just in the process of that when I received the comment here, should be done now!
Regards

Mark

All 10 comments

Hi @markbond1007,

We haven't been able to replicate this issue in the most recent versions of SuiteCRM such as 7.10.x or 7.11.x. Could you please provide further steps to reproduce? The error you pointed out is only a notice and shouldn't cause the import to fail

Thanks :+1:

@Mac-Rae try with display_errors turned on in your php.ini

I suspect that's what turns the error message into a broken process.

And of course with debug level in suitecrm.log (Admin / System Settings)

@pgorod That makes sense will give it a go.

@Mac-Rae

I will see what I can do. I have seen similar bug reports here previously. It doesn't actually stop the import, what it does is limit the import to 100 at a time. I can't provide a sample of the import details (confidentiality/GDPR/etc.). However if you check the code and the possible returns (and the line above that shows how to do it properly) you can see the issue.

All I am doing though is to import the file with either create new only or create and update. Setting the fields appropriately and then checking the Name field as the Check Field.

I haven't explicitly turned on display_errors, although a grep of display_errors on the code base shows it being turned on/off in various places.

If you want me to change the description of the bug however an alternate could read:

$aInfo is set by a function that returns both boolean false and an array as such it needs to be converted to a string prior to being added to the string, so the code needs updating as described!

Hi @markbond1007,

I've just managed to import 300 records with nothing appearing on screen or in the logs.

291 records were created
9 Duplicates Found

If you feel like updating your ticket might help with replicating this issue or providing more context please feel free. Further replication steps or replication of the data you are using for import would be appreciated

@Mac-Rae

Depending on your set-up as this is an error specific to the Mapping, would it only trigger if you have the Geocoding turned on? (we have). I have even turned Off error logging in the system page and it still shows, php.ini has display_errors off.

I will see if I can arrange a vanilla version of Suite and see if it still happens. As mentioned though a review of the code does show that logically it should trigger the notices I am getting (I have checked the current live code and its still there).

I can confirm however that with the code change mentioned it is fixed (and I get the equivalent response as yourself).
Mark

@markbond1007, you can get a vanilla version at demo.suiteondemand.com, log in using U: will P: will which should allow you to test import

@Mac-Rae
Okay I have successfully replicated this on a Vanilla Suite 7.11.10 install and using the code review created the case where it triggers the warning (as expected). I have updated the issue above to reflect it. Hopefully I have also created a code branch and fix (and pushed it as well)

@markbond1007 you committed in your fork, but you still need to create the PR:

https://github.com/salesagility/SuiteCRM/compare/hotfix-7.10.x...markbond1007:bugfix_8320?expand=1

Please name it something including Fix #8320 etc so that Github automatically links it here. Thanks!

@pgorod

Hi, yes I was just in the process of that when I received the comment here, should be done now!
Regards

Mark

Was this page helpful?
0 / 5 - 0 ratings