I had an error in my Order/Opportunity field map which prevented creation of the Opportunity record in Salesforce. However, the error was not correctly reported due to the code problem below:
File: uc_sf_order/uc_sf_order.module
Starting line: 757
if (!$response->success) {
drupal_set_message(t('Error exporting order to Salesforce.'), 'error');
sf_dpm($response->errors->message, 'Ubercart order error');
return FALSE;
}
When I dumped the actual $response object, it was contained:
(Array, 1 element)
0 (Object) stdClass
errors (Array, 1 element)
0 (Object) stdClass
fields (Array, 1 element)
message (String, 65 characters ) Donation Record Type: id value of incorrect typ...
Donation Record Type: id value of incorrect type: Single Donation
statusCode (String, 12 characters ) MALFORMED_ID
id (NULL)
success (Boolean) FALSE
So it appears the correct code should be:
if (!$response->success) {
drupal_set_message(t('Error exporting order to Salesforce.'), 'error');
$error_msgs = array();
foreach($response->errors as $i => $error) {
$error_msgs[] = $error->message;
}
sf_dpm(implode('; ', $error_msgs), 'Ubercart order error');
return FALSE;
}
These changes are reflected in the attached patch.txt
Comments
Comment #1
benjaminbradley commentedsame problem around line 903 (after adding the code above):
should be:
Comment #2
EvanDonovan commentedYes, this makes sense to me. The underlying issue here is that PHP toolkit changed how error reporting works.
I'll try to commit this in the next week or so.
Comment #3
EvanDonovan commentedThanks, I have a work-in-progress branch to fix this in all the places it occurs. Hopefully I'll have sorted out the issues shortly.
Comment #4
kenorb commentedComment #5
kenorb commented