Menu

#24 PARSER: Set Severity based on email priority

4.0.3
open
nobody
5
2004-05-21
2004-05-21
No

I liked to add this nice feature. Maybe someone else
finds it usefull....

The email parser always sets the severity of new issues
to normal. With this patch, it derives the severity from
the email's priority the sender set in the email client
(standard headers Priority or X-Priority).

Put this before "// Ok now we actually create...":

// Define Severity based on Priority of email
if ($parser->headers['x-priority']) { // e.g. "1 (highest)"
$severity = substr($parser->headers['x-
priority'],0,1);
if ($severity > 4) {
$severity = 4; // lowest severity in issue tracker
}
} else if (strstr($parser->headers['priority'],"urgent")) {
$severity = 1;
} else {
$severity = 3; // set normal
}

Replace this line:
$insert['severity'] = SEV_NORMAL;
with this:
$insert['severity'] = $severity;

If you want to let users change severity with updates in
the same way, do these changes:

// Check to see if severity was given
# if (!empty($parser->args['severity'])) {
# $severity = array_search(ucwords($parser->args
['severity']));
if (!empty($severity)) {
if ($severity != $issue['severity']) {
$update['severity'] = $severity;
issue_log(
$parser->args['issue'],
# "Severity changed to {$parser->args
['severity']}",
"Severity changed to {$severity}",
FALSE,
!empty($userid) ? $userid : _PARSER_
);
}
}
# }

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.