Unable to create New Contacts when Potential Duplicate is NOT found.

Issue #338 resolved
Burke Allen
created an issue

When creating a new contact if you type in a last name that does not already exist. the system hangs on looking up to see if there are possible matches. and you are not able to create the new user.

if last name is a possible match, then the system allows you to create the new user.

this is the JS error that is being thrown

Uncaught SyntaxError: Unexpected end of input create:1

I have tracked the issue down to this area of the JS that is being inserted into the page

After Checking for potential duplicates the JS attempts to Parse the returning the Json Data

however it is data == " ", and is causing the jquery script to fail

modules/zurmo/rules/DedupeRules.php (@ line 119)

'success' => "js:function(data, textStatus, jqXHR){
var returnObj = jQuery.parseJSON(data);

I replaced with this Code - could be more elegant, but wanted to easily document what is happening

'success' => "js:function(data, textStatus, jqXHR){

                                    if (data.trim()){
                                      var returnObj = jQuery.parseJSON(data);
                                    } else {
                                      var returnObj = null;

Comments (8)

  1. Ivica Nedeljkovic

    Thanks for submitting patch, however, I was not able to reproduce this issue locally. I do not know why in your case is returned " " why not just empty string if there are no matching contacts.
    Can you please try to reproduce this issue on demo website(yes, again :)), and if you are able, then describe if you already have to add contact names with some specific last names to trigger this issue? Which browser are you suing?

  2. Fernando Vortal

    Burke, I've been facing exactly the same issue. Trying to contribute a little bit more, in my case I have 2 separate installations of Zurmo 3.0.2, test and production, that reside under different Apache virtual folders. Under my test app (test.domain.com) all works fine, but under my production (production.domain.com) I get this same behavior. Setup is AWS EC2 Windows 2012, Apache, MySQL, Chrome 45.0.2454.85 m (64-bit). Your patch solved my issue, thank you.

    But your

    if (data.trim())

    trick does not solve the root problem, which is json returning CRLF instead of empty !

  3. Log in to comment