Esempio n. 1
0
    show_dashboard_component(0, $a);
}
echo "</td><td width=\"33%\" valign='top' id='col1'>";
$arr = explode(",", $cols1);
foreach ($arr as $a) {
    show_dashboard_component(1, $a);
}
echo "</td><td width=\"33%\" valign=\"top\" id='col2'>";
$arr = explode(",", $cols2);
foreach ($arr as $a) {
    show_dashboard_component(2, $a);
}
echo "</td></tr></table>\n";
//  Users Login Details
echo "<div id='userbar'>";
if (user_accepting($sit[2]) != 'Yes') {
    $userstatus = "<span class='error'>{$strNotAcceptingIncidents}</span>";
} else {
    $userstatus = "<strong>{$strAcceptingIncidents}</strong>";
}
echo sprintf($strLoggedInAsXAndCurrentlyXAndX, "<strong>{$sit[0]}</strong>", "<strong>" . userstatus_name(user_status($sit[2])) . "</strong>", $userstatus);
if ($sit[3] == 'public') {
    echo "- {$strPublicSharedComputerIncreasedSecurity}";
}
echo "</div>\n";
?>
<script type="text/javascript">
/* <![CDATA[ */
//var cols = [1,3,1];
var cols = [<?php 
echo $colstr;
Esempio n. 2
0
/**
 * Switches incidents temporary owners to the backup/substitute engineer depending on the setting of 'accepting'
 * @author Ivan Lucas
 * @param int $userid. The userid of the user who's status has changed.
 * @param string $accepting. 'yes' or 'no' to indicate whether the user is accepting
 * @note if the $accepting parameter is 'no' then the function will attempt to temporarily assign
 * all the open incidents that the user owns to the users defined substitute engineers
 * If Substitute engineers cannot be found or they themselves are not accepting, the given users incidents
 * are placed in the holding queue
 */
function incident_backup_switchover($userid, $accepting)
{
    global $now, $dbIncidents, $dbUpdates, $dbTempAssigns, $dbUsers, $dbUserStatus;
    $usersql = "SELECT u.*, us.name AS statusname ";
    $usersql .= "FROM `{$dbUsers}` AS u, `{$dbUserStatus}` AS us ";
    $usersql .= "WHERE u.id = '{$userid}' AND u.status = us.id";
    $userresult = mysql_query($usersql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    $user = mysql_fetch_row($userresult);
    if (strtolower($accepting) == 'no') {
        // Look through the incidents that this user OWNS (and are not closed)
        $sql = "SELECT * FROM `{$dbIncidents}` WHERE (owner='{$userid}' OR towner='{$userid}') AND status!=2";
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        while ($incident = mysql_fetch_object($result)) {
            // Try and find a backup/substitute engineer
            $backupid = software_backup_userid($userid, $incident->softwareid);
            if (empty($backupid) or user_accepting($backupid) == 'No') {
                // no backup engineer found so add to the holding queue
                // Look to see if this assignment is in the queue already
                $fsql = "SELECT * FROM `{$dbTempAssigns}` WHERE incidentid='{$incident->id}' AND originalowner='{$userid}'";
                $fresult = mysql_query($fsql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_WARNING);
                }
                if (mysql_num_rows($fresult) < 1) {
                    // it's not in the queue, and the user isn't accepting so add it
                    //$userstatus=user_status($userid);
                    $userstatus = $user['status'];
                    $usql = "INSERT INTO `{$dbTempAssigns}` (incidentid,originalowner,userstatus) VALUES ('{$incident->id}', '{$userid}', '{$userstatus}')";
                    mysql_query($usql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_ERROR);
                    }
                }
            } else {
                // do an automatic temporary reassign
                // update incident
                $rusql = "UPDATE `{$dbIncidents}` SET ";
                $rusql .= "towner='{$backupid}', lastupdated='{$now}' WHERE id='{$incident->id}' LIMIT 1";
                mysql_query($rusql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_ERROR);
                }
                // add update
                $username = user_realname($userid);
                //$userstatus = userstatus_name(user_status($userid));
                $userstatus = $user['statusname'];
                //$usermessage=user_message($userid);
                $usermessage = $user['message'];
                $bodytext = "Previous Incident Owner ({$username}) {$userstatus}  {$usermessage}";
                $assigntype = 'tempassigning';
                $risql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, bodytext, type, timestamp, currentowner, currentstatus) ";
                $risql .= "VALUES ('{$incident->id}', '0', '{$bodytext}', '{$assigntype}', '{$now}', ";
                $risql .= "'{$backupid}', ";
                $risql .= "'{$incident->status}')";
                mysql_query($risql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_ERROR);
                }
                // Look to see if this assignment is in the queue already
                $fsql = "SELECT * FROM `{$dbTempAssigns}` WHERE incidentid='{$incident->id}' AND originalowner='{$userid}'";
                $fresult = mysql_query($fsql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_WARNING);
                }
                if (mysql_num_rows($fresult) < 1) {
                    //$userstatus=user_status($userid);
                    $userstatus = $user['status'];
                    $usql = "INSERT INTO `{$dbTempAssigns}` (incidentid,originalowner,userstatus,assigned) VALUES ('{$incident->id}', '{$userid}', '{$userstatus}','yes')";
                    mysql_query($usql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_ERROR);
                    }
                } else {
                    // mark the temp assigns table so it's not showing in the holding queue
                    $tasql = "UPDATE `{$dbTempAssigns}` SET assigned='yes' WHERE originalowner='{$userid}' AND incidentid='{$incident->id}' LIMIT 1";
                    mysql_query($tasql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_ERROR);
                    }
                }
            }
        }
    } elseif ($accepting == '') {
        // Do nothing when accepting status doesn't exist
    } else {
        // The user is now ACCEPTING, so first have a look to see if there are any reassignments in the queue
        $sql = "SELECT * FROM `{$dbTempAssigns}` WHERE originalowner='{$userid}' ";
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        while ($assign = mysql_fetch_object($result)) {
            if ($assign->assigned == 'yes') {
                // Incident has actually been reassigned, so have a look if we can grab it back.
                $lsql = "SELECT id,status FROM `{$dbIncidents}` WHERE id='{$assign->incidentid}' AND owner='{$assign->originalowner}' AND towner!=''";
                $lresult = mysql_query($lsql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_WARNING);
                }
                while ($incident = mysql_fetch_object($lresult)) {
                    // Find our tempassign
                    $usql = "SELECT id,currentowner FROM `{$dbUpdates}` WHERE incidentid='{$incident->id}' AND userid='0' AND type='tempassigning' ORDER BY id DESC LIMIT 1";
                    $uresult = mysql_query($usql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_WARNING);
                    }
                    list($prevassignid, $tempowner) = mysql_fetch_row($uresult);
                    // Look to see if the temporary owner has updated the incident since we temp assigned it
                    // If he has, we leave it in his queue
                    $usql = "SELECT id FROM `{$dbUpdates}` WHERE incidentid='{$incident->id}' AND id > '{$prevassignid}' AND userid='{$tempowner}' LIMIT 1 ";
                    $uresult = mysql_query($usql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_WARNING);
                    }
                    if (mysql_num_rows($uresult) < 1) {
                        // Incident appears not to have been updated by the temporary owner so automatically reassign back to orignal owner
                        // update incident
                        $rusql = "UPDATE `{$dbIncidents}` SET ";
                        $rusql .= "towner='', lastupdated='{$now}' WHERE id='{$incident->id}' LIMIT 1";
                        mysql_query($rusql);
                        if (mysql_error()) {
                            trigger_error(mysql_error(), E_USER_ERROR);
                        }
                        // add update
                        $username = user_realname($userid);
                        //$userstatus = userstatus_name(user_status($userid));
                        $userstatus = $user['statusname'];
                        //$usermessage=user_message($userid);
                        $usermessage = $user['message'];
                        $bodytext = "Reassigning to original owner {$username} ({$userstatus})";
                        $assigntype = 'reassigning';
                        $risql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, bodytext, type, timestamp, currentowner, currentstatus) ";
                        $risql .= "VALUES ('{$incident->id}', '0', '{$bodytext}', '{$assigntype}', '{$now}', ";
                        $risql .= "'{$backupid}', ";
                        $risql .= "'{$incident->status}')";
                        mysql_query($risql);
                        if (mysql_error()) {
                            trigger_error(mysql_error(), E_USER_ERROR);
                        }
                        // remove from assign queue now, all done
                        $rsql = "DELETE FROM `{$dbTempAssigns}` WHERE incidentid='{$assign->incidentid}' AND originalowner='{$assign->originalowner}'";
                        mysql_query($rsql);
                        if (mysql_error()) {
                            trigger_error(mysql_error(), E_USER_ERROR);
                        }
                    }
                }
            } else {
                // now have a look to see if the reassign was completed
                $ssql = "SELECT id FROM `{$dbIncidents}` WHERE id='{$assign->incidentid}' LIMIT 1";
                $sresult = mysql_query($ssql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_WARNING);
                }
                if (mysql_num_rows($sresult) >= 1) {
                    // reassign wasn't completed, or it was already assigned back, simply remove from assign queue
                    $rsql = "DELETE FROM `{$dbTempAssigns}` WHERE incidentid='{$assign->incidentid}' AND originalowner='{$assign->originalowner}'";
                    mysql_query($rsql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_ERROR);
                    }
                }
            }
        }
    }
    return;
}
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
 }
 if (isset($triggeruserid)) {
     trigger('TRIGGER_INCIDENT_ASSIGNED', array('userid' => $triggeruserid, 'incidentid' => $incidentid));
 }
 //         if ($CONFIG['debug'])
 //         {
 //             echo "<pre>";
 //                 print_r($_REQUEST);
 //                 print_r($incident);
 //                 echo "<hr>$sql";
 //                 exit;
 //         }
 // add update
 if (strtolower(user_accepting($userid)) != "yes") {
     $bodytext = "({$strIncidentAssignmentWasForcedUserNotAccept})<hr>\n" . $bodytext;
 }
 if ($temporary == 'yes') {
     $assigntype = 'tempassigning';
 } else {
     $assigntype = 'reassigning';
 }
 if ($_REQUEST['cust_vis'] == 'yes') {
     $customervisibility = 'show';
 } else {
     $customervisibility = 'hide';
 }
 $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, bodytext, type, timestamp, currentowner, currentstatus, customervisibility) ";
 $sql .= "VALUES ({$id}, {$sit['2']}, '{$bodytext}', '{$assigntype}', '{$now}', ";
 if ($fullreassign == 'yes') {
Esempio n. 4
0
$sql = "SELECT * FROM `{$dbTempAssigns}` AS t, `{$dbIncidents}` AS i ";
$sql .= "WHERE t.incidentid = i.id AND assigned='no' ";
$result = mysql_query($sql);
if (mysql_num_rows($result) >= 1) {
    $show = FALSE;
    $rhtml = "<br />\n";
    $rhtml .= "<h2>" . icon('reassign', 32, $strPendingReassignments);
    $rhtml .= " {$strPendingReassignments}</h2>";
    $rhtml .= "<p align='center'>{$strAutoReassignmentsThatCouldntBeMade}</p>";
    $rhtml .= "<table align='center' style='width: 95%;'>";
    $rhtml .= "<tr><th title='{$strLastUpdated}'>{$strDate}</th><th title='{$strCurrentOwner}'>{$strFrom}</th>";
    $rhtml .= "<th title='{$strIncidentTitle}'>{$strSubject}</th><th>{$strMessage}</th>";
    $rhtml .= "<th>{$strOperation}</th></tr>\n";
    while ($assign = mysql_fetch_object($result)) {
        // $originalownerstatus=user_status($assign->originalowner);
        $useraccepting = strtolower(user_accepting($assign->originalowner));
        if ($assign->owner == $assign->originalowner || $assign->towner == $assign->originalowner and $useraccepting == 'no') {
            $show = TRUE;
            $rhtml .= "<tr class='shade1'>";
            $rhtml .= "<td align='center'>" . ldate($CONFIG['dateformat_datetime'], $assign->lastupdated) . "</td>";
            $rhtml .= "<td>" . user_realname($assign->originalowner, TRUE) . "</td>";
            $rhtml .= "<td>" . software_name($assign->softwareid) . "<br />[<a href=\"javascript:wt_winpopup('incident_details.php?id={$assign->id}&amp;popup=yes', 'mini')\">{$assign->id}</a>] " . $assign->title . "</td>";
            $userstatus = userstatus_name($assign->userstatus);
            $usermessage = user_message($assign->originalowner);
            $username = user_realname($assign->originalowner, TRUE);
            $rhtml .= "<td>" . sprintf($strOwnerXAndNotAccepting, $userstatus) . "<br />{$usermessage}</td>";
            $backupid = software_backup_userid($assign->originalowner, $assign->softwareid);
            $backupname = user_realname($backupid, TRUE);
            $reason = urlencode(trim("{$strPreviousIncidentOwner} ({$username}) {$userstatus}  {$usermessage}"));
            $rhtml .= "<td>";
            if ($backupid >= 1) {