After delete relation, update field in another table
Posted: Sun Mar 21, 2010 11:16 pm
Code: Select all
function delete_related_module($module, $crmid, $with_module, $with_crmid) {
global $adb;
if(!is_array($with_crmid)) $with_crmid = Array($with_crmid);
foreach($with_crmid as $relcrmid) {
if($with_module == 'Documents') {
$adb->pquery("DELETE FROM vtiger_senotesrel WHERE crmid=? AND notesid=?",
Array($crmid, $relcrmid));
} else {
$adb->pquery("DELETE FROM vtiger_crmentityrel WHERE crmid=? AND module=? AND relcrmid=? AND relmodule=?",
Array($crmid, $module, $relcrmid, $with_module));
}
}
}I try to add following code inside else statement but no hope!
Code: Select all
$sql = 'UPDATE vtiger_troubletickets SET servicecontractsid=0 WHERE ticketid=vtiger_crmentityrel.relcrmid';
$this->db->pquery($sql, array($id));