Closed (fixed)
Project:
Salesforce Webform Data Integration
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Mar 2011 at 16:53 UTC
Updated:
19 Apr 2012 at 04:51 UTC
If you delete a webform, saleswebform should delete it's associated data.
Added a Delete to the nodeapi function:
salesforcewebform.module
/**
* Intercept operations on the webform node to assure that the SalesForce fields are tracked.
*/
function salesforcewebform_nodeapi(&$node, $op, $form = NULL, $page = NULL) {
if ( $node->type == 'webform') {
switch ($op) {
case 'insert':
case 'update':
if ( isset($node->use_salesforce) ) {
// store the SalesForce fields
$result = db_query("DELETE FROM {salesforcewebform} WHERE vid = %d", $node->vid);
$result = db_query("INSERT INTO {salesforcewebform} (vid, active, objecttype) " .
"VALUES (%d, %d,'%s')", $node->vid, $node->use_salesforce, $node->salesforce_object);
}
break;
// BEGIN NEW CODE
case 'delete':
$result = db_query("DELETE FROM {salesforcewebform} WHERE vid = %d", $node->vid);
// END NEW CODE
case 'validate':
break;
case 'load':
$result = db_query("SELECT active, objecttype FROM {salesforcewebform} ".
"WHERE vid = %d", $node->vid);
// either $result has 0 or 1 rows, if we have one then add it to the node
$row = db_fetch_array($result);
if ( $row['active'] == '1' ) {
$node->use_salesforce = TRUE;
$node->salesforce_object = $row['objecttype'];
}
else {
$node->use_salesforce = FALSE;
}
break;
}
}
}
Comments
Comment #1
chriscalip commentedComment #2
chriscalip commentedI cant help out in 2.x branch see: http://drupal.org/node/1092344
Comment #3
obsidiandesign commentedFixed in 6.x-2.x.