} elseif (tool::securePost('action') == "save") { // start job $jobInst->fill(tool::securePostAll()); $jobInst->taskId = $taskInst->id; $jobInst->start = $toolInst->timestampToSec(tool::securePost('startyear'), tool::securePost('startmonth'), tool::securePost('startday'), tool::securePost('starthour'), tool::securePost('startmin')); $saveflags = 0; // handle job flags if (tool::securePost('privatejob') == "1") { $saveflags += JOB_FLAG_PRIVATE; } $jobInst->flags = $saveflags; $jobId = $jobInst->start(); $jobInst->activate($jobId); } elseif (tool::securePost('action') == "deleteattach") { $attachment = new attachment(tool::securePost('id')); $attachment->delete(); // we need to reload the task to clear the attachment member in this object $taskInst->activate($taskInst->id); } if (tool::securePost('action') == "delete") { $jobInst->activate(tool::securePost('id')); $jobInst->delete(); } if (tool::securePost('action') == "edit") { $status = 1; $jobInst->activate(tool::securePost('id')); } ####################################################################### ## show task details ?>
function delete() { global $dbInst, $loginInst, $toolInst; if (!$loginInst->hasAccess("request.delete")) { return false; } if (!$this->id) { $toolInst->errorStatus("no record selected"); return false; } $this->activate($this->id); $result = $dbInst->query("delete from " . $dbInst->config['table_request'] . " where id = '" . $this->id . "'"); $dbInst->status($result[1], "d"); // delete all assigned attachments while ($element = current($this->attachments)) { $attachment = new attachment($element); $attachment->delete(); next($this->attachments); } // logging $projectInst = new project($this->projectId); $this->logger->warn("deleted request (" . $this->subject . ") for project " . $projectInst->name); return true; }