function workorders_insert_note($id, $user, $note, $date) { $sql = sprintf('INSERT INTO ttodo_notes (`id_todo`,`written_by`,`description`, `creation`) VALUES (%d, "%s", "%s", "%s")', $id, $user, $note, $date); $res = process_sql($sql, 'insert_id'); mail_workorder($id, 4, $res); return $res; }
if ($delete) { $id_note = get_parameter("id_note"); $note = get_db_row ("ttodo_notes", "id", $id_note); $sql = sprintf("DELETE FROM ttodo_notes WHERE id = %d", $id_note); $res = process_sql($sql); if (! $res) echo '<h3 class="error">'.__('There was a problem deleting the note').'</h3>'; else echo '<h3 class="suc">'.__('Note was deleted successfully').'</h3>'; mail_workorder ($id, 5, $res, false, $note); } $table = new StdClass(); $table->width = '100%'; $table->class = 'search-table-button'; $table->colspan = array (); $table->data = array (); $table->size = array(); $table->style = array(); $table->data[0][0] = print_textarea ('note', 10, 70, '', "style='resize:none;'", true, __('Note')); $table->data[1][0] = print_submit_button (__('Add'), 'addnote', false, 'class="sub next"', true); echo '<form method="post" action="index.php?sec=projects&sec2=operation/workorders/wo&operation=view&tab=notes&addnote=1&id='.$id.'">';
public function updateWorkOrder($id_workorder, $assigned_user, $title = "", $priority = 2, $status = 0, $category = 0, $id_task = 0, $description = "") { $system = System::getInstance(); $result = process_sql("UPDATE ttodo SET id_wo_category = {$category}, assigned_user = '******',\n\t\t\t\t\t\t\t\tpriority = {$priority}, progress = {$status}, id_task = {$id_task}, description = '{$description}',\n\t\t\t\t\t\t\t\tlast_update = '" . date('Y-m-d H:i:s') . "', name = '{$title}' WHERE id = {$id_workorder}"); if ($result) { $email_notify = get_db_value("email_notify", "ttodo", "id", $id_workorder); clean_cache_db(); if ($email_notify && (include_once $system->getConfig('homedir') . "/include/functions_workorders.php")) { mail_workorder($id_workorder, 0); } return true; } return false; }
$result=mysql_query($sql_delete); // TODO: Delete attachment from disk and database if (! $result) echo "<h3 class='error'>".__('Not deleted. Error deleting data')."</h3>"; else echo "<h3 class='suc'>".__('Successfully deleted')."</h3>"; clean_cache_db(); $email_notify = $todo["email_notify"]; if ($email_notify) { mail_workorder ($id, 3, false, $todo); } $operation = ""; } // --------------- // Set progress // --------------- if ($set_progress > -1 ) { $todo = get_db_row ("ttodo", "id", get_parameter ("id")); if (! get_workorder_acl($todo["id"])) { no_permission(); }