Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat default relationships file. fixes #7. fixes #10 #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
150 changes: 75 additions & 75 deletions data/default_relationships.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,116 +4,116 @@
"from_object_label":"Order",
"to_object":"Contact",
"to_object_label":"Contact",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_last_name\",\"to\":\"LastName\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_first_name\",\"to\":\"FirstName\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_city\",\"to\":\"OtherCity\"},
{\"source\":\"woocommerce\",\"type\":\"phone\",\"from\":\"billing_phone\",\"to\":\"Phone\"},
{\"source\":\"woocommerce\",\"type\":\"email\",\"from\":\"billing_email\",\"to\":\"Email\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"LeadSource\",\"value\":\"Web\"}
]",
"required_sf_objects":"[{\"name\":\"Account\",\"label\":\"Account\",\"id\":\"AccountId\"}]",
"unique_sf_fields":"[\"Email\"]"
"relationships":[
{"source":"woocommerce","type":"string","from":"billing_last_name","to":"LastName"},
{"source":"woocommerce","type":"string","from":"billing_first_name","to":"FirstName"},
{"source":"woocommerce","type":"string","from":"billing_city","to":"OtherCity"},
{"source":"woocommerce","type":"phone","from":"billing_phone","to":"Phone"},
{"source":"woocommerce","type":"email","from":"billing_email","to":"Email"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"LeadSource","value":"Web"}
],
"required_sf_objects":[{"name":"Account","label":"Account","id":"AccountId"}],
"unique_sf_fields":["Email"]
},
{
"from_object":"Order",
"from_object_label":"Order",
"to_object":"Account",
"to_object_label":"Account",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_company\",\"to\":\"Name\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"Type\",\"value\":\"Customer - Channel\"},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"billing_address_1\",\"to\":\"BillingStreet\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_city\",\"to\":\"BillingCity\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_state\",\"to\":\"BillingState\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_postcode\",\"to\":\"BillingPostalCode\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_country\",\"to\":\"BillingCountry\"},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"shipping_address_1\",\"to\":\"ShippingStreet\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_city\",\"to\":\"ShippingCity\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_state\",\"to\":\"ShippingState\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_postcode\",\"to\":\"ShippingPostalCode\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_country\",\"to\":\"ShippingCountry\"},
{\"source\":\"woocommerce\",\"type\":\"phone\",\"from\":\"billing_phone\",\"to\":\"Phone\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"Industry\",\"value\":\"Other\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"Rating\",\"value\":\"Warm\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"AccountSource\",\"value\":\"Web\"}
]",
"required_sf_objects":"[]",
"unique_sf_fields":"[\"Name\"]"
"relationships":[
{"source":"woocommerce","type":"string","from":"billing_company","to":"Name"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"Type","value":"Customer - Channel"},
{"source":"woocommerce","type":"textarea","from":"billing_address_1","to":"BillingStreet"},
{"source":"woocommerce","type":"string","from":"billing_city","to":"BillingCity"},
{"source":"woocommerce","type":"string","from":"billing_state","to":"BillingState"},
{"source":"woocommerce","type":"string","from":"billing_postcode","to":"BillingPostalCode"},
{"source":"woocommerce","type":"string","from":"billing_country","to":"BillingCountry"},
{"source":"woocommerce","type":"textarea","from":"shipping_address_1","to":"ShippingStreet"},
{"source":"woocommerce","type":"string","from":"shipping_city","to":"ShippingCity"},
{"source":"woocommerce","type":"string","from":"shipping_state","to":"ShippingState"},
{"source":"woocommerce","type":"string","from":"shipping_postcode","to":"ShippingPostalCode"},
{"source":"woocommerce","type":"string","from":"shipping_country","to":"ShippingCountry"},
{"source":"woocommerce","type":"phone","from":"billing_phone","to":"Phone"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"Industry","value":"Other"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"Rating","value":"Warm"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"AccountSource","value":"Web"}
],
"required_sf_objects":[],
"unique_sf_fields":["Name"]
},
{
"from_object":"Order",
"from_object_label":"Order",
"to_object":"Order",
"to_object_label":"Order",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"date\",\"from\":\"order_date\",\"to\":\"EffectiveDate\"},
{\"source\":\"sf-picklist\",\"type\":\"picklist\",\"from\":\"salesforce\",\"to\":\"Status\",\"value\":\"Draft\"},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"custom\",\"to\":\"Description\",\"value\":null},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"billing_address_1\",\"to\":\"BillingStreet\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_city\",\"to\":\"BillingCity\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_state\",\"to\":\"BillingState\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_postcode\",\"to\":\"BillingPostalCode\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"billing_country\",\"to\":\"BillingCountry\"},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"shipping_address_1\",\"to\":\"ShippingStreet\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_city\",\"to\":\"ShippingCity\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_state\",\"to\":\"ShippingState\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"shipping_country\",\"to\":\"ShippingCountry\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"order_key\",\"to\":\"Name\"}
]",
"required_sf_objects":"[{\"name\":\"Account\",\"label\":\"Account\",\"id\":\"AccountId\"},{\"name\":\"Pricebook2\",\"label\":\"Price Book\",\"id\":\"Pricebook2Id\"}]",
"unique_sf_fields":"[\"\"]"
"relationships":[
{"source":"woocommerce","type":"date","from":"order_date","to":"EffectiveDate"},
{"source":"sf-picklist","type":"picklist","from":"salesforce","to":"Status","value":"Draft"},
{"source":"woocommerce","type":"textarea","from":"custom","to":"Description","value":null},
{"source":"woocommerce","type":"textarea","from":"billing_address_1","to":"BillingStreet"},
{"source":"woocommerce","type":"string","from":"billing_city","to":"BillingCity"},
{"source":"woocommerce","type":"string","from":"billing_state","to":"BillingState"},
{"source":"woocommerce","type":"string","from":"billing_postcode","to":"BillingPostalCode"},
{"source":"woocommerce","type":"string","from":"billing_country","to":"BillingCountry"},
{"source":"woocommerce","type":"textarea","from":"shipping_address_1","to":"ShippingStreet"},
{"source":"woocommerce","type":"string","from":"shipping_city","to":"ShippingCity"},
{"source":"woocommerce","type":"string","from":"shipping_state","to":"ShippingState"},
{"source":"woocommerce","type":"string","from":"shipping_country","to":"ShippingCountry"},
{"source":"woocommerce","type":"string","from":"order_key","to":"Name"}
],
"required_sf_objects":[{"name":"Account","label":"Account","id":"AccountId"},{"name":"Pricebook2","label":"Price Book","id":"Pricebook2Id"}],
"unique_sf_fields":[""]
},
{
"from_object":"Order Product",
"from_object_label":"Order Product",
"to_object":"Product2",
"to_object_label":"Product",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"name\",\"to\":\"Name\"},
{\"source\":\"woocommerce\",\"type\":\"string\",\"from\":\"sku\",\"to\":\"ProductCode\"},
{\"source\":\"woocommerce\",\"type\":\"textarea\",\"from\":\"description\",\"to\":\"Description\"},
{\"source\":\"custom\",\"type\":\"boolean\",\"from\":\"custom\",\"to\":\"IsActive\",\"value\":\"true\"}
]",
"required_sf_objects":"[]",
"unique_sf_fields":"[\"Name\",\"ProductCode\"]"
"relationships":[
{"source":"woocommerce","type":"string","from":"name","to":"Name"},
{"source":"woocommerce","type":"string","from":"sku","to":"ProductCode"},
{"source":"woocommerce","type":"textarea","from":"description","to":"Description"},
{"source":"custom","type":"boolean","from":"custom","to":"IsActive","value":"true"}
],
"required_sf_objects":[],
"unique_sf_fields":["Name","ProductCode"]
},
{
"from_object":"Order Product",
"from_object_label":"Order Product",
"to_object":"PricebookEntry",
"to_object_label":"Pricebook Entry",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"currency\",\"from\":\"regular_price\",\"to\":\"UnitPrice\"},
{\"source\":\"custom\",\"type\":\"boolean\",\"from\":\"custom\",\"to\":\"IsActive\",\"value\":\"true\"}
]",
"required_sf_objects":"[{\"name\":\"Pricebook2\",\"label\":\"Pricebook2\",\"id\":\"Pricebook2Id\"},{\"name\":\"Product2\",\"label\":\"Product2\",\"id\":\"Product2Id\"}]",
"unique_sf_fields":"[\"\"]"
"relationships":[
{"source":"woocommerce","type":"currency","from":"regular_price","to":"UnitPrice"},
{"source":"custom","type":"boolean","from":"custom","to":"IsActive","value":"true"}
],
"required_sf_objects":[{"name":"Pricebook2","label":"Pricebook2","id":"Pricebook2Id"},{"name":"Product2","label":"Product2","id":"Product2Id"}],
"unique_sf_fields":[""]
},
{
"from_object":"Order Product",
"from_object_label":"Order Product",
"to_object":"OrderItem",
"to_object_label":"Order Item",
"relationships":"[
{\"source\":\"woocommerce\",\"type\":\"double\",\"from\":\"qty\",\"to\":\"Quantity\"},
{\"source\":\"woocommerce\",\"type\":\"currency\",\"from\":\"sale_price\",\"to\":\"UnitPrice\"},
{\"source\":\"custom\",\"type\":\"date\",\"from\":\"custom\",\"to\":\"ServiceDate\",\"value\":\"current\"},
{\"source\":\"custom\",\"type\":\"string\",\"from\":\"custom\",\"to\":\"Description\",\"value\":\"From testing site\"}
]",
"required_sf_objects":"[{\"name\":\"PricebookEntry\",\"label\":\"PricebookEntry\",\"id\":\"PricebookEntryId\"},{\"name\":\"Order\",\"label\":\"Order\",\"id\":\"OrderId\"}]",
"unique_sf_fields":"[\"\"]"
"relationships":[
{"source":"woocommerce","type":"double","from":"qty","to":"Quantity"},
{"source":"woocommerce","type":"currency","from":"sale_price","to":"UnitPrice"},
{"source":"custom","type":"date","from":"custom","to":"ServiceDate","value":"current"},
{"source":"custom","type":"string","from":"custom","to":"Description","value":"From testing site"}
],
"required_sf_objects":[{"name":"PricebookEntry","label":"PricebookEntry","id":"PricebookEntryId"},{"name":"Order","label":"Order","id":"OrderId"}],
"unique_sf_fields":[""]
},
{
"from_object":"Order",
"from_object_label":"Order",
"to_object":"Pricebook2",
"to_object_label":"Price Book",
"relationships":"[
{\"source\":\"custom\",\"type\":\"string\",\"from\":\"custom\",\"to\":\"Name\",\"value\":\"WooCommerce price book\"},
{\"source\":\"custom\",\"type\":\"boolean\",\"from\":\"custom\",\"to\":\"IsActive\",\"value\":\"true\"}
]",
"required_sf_objects":"[]",
"unique_sf_fields":"[\"Name\"]"
"relationships":[
{"source":"custom","type":"string","from":"custom","to":"Name","value":"WooCommerce price book"},
{"source":"custom","type":"boolean","from":"custom","to":"IsActive","value":"true"}
],
"required_sf_objects":[],
"unique_sf_fields":["Name"]
}
]
4 changes: 2 additions & 2 deletions neuralab-woocommerce-salesforce-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public static function install() {
if ( !empty( $relationships ) ) {
foreach( $relationships as $relationship ) {
$db->save_new_relationship( $relationship->from_object, $relationship->from_object_label,
$relationship->to_object, $relationship->to_object_label, $relationship->relationships,
$relationship->required_sf_objects, $relationship->unique_sf_fields );
$relationship->to_object, $relationship->to_object_label, json_encode( $relationship->relationships ),
json_encode( $relationship->required_sf_objects ), json_encode( $relationship->unique_sf_fields ) );
}
}
}
Expand Down