WordPress.org

Forums

Gravity Forms Salesforce Add-on
Possible code error related to extra fields (3 posts)

  1. pwsolutions
    Member
    Posted 2 years ago #

    On one system that I have this plugin set up on, I'm seeing debug messages for some forms.

    Looking over the code, it appears that GFSalesforceWebToLead::push is looks like fieldtemp is not always an array when it hits the foreach block.

    E.g. foreach( $fieldtemp as $inputKey => $input ) ...

    I'm expecting that $_POST["input_" . $field["id"]]; does not have an array as a value in all cases. ( e.g. perhaps the code should reference $field["input_" . $field["id"]] instead? )

    Anywise, just a heads up as this might be causing other issues.

    http://wordpress.org/extend/plugins/gravity-forms-salesforce/

  2. pwsolutions
    Member
    Posted 2 years ago #

    Oh right, while I'm using 3.5.1 of wordpress, I'm using the current latest version of both Gravity Forms ( 1.7.6 ) and GF Sales Force Web To Lead ( 2.2.6 ).

  3. pwsolutions
    Member
    Posted 2 years ago #

    Alright, after some more testing ( and a class to let me see everything that is happening during a gravity form submission ), I've found the following bugs, both in the salesforce.php file.

    Minor Bug:

    GFSalesForceWebToLead::push ( Line 599 ):

    } else if($label == 'street') {
        $data['street'] .= $value."\n";
    }

    This should test to see if it exists before just appending to it ( just like the code does above on line 559 ).

    Larger Bug ( prevents choices from getting into salesforce ):

    GFSalesForceWebToLead::push ( Line 526 ):

    if ( is_array($field["inputs"])) {
       $fieldtemp = $field["inputs"];
    }
     else {
       $fieldtemp = $_POST["input_" . $field["id"]]; # BUG
       $multi_input = false;
       $label = self::getLabel($field["label"], $field);
    }

    The line marked bug should be creating fieldtemp as an array, not a value. It fails on line 533 as 533 assumes fieldtemp is an array.

    Update the marked line:

    $fieldtemp = array( $_POST["input_" . $field["id"]] );

    That seems to fix the problem.

    Anywise, thanks for looking!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Gravity Forms Salesforce Add-on
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.