Ejemplo n.º 1
0
/**
 * Reopens an incident
 * @param int $incident incident ID to reopen
 * @param int $newstatus (optional) status to set the incident to, defaults to active
 * @param string $message (optional) message to insert when reopening
 * @return bool TRUE on success, FALSE on failure$dbIncidents
 * @author Kieran Hogg
 */
function reopen_incident($incident, $newstatus = STATUS_ACTIVE, $message = '')
{
    global $dbIncidents, $dbUpdates, $now, $sit, $bodytext;
    $rtn = TRUE;
    $time = time();
    $sql = "UPDATE `{$dbIncidents}` SET status='{$newstatus}', ";
    $sql .= "lastupdated='{$time}', closed='0' WHERE id='{$incident}' LIMIT 1";
    mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $owner = incident_owner($incident);
    // add update
    $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, ";
    $sql .= "bodytext, timestamp, currentowner, currentstatus) ";
    $sql .= "VALUES ({$incident}, '{$sit[2]}', 'reopening', '{$bodytext}', '{$time}', ";
    $sql .= "'{$owner}', '{$newstatus}')";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_ERROR);
        $rtn = FALSE;
    }
    // Insert the first SLA update for the reopened incident, this indicates
    // the start of an sla period
    // This insert could possibly be merged with another of the 'updates'
    // records, but for now we keep it seperate for clarity
    $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, ";
    $sql .= "timestamp, currentowner, currentstatus, customervisibility, ";
    $sql .= "sla, bodytext) ";
    $sql .= "VALUES ('{$incident}', '{$sit[2]}', 'slamet', '{$now}', '{$owner}', ";
    $sql .= STATUS_ACTIVE . ", 'show', 'opened','{$GLOBALS['strIncidentIsOpen']}')";
    mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_ERROR);
        $rtn = FALSE;
    }
    // Insert the first Review update, this indicates the review period of an incident has restarted
    // This insert could possibly be merged with another of the 'updates' records, but for now we keep it seperate for clarity
    $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
    $sql .= "VALUES ('{$incident}', '0', 'reviewmet', '{$now}', '{$owner}', " . STATUS_ACTIVE . ", 'hide', 'opened','')";
    mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_ERROR);
        $rtn = FALSE;
    }
    return $rtn;
}
Ejemplo n.º 2
0
 $fifteenminsago = $now - 900;
 $sql = "SELECT bodytext FROM `{$dbUpdates}` ";
 $sql .= "WHERE incidentid = '{$incidentid}' AND timestamp > '{$fifteenminsago}' ";
 $sql .= "ORDER BY id DESC LIMIT 1";
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_WARNING);
 }
 if (mysql_num_rows($result) > 0) {
     list($lastupdate) = mysql_fetch_row($result);
     $newtext = "{$headertext}<hr>{$message}";
     if (strcmp(trim($lastupdate), trim($newtext)) == 0) {
         $error = 1;
     }
 }
 $owner = incident_owner($incidentid);
 if ($error != 1) {
     // Existing incident, new update:
     // Add entry to the incident update log
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, bodytext, timestamp, customervisibility, currentowner, currentstatus) ";
     $sql .= "VALUES ('{$incidentid}', 0, 'emailin', '{$bodytext}', '{$now}', '{$customer_visible}', '{$owner}', 1 )";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_WARNING);
     }
     $updateid = mysql_insert_id();
     if ($incident_open) {
         // Mark the incident as active
         $sql = "UPDATE `{$GLOBALS['dbIncidents']}` SET status='1', lastupdated='" . time() . "', timeofnextaction='0' ";
         $sql .= "WHERE id='{$incidentid}'";
         mysql_query($sql);
Ejemplo n.º 3
0
/**
    * Update page
*/
function display_update_page($draftid = -1)
{
    global $id;
    global $incidentid;
    global $action;
    global $CONFIG;
    global $iconset;
    global $now;
    global $dbDrafts;
    global $sit;
    if ($draftid != -1) {
        $draftsql = "SELECT * FROM `{$dbDrafts}` WHERE id = {$draftid}";
        $draftresult = mysql_query($draftsql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        $draftobj = mysql_fetch_object($draftresult);
        $metadata = explode("|", $draftobj->meta);
    }
    // No update body text detected show update form
    ?>
    <script type="text/javascript">
    <!--
    function deleteOption(object) {
        var Current = object.updatetype.selectedIndex;
        object.updatetype.options[Current] = null;
    }

    function notarget(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        object.priority.value=object.storepriority.value;
        //object.priority.disabled=true;
        object.priority.disabled=false;
        object.updatetype.selectedIndex=0;
        object.updatetype.disabled=false;
    }


    function initialresponse(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.selectedIndex=0;
        object.updatetype.disabled=false;
    }


    function actionplan(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }

        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Action Plan', 'actionplan', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.disabled=true;
    }

    function reprioritise(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }
        // add new option
        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Reprioritise', 'solution', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.disabled=false;
        document.updateform.priority.disabled=false;
        object.updatetype.disabled=true;
    }

    function probdef(object)
    {
        // remove last option
        var length = object.updatetype.length;
        if (length > 6)
        {
            object.updatetype.selectedIndex=6;
            var Current = object.updatetype.selectedIndex;
            object.updatetype.options[Current] = null;
        }

        var defaultSelected = true;
        var selected = true;
        var optionName = new Option('Problem Definition', 'probdef', defaultSelected, selected)
        var length = object.updatetype.length;
        object.updatetype.options[length] = optionName;
        object.priority.value=object.storepriority.value;
        object.priority.disabled=true;
        object.updatetype.disabled=true;
    }

    function replaceOption(object) {
        var Current = object.updatetype.selectedIndex;
        object.updatetype.options[Current].text = object.currentText.value;
        object.updatetype.options[Current].value = object.currentText.value;
    }

    <?php 
    echo "var draftid = {$draftid}";
    ?>

    // Auto save
    function save_content(){
        var xmlhttp=false;

        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp=false;
            }
        }
        if (!xmlhttp && window.createRequest) {
            try {
                xmlhttp = window.createRequest();
            } catch (e) {
                xmlhttp=false;
            }
        }

        var toPass = $('updatelog').value;
        //alert(toPass.value);

        var meta = $('target').value+"|"+$('updatetype').value+"|"+$('cust_vis').checked+"|";
        meta += $('priority').value+"|"+$('newstatus').value+"|"+$('nextaction').value+"|";

        if (toPass != '')
        {
            // xmlhttp.open("GET", "ajaxdata.php?action=auto_save&userid="+<?php 
    echo $_SESSION['userid'];
    ?>
+"&type=update&incidentid="+<?php 
    echo $id;
    ?>
+"&draftid="+draftid+"&meta="+meta+"&content="+escape(toPass), true);
            var url = "ajaxdata.php";
            var params = "action=auto_save&userid="+<?php 
    echo $_SESSION['userid'];
    ?>
