From adc8a59f5762794240ef946b7aae92c4c876ec27 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 11 Feb 2007 21:27:03 +0000 Subject: [PATCH] r1393: No need to waste a query if the automation isn't even being used. --- editreport.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/editreport.php b/editreport.php index 15ce28a..170ac04 100644 --- a/editreport.php +++ b/editreport.php @@ -112,24 +112,27 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // handle automations - $automation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "automation WHERE actionid = " . $bugsys->input_clean('automation', TYPE_UINT)); - if ($automation) + if ($bugsys->in['automation']) { - $automation['fields'] = unserialize($automation['fieldchanges']); - - if (is_array($automation['fields']['builtin'])) + $automation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "automation WHERE actionid = " . $bugsys->input_clean('automation', TYPE_UINT)); + if ($automation) { - foreach ($automation['fields']['builtin'] AS $field => $value) + $automation['fields'] = unserialize($automation['fieldchanges']); + + if (is_array($automation['fields']['builtin'])) { - $bugsys->in["$field"] = $value; + foreach ($automation['fields']['builtin'] AS $field => $value) + { + $bugsys->in["$field"] = $value; + } } - } - - if (is_array($automation['fields']['custom'])) - { - foreach ($automation['fields']['custom'] AS $field => $value) + + if (is_array($automation['fields']['custom'])) { - $bugsys->in["field$field"] = $value; + foreach ($automation['fields']['custom'] AS $field => $value) + { + $bugsys->in["field$field"] = $value; + } } } } -- 2.22.5