WordPress.org

Support

Support » Plugins and Hacks » Gravity Forms Salesforce Add-on » [Resolved] [PATCH][2.1.1] Make sure zeros send to SalesForce

[Resolved] [PATCH][2.1.1] Make sure zeros send to SalesForce

  • gmcinnes

    @gmcinnes

    Due to a bug, if a User tries to enter a single “0” in a form, or a single “0” is generated from a radio button, or possibly in other situations, the plugin will strip the “0” and return an empty string (“”) to SalesForce. This is of particular concern when using the SOAP API, since SalesForce API will raise an Exception due to a type mismatch between the expected Boolean or Double, and the empty String that is sent.

    This patch special cases around that.

    It should apply cleanly to 2.1.1, as long as this previous patch is applied:

    http://wordpress.org/support/topic/cleaning-utf-8-for-soap-submission?replies=3

    --- salesforce-api.php	2012-11-27 16:41:10.000000000 -0500
    +++ salesforce-api.php.case_around_zeros	2012-11-29 20:05:16.000000000 -0500
    @@ -1390,8 +1390,14 @@
                     $merge_vars[$var_tag] = self::get_address($entry, $field_id);
                 } else if($var_tag  == 'country') {
                     $merge_vars[$var_tag] = empty($entry[$field_id]) ? '' : GFCommon::get_country_code(trim($entry[$field_id]));
    +	          }
    +	            // If $entry[$field_id] is "0" (for example a user enters 0 in a text field type expecting a number)
    +              // then checking empty($entry[$field_id]) returns true.  That's right: empty("0") == true.  So we
    +              // have to special case for that
    +	            else if($entry[$field_id] == "0") {
    +		            $merge_vars[$var_tag] = "0";
                 } else if($var_tag != "email") {
    -                if(!empty($entry[$field_id])) {
    +                if(!empty($entry[$field_id]) && !($entry[$field_id] == "0")) {
                         switch($input_type) {
                             case 'multiselect':
                                 // If there are commas in the value, this makes it so it can be comma exploded.

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

Viewing 1 replies (of 1 total)
  • Plugin Contributor Zack Katz

    @katzwebdesign

    Thanks! This will be added to the next version.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [PATCH][2.1.1] Make sure zeros send to SalesForce’ is closed to new replies.
Skip to toolbar