retrieve($_REQUEST['record']); if(!$focus->ACLAccess('Delete')){ ACLController::displayNoAccess(true); sugar_cleanup(true); } if (isset($_REQUEST['object']) && $_REQUEST['object']="ecmfkvattablerevision") { //delete ecmfkvattable revision. $focus = new EcmFkVatTableRevision(); UploadFile::unlink_file($_REQUEST['revision_id'],$_REQUEST['filename']); } else { //delete ecmfkvattable and its revisions. $focus = new EcmFkVatTable(); $focus->retrieve($_REQUEST['record']); $focus->load_relationships('revisions'); $revisions= $focus->get_linked_beans('revisions','EcmFkVatTableRevision'); if (!empty($revisions) && is_array($revisions)) { foreach($revisions as $key=>$thisversion) { UploadFile::unlink_file($thisversion->id,$thisversion->filename); //mark the version deleted. $thisversion->mark_deleted($thisversion->id); } } } $focus->mark_deleted($_REQUEST['record']); header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']); ?>