<?php
if($this->config->inQuickon && $objectType == 'bug' && $this->app->rawModule == 'bug')
{
    $server = $this->loadModel('instance')->getSystemServer();
    if($server && (in_array($actionType, array('Resolved', 'Closed', 'Activated'))))
    {
        $bug = $this->loadModel('bug')->fetchByID($objectID);
        if($bug && $bug->issueKey)
        {
            $this->loadModel('codescan');
            if($actionType == 'Closed')    $this->codescan->changeIssueState($server->id, (int)$bug->issueKey, 'closed');
            if($actionType == 'Activated') $this->codescan->changeIssueState($server->id, (int)$bug->issueKey, 'solving', '', '');
            if($actionType == 'Resolved')  $this->codescan->changeIssueState($server->id, (int)$bug->issueKey, 'solved', $bug->resolution, $bug->resolvedDate);
        }
    }
}
