/** * Here we override the parent's method * This is done because the related lists for this module use a custom query * that queries the child module's table (column of the uitype10 field) * * @see data/CRMEntity#delete_related_module($module, $crmid, $with_module, $with_crmid) */ function delete_related_module($module, $crmid, $with_module, $with_crmid) { if (!in_array($with_module, array('ProjectMilestone', 'ProjectTask'))) { parent::delete_related_module($module, $crmid, $with_module, $with_crmid); return; } $destinationModule = vtlib_purify($_REQUEST['destination_module']); if (!is_array($with_crmid)) { $with_crmid = array($with_crmid); } foreach ($with_crmid as $relcrmid) { $child = CRMEntity::getInstance($destinationModule); $child->retrieve_entity_info($relcrmid, $destinationModule); $child->mode = 'edit'; $child->column_fields['projectid'] = ''; $child->save($destinationModule, $relcrmid); } }
/** * Handle deleting related module information. * NOTE: This function has been added to CRMEntity (base class). * You can override the behavior by re-defining it here. */ function delete_related_module($module, $crmid, $with_module, $with_crmid) { parent::delete_related_module($module, $crmid, $with_module, $with_crmid); if ($with_module == 'HelpDesk') { $this->updateServiceContractState($crmid); } }
function delete_related_module($module, $crmid, $with_module, $with_crmid) { global $log, $adb; if ($with_module == 'Contacts') { if (!is_array($with_crmid)) { $with_crmid = array($with_crmid); } $data = array(); $data['sourceModule'] = $module; $data['sourceRecordId'] = $crmid; $data['destinationModule'] = $with_module; foreach ($with_crmid as $relcrmid) { $data['destinationRecordId'] = $relcrmid; cbEventHandler::do_action('corebos.entity.link.delete', $data); $adb->pquery('DELETE FROM vtiger_vendorcontactrel WHERE vendorid=? AND contactid=?', array($crmid, $relcrmid)); } } else { parent::delete_related_module($module, $crmid, $with_module, $with_crmid); } }