function addHelpDeskTaskLog() { global $AppUI, $helpdesk_available; if ($helpdesk_available && $this->file_helpdesk_item != 0) { // create task log with information about the file that was uploaded $task_log = new CHDTaskLog(); $task_log->task_log_help_desk_id = $this->_hditem->item_id; if ($this->_message != 'deleted') { $task_log->task_log_name = 'File ' . $this->file_name . ' uploaded'; } else { $task_log->task_log_name = 'File ' . $this->file_name . ' deleted'; } $task_log->task_log_description = $this->file_description; $task_log->task_log_creator = $AppUI->user_id; $date = new CDate(); $task_log->task_log_date = $date->format(FMT_DATETIME_MYSQL); if ($msg = $task_log->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR); } } return NULL; }
$hditem->notify(STATUS_LOG, $status_log_id); } } //then create/update the task log $obj = new CHDTaskLog(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } if ($obj->task_log_date) { $date = new CDate($obj->task_log_date); $obj->task_log_date = $date->format(FMT_DATETIME_MYSQL); } $AppUI->setMsg('Task Log'); $obj->task_log_costcode = $obj->task_log_costcode; if ($msg = $obj->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { $hditem->notify(TASK_LOG, $obj->task_log_id); $AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'added', UI_MSG_OK, true); } $AppUI->redirect("m=helpdesk&a=view&item_id={$item_id}&tab=0"); } else { $hditem = new CHelpDeskItem(); if (!$hditem->bind($_POST)) { $AppUI->setMsg($hditem->error, UI_MSG_ERROR); $AppUI->redirect(); } $AppUI->setMsg('Help Desk Item', UI_MSG_OK); if ($del) {