Skip to content

Commit

Permalink
ignore deleted entries
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtlmoon committed Sep 5, 2012
1 parent 467e784 commit 99c6b8f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions uc_ascent_salesforce.module
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,19 @@ function uc_ascent_salesforce_process_jobs($sf, $parent = 0) {
}

// make sure one doesnt already exist for this order_id
if ($result = $sf->queryAll("Select PBSI__Customer__c from PBSI__PBSI_Sales_Order__c where PBSI__Customer_Purchase_Order__c = '$id'")) {
if ($result = $sf->queryAll("Select Id,isDeleted from PBSI__PBSI_Sales_Order__c where PBSI__Customer_Purchase_Order__c = '$id'")) {
if (count($result->records) != 0) {
uc_ascent_report_error($sf, 'Query SalesForce table if it already exists '.$id, "already exists! order id $id");
// mark it as complete
db_query("UPDATE {uc_sf_queue} SET q_status=1, sf_id = '%s' WHERE qid= %d ", $result, $row['qid']);
break;
// make sure we dont care about deleted records

foreach($result->records as $record) {
// if any of them are 'non deleted' then we must abort
if($record->fields->IsDeleted == 'false') {
uc_ascent_report_error($sf, 'Query SalesForce table if it already exists '.$id, "already exists! order id $id");
// mark it as complete
db_query("UPDATE {uc_sf_queue} SET q_status=1, sf_id = '%s' WHERE qid= %d ", $result, $row['qid']);
break;
}
}
}
}

Expand Down

0 comments on commit 99c6b8f

Please sign in to comment.