11c11
<  ** Removing a field from the Salesforce data model should also remove that field from the local
---
>  * - Removing a field from the Salesforce data model should also remove that field from the local
13,14c13,15
<  * The salesforce id columen, ie) 'AccoundId' should probably to placed somewhere other than in the
<  * content_* table since this would allow users to accidently delete this very important column.
---
>  * - The salesforce id column, ie) 'AccoundId' should probably be placed somewhere other than in the
>  * 		content_* table since this would allow users to accidently delete this very important column.
>  * - Should be some kind of option to specificy the user that imported nodes are authored by
18c19,26
<  * Truncate field names at 26 characters
---
>  * Fixes
>  * 1/18/08 - Fixed bug that prevented valide use of $limit argument for _salesforce_sync_queue_import
>  * 1/24/08 - Fixed mis-use of hardcoded values for field names in _salesforce_sync_get_object_data that
>  *  tried to use the "Name" field on all Salesforce objects regardless of whether or not they had one.
>  */
> 
> /**
>  * Truncate field names at 26 characters and make sure that all fields have a unique name
21c29,42
< 	return substr($field_name, 0, 26);
---
> 	global $used_field_names;
> 	
> 	$used_field_names = ( empty($used_field_names) ) ? array() : $used_field_names;
> 	$field_name = substr($field_name, 0, 26);
> 	
> 	if ($used_field_names[$field_name]) {
> 		$tmp = $field_name;
> 		$field_name = substr($field_name, 0, -strlen($used_field_names[$tmp])) . $used_field_names[$tmp];
> 		$used_field_names[$tmp]++;
> 	} else {
> 		$used_field_names[$field_name] = 1;
> 	}
> 	
> 	return $field_name;
57c78
< 		'type_name' 				=> $node_type
---
> 		'type_name' 				=> $node_type,
70c91
< 		'max_length' 				=> $field_info['length']
---
> 		'max_length' 				=> $field_info['length'],
72a94,99
> 	// For boolean fields
> 	if ($field_info['type'] == 'boolean') {
> 		$values2['allowed_values'] = "0|". $field_info['label'] ."\n";
> 		$values2['allowed_values'] .= "1|". $field_info['label'];
> 	}
> 		
163c190,193
< 		'currency' 		=> array('field_widget_type'=> 'number_decimal-number',     												
---
> 		'boolean'		=> array('field_widget_type' 	=> 'number_integer-number',
> 												 'widget_type'				=> 'options_onoff'),
> 
> 		'currency' 	=> array('field_widget_type'	=> 'number_decimal-number',     												
171c201
< 		'datetime' 			=> array('field_widget_type' 	=> 'date-date_select',
---
> 		'datetime' 	=> array('field_widget_type' 	=> 'date-date_select',
192c222
< 		'reference' => false, // not really sure  how to deal with these, or if we even really need to.
---
> 		'reference' => false, // not really sure how to deal with these, or if we even really need to.
201c231
< 		'url' 			=> array('field_widget_type' 			=> 'text-text',
---
> 		'url' 			=> array('field_widget_type' 	=> 'text-text',
245a276
>  * @param $node_title_field = (string) The name of the Salesforce field that should be mapped to $node->title
250c281
< function _salesforce_sync_get_object_data($type, $id, $node_type, $nid = 0, $limit = '') {
---
> function _salesforce_sync_get_object_data($type, $id, $node_type, $node_title_field = 'Name', $nid = 0, $limit = '') {
255c286
< 	$obj_fields = array('Name');
---
> 	$obj_fields = array($node_title_field);
274c305
< 		// for select fields than we do text fields.
---
> 		// for select fields than we do text fields, etc ...
280c311,315
< 			} else if ($row->widget_type == 'date_select') {
---
> 			}
> 			else if ($row->widget_type == 'options_onoff') {
> 				$cck_field_types[$row->field_name] = 'boolean';
> 			}
> 			else if ($row->widget_type == 'date_select') {
282c317,318
< 			} else {
---
> 			}
> 			else {
300c336
< 			'title' => $obj->values['Name']
---
> 			'title' => $obj->values[$node_title_field]
302a339
> 		// Format field for sumbmission via drupal_execute according to type
304d340
< 			// Format field for sumbmission according to type
308a345,347
> 				case 'boolean':
> 					$form_values[$dp_field]['keys'] = ($obj->values[$sf_field] == "true") ? 1 : '';
> 					break;
325,326c364
< 		// If the account is marked as deleted in Salesforce we un-publish it here.
< 
---
> 		// TODO - If the object is marked as deleted in Salesforce we un-publish it here.
357c395
< 		$res = db_query('SELECT nfi.field_name, nf.type FROM {node_field_instance} nfi, {node_field} nf WHERE nfi.type_name="%s" AND nfi.field_name=nf.field_name', $node->type);
---
> 		$res = db_query('SELECT nfi.field_name, nfi.widget_type, nf.type FROM {node_field_instance} nfi, {node_field} nf WHERE nfi.type_name="%s" AND nfi.field_name=nf.field_name', $node->type);
358a397,400
> 			// need some way to recognize booleans later
> 			if ($row->widget_type == 'options_onoff') {
> 				$row->type = 'boolean';
> 			}
367a410
> 					$values[$sf_field] = $node->{$dp_field}[0]['value'];
370a414,418
> 					$values[$sf_field] = $node->{$dp_field}[0]['value'];
> 					break;
> 				case 'boolean':
> 					settype($node->{$dp_field}[0]['value'], 'bool');
> 					$values[$sf_field] = $node->{$dp_field}[0]['value'];
385a434,436
> 		//print_r($values);
> 		//exit('exit');
> 				
402c453,454
< 		} else {
---
> 		}
> 		else {
414c466,467
< 			} else {
---
> 			}
> 			else {
463c516
< 		$query .= " $limit";
---
> 		$query .= " WHERE $limit";
464a518
> 	
