Skip to content

Commit c909b5e

Browse files
committed
3.0.6
* Added: Enabled Merge Tag field value support ([issue #97](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/ 97)) * Added [API Add-on]: "Form Title" as an option for mapping form fields * Fixed: Form details were not being properly passed ([issue #94](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/ 94)) * Fixed: DaddyAnalytics API names were incorrect for the API integration * Fixed: PHP warning about calling static functions * Added: Additional Debugging
1 parent fb8dab5 commit c909b5e

File tree

6 files changed

+105
-30
lines changed

6 files changed

+105
-30
lines changed

trunk/inc/daddy_analytics.addon.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function __construct() {
7070

7171
function filter_web_to_lead_merge_vars($merge_vars, $form, $entry) {
7272

73-
KWSGFWebToLeadAddon::log_debug('DA::filter_web_to_lead_merge_vars() - Starting adding DA data to merge vars.');
73+
do_action('kwsgfwebtoleadaddon_log_debug', 'DA::filter_web_to_lead_merge_vars() - Starting adding DA data to merge vars.');
7474

7575
// Get the $_POST data for the inserted fields
7676
$submitted_token = rgpost(esc_attr($this->token), true);
@@ -80,7 +80,7 @@ function filter_web_to_lead_merge_vars($merge_vars, $form, $entry) {
8080
$merge_vars[esc_attr($this->url)] = $submitted_url;
8181
$merge_vars[esc_attr($this->token)] = $submitted_token;
8282

83-
KWSGFWebToLeadAddon::log_debug("DA::filter_api_merge_vars() - Added DA data to merge vars. Token: {$submitted_token} and Url: {$submitted_url}");
83+
do_action('kwsgfwebtoleadaddon_log_debug', "DA::filter_api_merge_vars() - Added DA data to merge vars. Token: {$submitted_token} and Url: {$submitted_url}");
8484

8585
return $merge_vars;
8686
}
@@ -105,8 +105,8 @@ function filter_api_merge_vars($merge_vars, $form, $entry, $feed, $api ) {
105105
$submitted_url = rgpost(esc_attr($this->url), true);
106106

107107
// Use defaults if not set yet, somehow.
108-
$url_api_name = empty($this->url_api_name) ? 'DaddyAnalytics_Web_to_Lead_URL__c' : $this->url_api_name;
109-
$token_api_name = empty($this->token_api_name) ? 'DaddyAnalytics_DA_Token__c' : $this->token_api_name;
108+
$url_api_name = empty($this->url_api_name) ? 'DaddyAnalytics__DA_Web_to_Lead_URL__c' : $this->url_api_name;
109+
$token_api_name = empty($this->token_api_name) ? 'DaddyAnalytics__DA_Token__c' : $this->token_api_name;
110110

111111
// Add the data to be pushed.
112112
$merge_vars[esc_attr($url_api_name)] = $submitted_url;
@@ -225,14 +225,14 @@ public function plugin_settings_fields() {
225225
"name" => "daddy_analytics_webtolead_url_api_name",
226226
"label" => __("Web-to-Lead URL API Name", "gravity-forms-salesforce"),
227227
"type" => "text",
228-
"default_value" => 'DaddyAnalytics_Web_to_Lead_URL__c',
228+
"default_value" => 'DaddyAnalytics__DA_Web_to_Lead_URL__c',
229229
"class" => "large code",
230230
),
231231
array(
232232
"name" => "daddy_analytics_token_api_name",
233233
"label" => __("Daddy Analytics Token API Name", "gravity-forms-salesforce"),
234234
"type" => "text",
235-
"default_value" => 'DaddyAnalytics_DA_Token__c',
235+
"default_value" => 'DaddyAnalytics__DA_Token__c',
236236
"class" => "large code",
237237
),
238238
array(

trunk/inc/kwsaddon.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,16 +777,29 @@ public function process_feed( $feed, $entry, $form ) {
777777

778778
protected function get_merge_vars_from_entry($feed, $entry, $form) {
779779

780+
$this->log_debug( 'All Feed Meta: '.print_r( $feed["meta"], true ) );
781+
780782
$merge_vars = array();
781783
foreach($feed["meta"] as $var_tag => $field_id){
782784

783-
if(empty($field_id) || strpos($var_tag, 'feed_condition') !== false) { continue; }
785+
if(empty($field_id) || strpos($var_tag, 'feed_condition') !== false) {
786+
$this->log_debug( '[get_merge_vars_from_entry]: Feed field not defined for field ID '.$var_tag );
787+
continue;
788+
}
784789

785790
$var_tag = str_replace('field_map__', '', $var_tag);
786791

787-
$field = RGFormsModel::get_field($form, $field_id);
792+
if( !is_numeric( $field_id ) ) {
788793

789-
$value = RGFormsModel::get_lead_field_value($entry, $field);
794+
$value = GFCommon::replace_variables( '{'.$field_id.'}' , $form, $entry, false, false, false );
795+
796+
} else {
797+
798+
$field = RGFormsModel::get_field($form, $field_id);
799+
800+
$value = RGFormsModel::get_lead_field_value($entry, $field);
801+
802+
}
790803

791804
// If the value is multi-part, like a name or address, there will be an array
792805
// returned. In that case, we check the array for the key of the field id.

trunk/inc/salesforce-api.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,10 @@ private static function list_page(){
785785
<th scope="row" class="check-column"><input type="checkbox" name="feed[]" value="<?php echo $setting["id"] ?>"/></th>
786786
<td><img src="<?php echo self::get_base_url() ?>/assets/images/active<?php echo intval($setting["is_active"]) ?>.png" alt="<?php echo $setting["is_active"] ? __("Active", "gravity-forms-salesforce") : __("Inactive", "gravity-forms-salesforce");?>" title="<?php echo $setting["is_active"] ? __("Active", "gravity-forms-salesforce") : __("Inactive", "gravity-forms-salesforce");?>" onclick="ToggleActive(this, <?php echo $setting['id'] ?>); " /></td>
787787
<td class="column-title">
788-
<a href="admin.php?page=gf_salesforce&view=edit&id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-salesforce") ?>"><?php echo $setting["form_title"] ?></a>
788+
<a href="admin.php?page=gf_salesforce&amp;view=edit&amp;id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-salesforce") ?>"><?php echo esc_html( $setting["form_title"] ); ?></a>
789789
<div class="row-actions">
790790
<span class="edit">
791-
<a title="Edit this setting" href="admin.php?page=gf_salesforce&view=edit&id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-salesforce") ?>"><?php _e("Edit", "gravity-forms-salesforce") ?></a>
791+
<a title="Edit this setting" href="admin.php?page=gf_salesforce&amp;view=edit&amp;id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-salesforce") ?>"><?php _e("Edit", "gravity-forms-salesforce") ?></a>
792792
|
793793
</span>
794794

@@ -1847,6 +1847,8 @@ public static function get_form_fields($form_id){
18471847
array_push($form["fields"],array("id" => "date_created" , "label" => __("Entry Date", "gravity-forms-salesforce")));
18481848
array_push($form["fields"],array("id" => "ip" , "label" => __("User IP", "gravity-forms-salesforce")));
18491849
array_push($form["fields"],array("id" => "source_url" , "label" => __("Source Url", "gravity-forms-salesforce")));
1850+
array_push($form["fields"],array("id" => "form_title" , "label" => __("Form Title", "gravity-forms-salesforce")));
1851+
18501852

18511853
if(is_array($form["fields"])){
18521854
foreach($form["fields"] as $field){
@@ -2082,7 +2084,7 @@ private static function process_merge_vars($entry, $form, $feed) {
20822084
$value = htmlspecialchars($entry[$field_id]);
20832085
}
20842086

2085-
$merge_vars[$var_tag] = $value;
2087+
$merge_vars[$var_tag] = GFCommon::replace_variables($value, $form, $entry, false, false, false );
20862088

20872089
} else {
20882090

@@ -2093,7 +2095,10 @@ private static function process_merge_vars($entry, $form, $feed) {
20932095
$elements[] = htmlspecialchars($value);
20942096
}
20952097
}
2096-
$merge_vars[$var_tag] = implode(';',array_map('htmlspecialchars', $elements));
2098+
2099+
$value = implode(';',array_map('htmlspecialchars', $elements));
2100+
2101+
$merge_vars[$var_tag] = GFCommon::replace_variables($value, $form, $entry, false, false, false );
20972102
}
20982103
}
20992104

trunk/inc/web-to-lead.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function __construct() {
3535

3636
$this->_version = KWS_GF_Salesforce::version;
3737

38+
add_action('kwsgfwebtoleadaddon_log_debug', array( $this, 'log_debug' ));
39+
add_action('kwsgfwebtoleadaddon_log_error', array( $this, 'log_error' ));
40+
3841
parent::__construct();
3942

4043
}
@@ -386,17 +389,23 @@ public function process_feed( $feed, $entry, $form ) {
386389

387390
try {
388391

392+
foreach ($feed['meta'] as $key => $value) {
393+
// The field names have a trailing underscore for some reason.
394+
$trimmed_key = ltrim($key, '_');
395+
$feed['meta'][ $trimmed_key ] = $value;
396+
unset( $feed['meta'][$key] );
397+
}
398+
389399
$temp_merge_vars = $this->get_merge_vars_from_entry($feed, $entry, $form);
390400

401+
self::log_debug( sprintf("Temp Merge Vars: %s", print_r( $temp_merge_vars, true )) );
402+
391403
$merge_vars = array();
392404
foreach($temp_merge_vars as $key => $value) {
393405

394406
// Get the field ID for the current value
395407
$field_id = $feed['meta'][$key];
396408

397-
// The field names have a trailing underscore for some reason.
398-
$key = ltrim($key, '_');
399-
400409
// We need to specially format some data going to Salesforce
401410
// If it's a field ID, get the field data
402411
if(is_numeric($field_id) && !empty($value)) {
@@ -442,7 +451,7 @@ public function process_feed( $feed, $entry, $form ) {
442451
unset($merge_vars[$key]);
443452
} else {
444453
// Add the value to the data being sent
445-
$merge_vars[$key] = $value;
454+
$merge_vars[$key] = GFCommon::replace_variables($value, $form, $entry, false, false, false );
446455
}
447456
}
448457

trunk/readme.txt

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Tags: gravity forms, forms, gravity, form, crm, gravity form, salesforce, salesforce plugin, form, forms, gravity, gravity form, gravity forms, secure form, simplemodal contact form, wp contact form, widget, sales force, customer, contact, contacts, address, addresses, address book, web to lead, web to case, web-to-lead, web-to-case, cases, leads, lead
33
Requires at least: 3.3
44
Tested up to: 3.9.1
5-
Stable tag: 3.0.5
5+
Stable tag: 3.0.6
66
Contributors: katzwebdesign,katzwebservices
77
Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=Gravity%20Forms%20Salesforce%20Addon&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
88
License: GPLv2 or later
@@ -60,11 +60,25 @@ If you have questions, comments, or issues with this plugin, <strong>please leav
6060

6161
1. Upload plugin files to your plugins folder, or install using WordPress' built-in Add New Plugin installer
6262
1. Activate the plugin
63-
1. Go to the plugin settings page (under Forms > Settings > Salesforce)
64-
1. Enter the information requested by the plugin.
65-
1. Click Save Settings.
66-
1. If the settings are correct, it will say so.
67-
1. Follow on-screen instructions for integrating with Salesforce.
63+
1. Go to the plugin settings page (under Forms > Settings > Salesforce Add-on )
64+
1. Choose your Integration Method (API or Web-to-Lead)
65+
66+
### API
67+
- Select API as your Integration Method
68+
- Click Save Settings.
69+
- Click the "Salesforce: API" menu in the current settings
70+
- Click the "Login with Salesforce" button
71+
- Log in to Salesforce.com
72+
- Click on the Forms > Salesforce menu link to create a feed
73+
- Follow the steps to create a feed
74+
75+
### Web-to-Lead
76+
- Select Web-to-Lead as your Integration Method
77+
- Click Save Settings
78+
- Go to the Gravity Forms Forms page (the Forms menu)
79+
- Edit the form you want to connect with Salesforce
80+
- On the Edit Form page, under "Form Settings", click the "Salesforce: Web-to-Lead" link
81+
- Click the link to create a feed
6882

6983
__If you are using the Web-To-Lead Add-on__ you must have Web-To-Lead enabled. [Read how to enable Web-to-Lead on Salesforce.com](https://help.salesforce.com/apex/HTViewHelpDoc?id=setting_up_web-to-lead.htm).
7084

@@ -76,14 +90,30 @@ Please check the box "Enable Salesforce debugging emails" in the Web-to-Lead set
7690
= Web-to-Lead: How do I convert my existing form configuration to Feeds? =
7791
See "Web-to-Lead: How do I create a Feed" below.
7892

93+
= API: How do I create a Feed? =
94+
95+
- Go to the plugin settings page (under Forms > Settings > Salesforce Add-on )
96+
- Choose your Integration Method (API or Web-to-Lead)
97+
- Select API as your Integration Method
98+
- Click Save Settings.
99+
- Click the "Salesforce: API" menu in the current settings
100+
- Click the "Login with Salesforce" button
101+
- Log in to Salesforce.com
102+
- Click on the Forms > Salesforce menu link to create a feed
103+
- Follow the steps to create a feed
104+
105+
79106
= Web-to-Lead: How do I create a Feed? =
80107

81108
__To create a feed:__
82109

83-
1. Go to "Forms" in your admin
84-
1. Click on the name of the form you want to link with Salesforce
85-
1. Hover over "Form Settings" and click on the "Salesforce: Web-to-Lead" link
86-
1. Follow the instructions to create a Feed.
110+
- Go to the plugin settings page (under Forms > Settings > Salesforce Add-on )
111+
- Select Web-to-Lead as your Integration Method
112+
- Click Save Settings
113+
- Go to the Gravity Forms Forms page (the Forms menu)
114+
- Edit the form you want to connect with Salesforce
115+
- On the Edit Form page, under "Form Settings", click the "Salesforce: Web-to-Lead" link
116+
- Click the link to create a feed
87117

88118
= Web-to-Lead: How do I modify the debug email address? =
89119
The Salesforce debugging emails are sent to the website administrator by default. To modify this, add a filter to `gf_salesforce_salesforce_debug_email_address` that returns an email address.
@@ -239,7 +269,7 @@ __If that doesn't work__, you can modify the format for the date by using this c
239269
add_filter('gf_salesforce_format_date', 'modify_gf_salesforce_format_date');
240270

241271
/**
242-
* The default is US-style, though Salesforce recommends `Y-m-d\'\T\'H:i:s`
272+
* The default is US-style, though Salesforce recommends <code>Y-m-d\'\T\'H:i:s</code>
243273
* You can use any date formatting as shown here:
244274
* @link http://php.net/manual/en/function.date.php
245275
*/
@@ -259,6 +289,15 @@ This plugin is released under a GPL license.
259289

260290
== Changelog ==
261291

292+
= 3.0.6 (July 19, 2014) =
293+
* If you haven't read the 3.0.5 changelog notes, please do so!
294+
* Added: Enabled Merge Tag field value support ([issue #97](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/97))
295+
* Added [API Add-on]: "Form Title" as an option for mapping form fields
296+
* Fixed: Form details were not being properly passed ([issue #94](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/94))
297+
* Fixed: DaddyAnalytics API names were incorrect for the API integration
298+
* Fixed: PHP warning about calling static functions
299+
* Added: Additional Debugging
300+
262301
= 3.0.5 (June 26, 2014) =
263302
* __!!MAJOR UPDATE!!__ Please read through the changes below.
264303
* __API Add-on Changes__
@@ -443,6 +482,15 @@ This plugin is released under a GPL license.
443482

444483
== Upgrade Notice ==
445484

485+
= 3.0.6 (July 19, 2014) =
486+
* If you haven't read the 3.0.5 changelog notes, please do so!
487+
* Added: Enabled Merge Tag field value support ([issue #97](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/97))
488+
* Added [API Add-on]: "Form Title" as an option for mapping form fields
489+
* Fixed: Form details were not being properly passed ([issue #94](https://github.com/katzwebservices/Gravity-Forms-Salesforce/issues/94))
490+
* Fixed: DaddyAnalytics API names were incorrect for the API integration
491+
* Fixed: PHP warning about calling static functions
492+
* Added: Additional Debugging
493+
446494
= 3.0.5 (June 26, 2014) =
447495
* __!!MAJOR UPDATE!!__ Please read through the changes below.
448496
* __API Add-on Changes__

trunk/salesforce.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: Gravity Forms Salesforce Add-On
44
Description: Integrates <a href="http://katz.si/gf">Gravity Forms</a> with Salesforce, allowing form submissions to be automatically sent to your Salesforce account.
5-
Version: 3.0.5
5+
Version: 3.0.6
66
Requires at least: 3.3
77
Author: Katz Web Services, Inc.
88
Author URI: https://katz.co
@@ -33,7 +33,7 @@
3333
*/
3434
class KWS_GF_Salesforce {
3535

36-
const version = '3.0.5';
36+
const version = '3.0.6';
3737
static $file;
3838
static $plugin_dir_path;
3939

0 commit comments

Comments
 (0)