From 2ba3aa6f5bf78a987828ddb9df6841de2864b262 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 2 Jul 2005 15:21:47 +0000 Subject: [PATCH] r274: Added initial comments to the auto action system --- admin/autoaction.php | 8 +++++--- docs/schema_changes.sql | 4 +++- editreport.php | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/admin/autoaction.php b/admin/autoaction.php index 556582f..da70d2b 100644 --- a/admin/autoaction.php +++ b/admin/autoaction.php @@ -86,10 +86,10 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') { $db->query(" INSERT INTO " . TABLE_PREFIX . "autoaction - (name, description, fieldchanges) + (name, description, fieldchanges, comment) VALUES ('" . $bugsys->in['name'] . "', '" . $bugsys->in['description'] . "', - '" . $bugsys->escape(serialize($deltas)) . "' + '" . $bugsys->escape(serialize($deltas)) . "', '" . $bugsys->in['comment'] . "' )" ); @@ -106,7 +106,8 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') UPDATE " . TABLE_PREFIX . "autoaction SET name = '" . $bugsys->in['name'] . "', description = '" . $bugsys->in['description'] . "', - fieldchanges = '" . $bugsys->escape(serialize($deltas)) . "' + fieldchanges = '" . $bugsys->escape(serialize($deltas)) . "', + comment = '" . $bugsys->in['comment'] . "' WHERE actionid = " . intval($bugsys->in['actionid']) ); @@ -145,6 +146,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $admin->row_input('Name', 'name', $action['name']); $admin->row_textarea('Description', 'description', $action['description']); + $admin->row_textarea('Add Comment', 'comment', $action['comment']); $admin->row_span('Field Changes', 'thead', 'center'); diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index a471528..ac1c332 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -78,4 +78,6 @@ CREATE TABLE `autoaction` ( `description` MEDIUMTEXT NOT NULL, `fieldchanges` MEDIUMTEXT NOT NULL, PRIMARY KEY (`actionid`) -); \ No newline at end of file +); + +ALTER TABLE `autoaction` ADD `comment` MEDIUMTEXT NOT NULL; \ No newline at end of file diff --git a/editreport.php b/editreport.php index 2da1a2c..7eb8b94 100644 --- a/editreport.php +++ b/editreport.php @@ -97,6 +97,8 @@ if ($_POST['do'] == 'update') $dependencies = preg_split('#([^0-9].*?)#', $bugsys->in['dependency'], -1, PREG_SPLIT_NO_EMPTY); $dependencies = ((count($dependencies) < 1) ? '' : implode(', ', $dependencies)); + // #*# need to put in permission checks here because we do not show the fields the user has no permission to change in the edit section so they'll be blank on update + $db->query(" UPDATE " . TABLE_PREFIX . "bug SET summary = '" . $bugsys->in['summary'] . "', @@ -229,6 +231,37 @@ if ($_POST['do'] == 'update') WHERE commentid = $firstcomment[commentid]" ); + // ------------------------------------------------------------------- + // auto action comment + + if ($autoaction['comment']) + { + $comment = $autoaction['comment']; + if (!$bugsys->options['allowhtml']) + { + $comment_parsed = $bugsys->sanitize($comment); + } + + $db->query(" + INSERT INTO comment + (bugid, userid, dateline, comment, comment_parsed) + VALUES + ($bug[bugid], " . $bugsys->userinfo['userid'] . ", " . LOG_TIME . ", + '" . $bugsys->escape($comment) . "', + '" . $bugsys->escape($comment_parsed) . "' + )" + ); + + $db->query(" + UPDATE " . TABLE_PREFIX . "bug + SET lastposttime = " . LOG_TIME . ", + lastpostby = " . $bugsys->userinfo['userid'] . ", + hiddenlastposttime = " . LOG_TIME . ", + hiddenlastpostby = " . $bugsys->userinfo['userid'] . " + WHERE bugid = $bug[bugid]" + ); + } + $message->redirect('done with update bug', "showreport.php?bugid=$bug[bugid]"); } -- 2.22.5