diff --git a/htdocs/editlog.php b/htdocs/editlog.php index b3deae8b..ce0a5936 100644 --- a/htdocs/editlog.php +++ b/htdocs/editlog.php @@ -222,7 +222,7 @@ } // ignore unauthorized team comments - if (!teamcomment_allowed($log_record['cache_id'], $log_type)) + if (!teamcomment_allowed($log_record['cache_id'], $log_type, $log_record['oc_team_comment'])) $oc_team_comment = 0; //store? @@ -289,8 +289,7 @@ $selected = ($log_record['logtype'] == $logtype ? ' selected="selected"' : ''); $logtypeoptions .= '' . "\n"; } - - if (teamcomment_allowed($log_record['cache_id'],3)) + if (teamcomment_allowed($log_record['cache_id'], 3, $log_record['oc_team_comment'])) tpl_set_var('teamcommentoption', mb_ereg_replace('{chk_sel}', ($oc_team_comment ? 'checked' : ''), $teamcomment_field)); else diff --git a/htdocs/lib/logtypes.inc.php b/htdocs/lib/logtypes.inc.php index 638cdf9e..2d16dcf0 100644 --- a/htdocs/lib/logtypes.inc.php +++ b/htdocs/lib/logtypes.inc.php @@ -109,6 +109,11 @@ $allowed_logtypes[] = 3; // note } + // always allow to keep the existing logtype when the log is edited by an admin + if ($login->hasAdminPriv(ADMIN_USER) && + $old_logtype > 0 && !in_array($old_logtype+0,$allowed_logtypes)) + $allowed_logtypes[] = $old_logtype; + return $allowed_logtypes; } @@ -119,7 +124,7 @@ } - function teamcomment_allowed($cache_id, $logtype_id) + function teamcomment_allowed($cache_id, $logtype_id, $old_teamcomment=false) { global $login, $opt; @@ -127,6 +132,8 @@ return false; elseif ($logtype_id != 3 && ($logtype_id < 9 || $logtype_id > 14)) return false; + elseif ($old_teamcomment) + return true; else { $rs = sql("SELECT `user_id`,`status` FROM `caches` WHERE `cache_id`='&1'", $cache_id);