+"&type=update&incidentid="+<?php 
    echo $id;
    ?>
+"&draftid="+draftid+"&meta="+meta+"&content="+escape(toPass);
            xmlhttp.open("POST", url, true)
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.setRequestHeader("Content-length", params.length);
            xmlhttp.setRequestHeader("Connection", "close");

            xmlhttp.onreadystatechange=function() {
                //remove this in the future after testing
                if (xmlhttp.readyState==4) {
                    if (xmlhttp.responseText != ''){
                        //alert(xmlhttp.responseText);
                        if (draftid == -1)
                        {
                            draftid = xmlhttp.responseText;
                            $('draftid').value = draftid;
                        }
                        var currentTime = new Date();
                        var hours = currentTime.getHours();
                        var minutes = currentTime.getMinutes();
                        if (minutes < 10)
                        {
                            minutes = "0"+minutes;
                        }
                        var seconds = currentTime.getSeconds();
                        if (seconds < 10)
                        {
                            seconds = "0"+seconds;
                        }
                        $('updatestr').innerHTML = '<?php 
    echo "<a href=\"javascript:save_content();\">" . icon('save', 16, $GLOBALS['strSaveDraft']) . "</a> " . icon('info', 16, $GLOBALS['strDraftLastSaved']) . " ";
    ?>
' + hours + ':' + minutes + ':' + seconds;
                    }
                }
            }
            xmlhttp.send(params);
        }
    }

    setInterval("save_content()", 10000); //every 10 seconds

    //-->
    </script>
    <?php 
    echo show_form_errors('update');
    clear_form_errors('update');
    //echo "<form action='".$_SERVER['PHP_SELF']."?id={$id}&amp;draftid={$draftid}' method='post' name='updateform' id='updateform' enctype='multipart/form-data'>";
    echo "<form action='" . $_SERVER['PHP_SELF'] . "?id={$id}' method='post' name='updateform' id='updateform' enctype='multipart/form-data'>";
    echo "<table class='vertical'>";
    echo "<tr>";
    echo "<th align='right' width='20%;'>{$GLOBALS['strSLATarget']}";
    echo icon('sla', 16) . "</th>";
    echo "<td class='shade2'>";
    $target = incident_get_next_target($id);
    $targetNone = '';
    $targetInitialresponse = '';
    $targetProbdef = '';
    $targetActionplan = '';
    $targetSolution = '';
    $typeResearch = '';
    $typeEmailin = '';
    $typeEmailout = '';
    $typePhonecallin = '';
    $typePhonecallout = '';
    $typeExternalinfo = '';
    $typeReviewmet = '';
    if (!empty($metadata)) {
        switch ($metadata[0]) {
            case 'none':
                $targetNone = " SELECTED ";
                break;
            case 'initialresponse':
                $targetInitialresponse = " SELECTED ";
                break;
            case 'probdef':
                $targetProbdef = " SELECTED ";
                break;
            case 'actionplan':
                $targetActionplan = " SELECTED ";
                break;
            case 'solution':
                $targetSolution = " SELECTED ";
                break;
        }
        switch ($metadata[1]) {
            case 'research':
                $typeResearch = " SELECTED ";
                break;
            case 'emailin':
                $typeEmailin = " SELECTED ";
                break;
            case 'emailout':
                $typeEmailout = " SELECTED ";
                break;
            case 'phonecallin':
                $typePhonecallin = " SELECTED ";
                break;
            case 'phonecallout':
                $typePhonecallout = " SELECTED ";
                break;
            case 'externalinfo':
                $typeExternalinfo = " SELECTED ";
                break;
            case 'reviewmet':
                $typeReviewmet = " SELECTED ";
                break;
        }
    }
    echo "<select name='target' id='target' class='dropdown'>\n";
    echo "<option value='none' {$targetNone} onclick='notarget(this.form)'>{$GLOBALS['strNone']}</option>\n";
    switch ($target->type) {
        case 'initialresponse':
            echo "<option value='initialresponse' {$targetInitialresponse} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/initialresponse.png); background-repeat: no-repeat;' onclick='initialresponse(this.form)' >{$GLOBALS['strInitialResponse']}</option>\n";
            echo "<option value='probdef' {$targetProbdef} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/probdef.png); background-repeat: no-repeat;' onclick='probdef(this.form)'>{$GLOBALS['strProblemDefinition']}</option>\n";
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'probdef':
            echo "<option value='probdef' {$targetProbdef} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/probdef.png); background-repeat: no-repeat;' onclick='probdef(this.form)'>{$GLOBALS['strProblemDefinition']}</option>\n";
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'actionplan':
            echo "<option value='actionplan' {$targetActionplan} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/actionplan.png); background-repeat: no-repeat;' onclick='actionplan(this.form)'>{$GLOBALS['strActionPlan']}</option>\n";
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
        case 'solution':
            echo "<option value='solution' {$targetSolution} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/solution.png); background-repeat: no-repeat;' onclick='reprioritise(this.form)'>{$GLOBALS['strResolutionReprioritisation']}</option>\n";
            break;
    }
    echo "</select>\n";
    echo "</td></tr>\n";
    echo "<tr><th align='right'>{$GLOBALS['strUpdateType']}</th>";
    echo "<td class='shade1'>";
    echo "<select name='updatetype' id='updatetype' class='dropdown'>";
    /*
    if ($target->type!='actionplan' && $target->type!='solution')
        echo "<option value='probdef'>Problem Definition</option>\n";
    if ($target->type!='solution')
        echo "<option value='actionplan'>Action Plan</option>\n";
    */
    echo "<option value='research' {$typeResearch} selected='selected' style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/research.png); background-repeat: no-repeat;'>{$GLOBALS['strResearchNotes']}</option>\n";
    echo "<option value='emailin' {$typeEmailin} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/emailin.png); background-repeat: no-repeat;'>{$GLOBALS['strEmailFromCustomer']}</option>\n";
    echo "<option value='emailout' {$typeEmailout} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/emailout.png); background-repeat: no-repeat;'>{$GLOBALS['strEmailToCustomer']}</option>\n";
    echo "<option value='phonecallin' {$typePhonecallin} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/callin.png); background-repeat: no-repeat;'>{$GLOBALS['strCallFromCustomer']}</option>\n";
    echo "<option value='phonecallout' {$typePhonecallout} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/callout.png); background-repeat: no-repeat;'>{$GLOBALS['strCallToCustomer']}</option>\n";
    echo "<option value='externalinfo' {$typeExternalinfo} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/externalinfo.png); background-repeat: no-repeat;'>{$GLOBALS['strExternalInfo']}</option>\n";
    echo "<option value='reviewmet' {$typeReviewmet} style='text-indent: 15px; height: 17px; background-image: url({$CONFIG['application_webpath']}images/icons/{$iconset}/16x16/review.png); background-repeat: no-repeat;'>{$GLOBALS['strReview']}</option>\n";
    echo "</select>";
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strUpdate']}<br />";
    echo "<span class='required'>{$GLOBALS['strRequired']}</span></th>";
    echo "<td class='shade1'>";
    $checkbox = '';
    if (!empty($metadata)) {
        if ($metadata[2] == "true") {
            $checkbox = "checked='checked'";
        }
    } else {
        $checkbox = "checked='checked'";
    }
    echo "<label><input type='checkbox' name='cust_vis' id='cust_vis' ";
    echo "{$checkbox} value='yes' /> {$GLOBALS['strMakeVisibleInPortal']}<label><br />";
    echo bbcode_toolbar('updatelog');
    echo "<textarea name='bodytext' id='updatelog' rows='13' cols='50'>";
    if ($draftid != -1) {
        echo $draftobj->content;
    }
    echo "</textarea>";
    echo "<div id='updatestr'><a href='javascript:save_content();'>" . icon('save', 16, $GLOBALS['strSaveDraft']) . "</a></div>";
    echo "</td></tr>";
    if ($target->type == 'initialresponse') {
        $disable_priority = TRUE;
    } else {
        $disable_priority = FALSE;
    }
    echo "<tr><th align='right'>{$GLOBALS['strNewPriority']}</th>";
    echo "<td class='shade1'>";
    //    // FIXME fix maximum priority
    //    $servicelevel=maintenance_servicelevel(incident_maintid($id));
    //    if ($servicelevel == 2 || $servicelevel == 5) $maxpriority = 4;
    //    else $maxpriority = 3;
    $maxpriority = 4;
    $setPriorityTo = incident_priority($id);
    if (!empty($metadata)) {
        $setPriorityTo = $metadata[3];
    }
    echo priority_drop_down("newpriority", $setPriorityTo, $maxpriority, $disable_priority);
    //id='priority
    echo "</td></tr>\n";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strNewStatus']}</th>";
    $setStatusTo = incident_status($id);
    $disabled = FALSE;
    //we do this so if you update another user's incident, it defaults to active
    if ($sit[2] != incident_owner($incidentid)) {
        $setStatusTo = '0';
    } elseif (!empty($metadata)) {
        $setStatusTo = $metadata[4];
    }
    echo "<td class='shade1'>" . incidentstatus_drop_down("newstatus", $setStatusTo) . "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<th align='right'>{$GLOBALS['strNextAction']}</th>";
    $nextAction = '';
    if (!empty($metadata)) {
        $nextAction = $metadata[5];
    }
    echo "<td class='shade2'><input type='text' name='nextaction' ";
    echo "id='nextaction' maxlength='50' size='30' value='{$nextAction}' /></td></tr>";
    echo "<tr>";
    echo "<th align='right'>";
    echo "<strong>{$GLOBALS['strTimeToNextAction']}</strong></th>";
    echo "<td class='shade2'>";
    echo show_next_action();
    echo "</td></tr>";
    echo "<tr>";
    // calculate upload filesize
    $att_file_size = readable_file_size($CONFIG['upload_max_filesize']);
    echo "<th align='right'>{$GLOBALS['strAttachFile']}";
    echo " (&lt;{$att_file_size})</th>";
    echo "<td class='shade1'><input type='hidden' name='MAX_FILE_SIZE' value='{$CONFIG['upload_max_filesize']}' />";
    echo "<input type='file' name='attachment' size='40' maxfilesize='{$CONFIG['upload_max_filesize']}' /></td>";
    echo "</tr>";
    echo "</table>";
    echo "<p class='center'>";
    echo "<input type='hidden' name='action' value='update' />";
    if ($draftid == -1) {
        $localdraft = '';
    } else {
        $localdraft = $draftid;
    }
    echo "<input type='hidden' name='draftid' id='draftid' value='{$localdraft}' />";
    echo "<input type='hidden' name='storepriority' value='" . incident_priority($id) . "' />";
    echo "<input type='submit' name='submit' value='{$GLOBALS['strUpdateIncident']}' /></p>";
    echo "</form>";
}
Ejemplo n.º 4
0
        echo " {$strClosureRequestForIncident} {$_REQUEST['id']}</h2>";
        echo "<div id='update' align='center'><form action='{$_SERVER[PHP_SELF]}?page=close&amp;id={$id}' method='post'>";
        echo "<p>{$strReason}:</p><textarea name='reason' cols='50' rows='10'></textarea><br />";
        echo "<p><input type='submit' value=\"{$strRequestClosure}\" /></p></form></div>";
        include APPLICATION_INCPATH . 'htmlfooter.inc.php';
    } else {
        $usersql = "SELECT forenames, surname FROM `{$dbContacts}` WHERE id={$_SESSION['contactid']}";
        $result = mysql_query($usersql);
        $user = mysql_fetch_object($result);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
        }
        // FIXME i18n ? In db ?
        $reason = "Incident closure requested via the portal by [b]{$user->forenames} {$user->surname}[/b]\n\n";
        $reason .= "<b>{$SYSLANG['strReason']}:</b> " . cleanvar($_REQUEST['reason']);
        $owner = incident_owner($_REQUEST['id']);
        $sql = "INSERT into `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp, customervisibility) ";
        $sql .= "VALUES('{$_REQUEST['id']}', '0', 'customerclosurerequest',  '{$owner}', '1', '{$reason}',\n        '{$now}', 'show')";
        mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
        }
        //set incident back to active
        $sql = "UPDATE `{$dbIncidents}` SET status=" . STATUS_ACTIVE . ", lastupdated={$now} WHERE id={$id}";
        mysql_query($sql);
        if (mysql_error()) {
            trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
        }
        html_redirect("index.php");
    }
} else {
Ejemplo n.º 5
0
require 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
require_once APPLICATION_LIBPATH . 'billing.inc.php';
// This page requires authentication
require APPLICATION_LIBPATH . 'auth.inc.php';
// External variables
$incidentid = cleanvar($_REQUEST['id']);
$id = $incidentid;
if ($_REQUEST['win'] == 'incomingview') {
    $title = 'Incoming';
    $incidentid = '';
    include APPLICATION_INCPATH . 'incident_html_top.inc.php';
    include APPLICATION_INCPATH . 'incident_incoming.inc.php';
    exit;
} elseif ($_REQUEST['win'] == 'jump') {
    if (incident_owner($incidentid) > 0) {
        echo "<html><head>";
        echo "<script src='{$CONFIG['application_webpath']}scripts/prototype/prototype.js' type='text/javascript'></script>\n";
        echo "<script src='{$CONFIG['application_webpath']}scripts/webtrack.js' type='text/javascript'></script>\n";
        if (!empty($_GET['return'])) {
            $return = cleanvar($_GET['return']);
            echo "</head><body onload=\"\"><a href=\"{$return}\">{$strPleaseWaitRedirect}</a>";
            echo "<script type='text/javascript'>\n//<![CDATA[\n";
            echo "var popwin = incident_details_window({$incidentid},'win', true);\n";
            echo "if (!popwin) alert('{$strDidYourBrowserBlockPopupWindow}');\n";
            echo "else window.location='{$return}';\n";
            echo "\n//]]>\n</script>\n";
            echo "</body></html>";
        } else {
            // echo "</head><body onload=\"incident_details_window($incidentid,'win');window.location='{$_SERVER['HTTP_REFERER']}';\">{$strPleaseWaitRedirect}</body></html>";
            echo "</head><body onload=\"\"><a href=\"{$_SERVER['HTTP_REFERER']}\"{$strPleaseWaitRedirect}</a>";
Ejemplo n.º 6
0
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_ERROR);
 }
 $enddate = $now;
 $duration = round(($enddate - $startdate) / 60);
 $startdate = readable_date($startdate, 'system');
 $enddate = readable_date($enddate, 'system');
 $updatehtml = sprintf($SYSLANG['strActivityStarted'], $startdate) . "\n\n";
 for ($i = $numnotes - 1; $i >= 0; $i--) {
     $updatehtml .= "[b]";
     $updatehtml .= readable_date(mysql2date($notesarray[$i]->timestamp), 'system');
     $updatehtml .= "[/b]\n" . mysql_escape_string($notesarray[$i]->bodytext) . "\n\n";
 }
 $updatehtml .= sprintf($SYSLANG['strActivityCompleted'], $enddate, $duration);
 $owner = incident_owner($incident);
 //create update
 $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, ";
 $sql .= "currentowner, currentstatus, bodytext, timestamp, duration) ";
 $sql .= "VALUES('{$incident}', '{$sit[2]}', 'fromtask', ";
 $sql .= "'{$owner}', '{$status}', '{$updatehtml}', '{$now}', '{$duration}')";
 mysql_query($sql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_ERROR);
     echo "<p class='error'>";
     echo "Couldn't add update, update will need to be done manually: {$sql}'</p>";
     die;
 }
 $sql = "UPDATE `{$dbIncidents}` SET lastupdated = '{$now}', status = 1 WHERE id = {$incident}";
 $result = mysql_query($sql);
 if (mysql_error()) {
     }
     break;
 case 'delete':
     // Retrieve details of the relationship
     $sql = "SELECT * FROM `{$dbRelatedIncidents}` WHERE id='{$rid}'";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
     }
     $relation = mysql_fetch_object($result);
     $sql = "DELETE FROM `{$dbRelatedIncidents}` WHERE id='{$rid}'";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     $onwer = incident_owner($id);
     $status = incident_status($id);
     // Insert an entry into the update log for this incident
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
     $sql .= "VALUES ('{$relation->incidentid}', '{$sit[2]}', 'editing', '{$now}', '{$owner}', '{$status}', 'hide', '','Removed relationship with Incident {$relation->relatedid}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     // Insert an entry into the update log for the related incident
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
     $sql .= "VALUES ('{$relation->relatedid}', '{$sit[2]}', 'editing', '{$now}', '{$owner}', '{$status}', 'hide', '','Removed relationship with Incident {$relation->incidentid}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
 // Check if we had an error whilst uploading
 if ($_FILES['attachment']['error'] != '' and $_FILES['attachment']['error'] != UPLOAD_ERR_OK) {
     echo get_file_upload_error_message($_FILES['attachment']['error'], $_FILES['attachment']['name']);
 } else {
     // OK to proceed
     // Create an entry in the files table
     $sql = "INSERT INTO `{$dbFiles}` (category, filename, size, userid, usertype, filedate) ";
     $sql .= "VALUES ('public', '{$_FILES['attachment']['name']}', '{$_FILES['attachment']['size']}', '{$sit[2]}', 'user', NOW())";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     $fileid = mysql_insert_id();
     //create update
     $updatetext = $SYSLANG['strFileUploaded'] . ": [[att={$fileid}]]{$_FILES['attachment']['name']}[[/att]]";
     $currentowner = incident_owner($incidentid);
     $currentstatus = incident_status($incidentid);
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, `type`, `currentowner`, `currentstatus`, ";
     $sql .= "bodytext, `timestamp`) ";
     $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'research', '{$currentowner}', '{$currentstatus}', ";
     $sql .= "'{$updatetext}', '{$now}')";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     $updateid = mysql_insert_id();
     $incident_attachment_fspath = $CONFIG['attachment_fspath'] . $fsdelim . $incidentid . $fsdelim;
     // make incident attachment dir if it doesn't exist
     $newfilename = $incident_attachment_fspath . $fsdelim . $fileid . "-" . $_FILES['attachment']['name'];
     $umask = umask(00);
     $mk = TRUE;