コード例 #1
0
ファイル: index.php プロジェクト: sitracker/sitracker_old
function portal_incident_table($sql)
{
    global $CONFIG, $showclosed;
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    $numincidents = mysql_num_rows($result);
    if ($numincidents >= 1) {
        $shade = 'shade1';
        $html .= "<table align='center' width='70%'>";
        $html .= "<tr>";
        $html .= colheader('id', $GLOBALS['strID']);
        $html .= colheader('title', $GLOBALS['strTitle']);
        $html .= colheader('owner', $GLOBALS['strOwner']);
        $html .= colheader('lastupdated', $GLOBALS['strLastUpdated']);
        $html .= colheader('contact', $GLOBALS['strContact']);
        $html .= colheader('status', $GLOBALS['strStatus']);
        if ($showclosed != "true") {
            $html .= colheader('actions', $GLOBALS['strOperation']);
        }
        $html .= "</tr>\n";
        while ($incident = mysql_fetch_object($result)) {
            $html .= "<tr class='{$shade}'><td align='center'>";
            $html .= "<a href='incident.php?id={$incident->id}'>{$incident->id}</a></td>";
            $html .= "<td>";
            if (!empty($incident->softwareid)) {
                $html .= software_name($incident->softwareid) . "<br />";
            }
            $html .= "<strong><a href='incident.php?id={$incident->id}'>{$incident->title}</a></strong></td>";
            $html .= "<td align='center'>" . user_realname($incident->owner) . "</td>";
            $html .= "<td align='center'>" . ldate($CONFIG['dateformat_datetime'], $incident->lastupdated) . "</td>";
            $html .= "<td align='center'><a href='contactdetails.php?id={$incident->contactid}'>";
            $html .= "{$incident->forenames} {$incident->surname}</a></td>";
            $html .= "<td align='center'>" . incidentstatus_name($incident->status, external) . "</td>";
            if ($showclosed != "true") {
                $html .= "<td align='center'><a href='update.php?id={$incident->id}'>{$GLOBALS['strUpdate']}</a> | ";
                //check if the customer has requested a closure
                $lastupdate = list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id);
                if ($lastupdate[1] == "customerclosurerequest") {
                    $html .= "{$GLOBALS['strClosureRequested']}</td>";
                } else {
                    $html .= "<a href='close.php?id={$incident->id}'>{$GLOBALS['strRequestClosure']}</a></td>";
                }
            }
            $html .= "</tr>";
            if ($shade == 'shade1') {
                $shade = 'shade2';
            } else {
                $shade = 'shade1';
            }
        }
        $html .= "</table>";
    } else {
        $html .= "<p class='info'>{$GLOBALS['strNoIncidents']}</p>";
    }
    return $html;
}
コード例 #2
0
ファイル: auto_create.php プロジェクト: nicdev007/auto-create
/**
 * The main "auto_create" function
 * The function is specific to rules sent to our clients regarding the naming of
 *  their email Subject:
 * For this reason the plugin is specific but not impossible to adapt
 * Clients send their email like this:
 * "Hardware [Productname] Serial number Reference"
 * or "Software [Softwarename] Version Reference"
 * or "Warranty [Productname] Serial number Reference"
 * This helps to simplify the creation, and detection of this function
 * @author Nico du toit
 * @return Returns the newly created incidentid to the inbopund script to
 * continue processing
 * OR returns nothing and the new update goes to the holding queue as before
 */
function auto_create_incidents($params)
{
    unset($GLOBALS['plugin_reason']);
    $incidentid = $params['incidentid'];
    $contactid = $params['contactid'];
    $subject = $params['subject'];
    $decoded = $params['decoded'];
    $send_email = 1;
    global $CONFIG, $dbIncidents, $now;
    debug_log("incident ID : " . $incidentid . " \n  Contactid:  " . $contactid . "\n" . "Subject : " . $subject);
    if ($incidentid > 0) {
        return $incidentid;
    }
    if (in_array($contactid, $CONFIG['auto_create_contact_exclude'])) {
        debug_log("For this client : " . $contactid . " autocreate is forbidden! see the config file");
        $GLOBALS['plugin_reason'] = 'Contact BLOCKED';
        return;
    }
    if ($contactid < 1) {
        $GLOBALS['plugin_reason'] = 'Contact not in DataBase';
        return;
    }
    $cc = find_cc_decoded($decoded);
    if (stristr($cc, $CONFIG['support_email'])) {
        debug_log("Support was in the copy of the email!!");
        $GLOBALS['plugin_reason'] = 'Support in CC of email';
        return;
    }
    debug_log("Redirecting to function checking for duplicates ... ");
    //Check if duplicates exists in the incidents DB
    $create_incident = check_for_duplicates($subject, $contactid);
    if ($create_incident == "NO") {
        debug_log("case 0:   more than 1 duplicate");
        $GLOBALS['plugin_reason'] = 'Possible DUPLICATE';
        return;
    }
    if ($create_incident != "YES" && $create_incident != "NO") {
        debug_log("case 1:   only 1 duplicate");
        debug_log("The duplicate incidentID =: " . $create_incident);
        return $create_incident;
    }
    if ($create_incident == "YES") {
        debug_log("case 2:   No duplicates found");
        debug_log("Proceeding to - Auto create");
        $ccemail = $cc;
        $origsubject = mysql_real_escape_string($subject);
        $subject = strtolower($subject);
        //Check if any of our keywords exists TODO: Need to make the keywords
        //configurable in the config file
        $warranty = preg_match("/warranty|warrantee|waranty|diagnostic/i", $subject);
        $hard = preg_match("/hardware|hard/i", $subject);
        $soft = preg_match("/soft|software/i", $subject);
        if ($warranty == 1 && $hard == 0 && $soft == 0) {
            $case = 0;
            debug_log("Match for Warranty in : " . $subject);
        } elseif ($hard == 1 && $soft == 0 && $warranty == 0) {
            $case = 1;
            debug_log("Match for Hardware in : " . $subject);
        } elseif ($soft == 1 && $hard == 0 && $warranty == 0) {
            $case = 2;
            debug_log("Match for Software in : " . $subject);
        } else {
            $case = 3;
            debug_log("NO match found for any keyword in : " . $subject);
        }
        switch ($case) {
            case 0:
                debug_log("Case type Warranty : ");
                $product = 9;
                //Hardware
                //$software = 41;//Warranty clam
                $software = find_tags_in_subject($subject);
                debug_log("The software tag returned is : " . $software);
                if (!$software || !in_array($software, $CONFIG['auto_create_warranty_include'])) {
                    debug_log("The soft is not in the accepted warranty list or is 0 :");
                    $software = 41;
                    //if no tags are found use the normal warranty claim
                }
                $servicelevel = $CONFIG['default_service_level'];
                $siteid = contact_siteid($contactid);
                $sql = "SELECT id FROM `sit_maintenance` WHERE site='{$siteid}' AND product='{$product}' ";
                $result = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
                }
                $row = mysql_fetch_row($result);
                $contrid = $row[0];
                //Create the incident based on the info we have
                $incidentid = '';
                $incidentid = create_incident($origsubject, $contactid, $servicelevel, $contrid, $product, $software, $priority = 1, $owner = 0, $status = 1, $productversion = '', $productservicepacks = '', $opened = '', $lastupdated = '');
                debug_log("Incident ID created : " . $incidentid);
                debug_log("CC address(es) found : " . $ccemail);
                //If we have some cc addresses, then we can update them into the case
                if ($ccemail) {
                    $sql = "UPDATE `{$dbIncidents}` ";
                    $sql .= "SET ccemail='{$ccemail}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    if (!$result) {
                        debug_log("Update to the incident cc email succesfull!!");
                    }
                }
                if ($incidentid > 0) {
                    // Insert the first SLA update, this indicates the start of an incident
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$sit[2]}', '1', 'show', 'opened','The incident is open and awaiting action.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    // Insert the first Review update, this indicates the review period of an incident has started
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reviewmet', '{$now}', '{$sit[2]}', '1', 'hide', 'opened','')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_CREATED', array('incidentid' => $incidentid, 'sendemail' => $send_email));
                    debug_log("Succesfully created incident: " . $incidentid);
                    //Insert the initial response as we see the first email as the initial response
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$owner}', '1', 'show', 'initialresponse','The Initial Response has been made by the automated tracker email.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                }
                //In case we have no incident ID it means the function failed - FALSE returned by function
                if ($incidentid == FALSE) {
                    debug_log("Incident auto create failed: " . $subject);
                    return;
                }
                $send_email = 1;
                $owner = suggest_reassign_userid($incidentid, $exceptuserid = 0);
                if ($owner > 0) {
                    //Update owner in incidents
                    $sql = "UPDATE `sit_incidents` SET owner='{$owner}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_ASSIGNED', array('userid' => $owner, 'incidentid' => $incidentid));
                    // add update
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, nextaction) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reassigning', '{$now}', '{$owner}', '1', '{$nextaction}')";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    debug_log("Incident re-assigned to: " . $owner);
                }
                return $incidentid;
            case 1:
                debug_log("Case type Hardware : ");
                $product = 9;
                //Hardware product
                //Try to recover the product name that is in the email subject (only if the sender followed the rules!)
                $recovprod = trim(recup_prodName($subject, '[', ']'));
                if ($recovprod) {
                    $prodword = $recovprod;
                } elseif (!$recovprod) {
                    //$prodword = 'HARDWARE NOT AUTOMATICALLY RECOGNISED';
                    $prodword = software_name(find_tags_in_subject($subject));
                    if (!$prodword) {
                        $GLOBALS['plugin_reason'] = 'Hardware [Skill-Product not set]';
                        return;
                    }
                }
                $sql = "SELECT LOWER(id) FROM `sit_software` WHERE name LIKE '%{$prodword}%' ";
                $result = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
                }
                $numresults = mysql_num_rows($result);
                $row = mysql_fetch_row($result);
                //No match found
                if ($numresults == 0) {
                    //Set the software to a precreated value in the DB
                    //$software = 53;
                    $GLOBALS['plugin_reason'] = 'Hardware [Skill-Product not set]';
                    return;
                }
                //Multiple matches found, take the first one
                //TODO: Improve this as it is not that accurate
                if ($numresults > 0) {
                    $software = $row[0];
                }
                $servicelevel = $CONFIG['default_service_level'];
                $siteid = contact_siteid($contactid);
                //Find the hardware contract for this contact
                $sql = "SELECT id FROM `sit_maintenance` WHERE site='{$siteid}' AND product='{$product}' ";
                $result = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
                }
                $row = mysql_fetch_row($result);
                $contrid = $row[0];
                /*TODO: This was not working correctly, but can be fixed i am sure...
                               * The idea is to change the priority according to the product or skill
                               * if ($software == 4||5||6||7||8||13||17||18||37||45||48)
                              {
                                  $priority = 3;
                              }
                              else
                              {
                                $priority = 2;
                              }
                              echo "CONTRACT";
                              echo $contrid;
                              echo "<br>";
                		//Allthese are created as priority medium - Need still to fix the above
                		//$priority = 2;*/
                $incidentid = '';
                $incidentid = create_incident($origsubject, $contactid, $servicelevel, $contrid, $product, $software, $priority = 2, $owner = 0, $status = 1, $productversion = '', $productservicepacks = '', $opened = '', $lastupdated = '');
                debug_log("Incident ID created : " . $incidentid);
                debug_log("CC address(es) found : " . $ccemail);
                //If we have some cc addresses, then we can update them into the case
                if ($ccemail) {
                    $sql = "UPDATE `{$dbIncidents}` ";
                    $sql .= "SET ccemail='{$ccemail}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    if (!$result) {
                        debug_log("Update to the incident cc email succesfull!!");
                    }
                }
                // If we have an incident id - we can now do the updates
                if ($incidentid > 0) {
                    // Insert the first SLA update, this indicates the start of an incident
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$sit[2]}', '1', 'show', 'opened','The incident is open and awaiting action.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    // Insert the first Review update, this indicates the review period of an incident has started
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reviewmet', '{$now}', '{$sit[2]}', '1', 'hide', 'opened','')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_CREATED', array('incidentid' => $incidentid, 'sendemail' => $send_email));
                    debug_log("Succesfully created incident: " . $incidentid);
                    //Insert the initial response as we see the first email as the initial response
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$owner}', '1', 'show', 'initialresponse','The Initial Response has been made by the automated tracker email.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                }
                //In case we have no incident ID it means the function failed - FALSE returned by function
                if ($incidentid == FALSE) {
                    debug_log("Incident auto create failed: " . $subject);
                    return;
                }
                $send_email = 1;
                $owner = suggest_reassign_userid($incidentid, $exceptuserid = 0);
                //update the Db with the suggested user to reassign to
                if ($owner > 0) {
                    $sql = "UPDATE `sit_incidents` SET owner='{$owner}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_ASSIGNED', array('userid' => $owner, 'incidentid' => $incidentid));
                    // add update
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, nextaction) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reassigning', '{$now}', '{$owner}', '1', '{$nextaction}')";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    debug_log("Incident re-assigned to: " . $owner);
                }
                return $incidentid;
            case 2:
                debug_log("Case type Software : ");
                $product = 10;
                //Software product
                //Try to recover the product name that is in the email subject (only if the sender followed the rules!)
                $recovprod = trim(recup_prodName($subject, '[', ']'));
                if ($recovprod) {
                    $prodword = $recovprod;
                } elseif (!$recovprod) {
                    //$prodword = 'SOFTWARE NOT AUTOMATICALLY RECOGNISED';
                    $prodword = software_name(find_tags_in_subject($subject));
                    if (!$prodword) {
                        $GLOBALS['plugin_reason'] = 'Software [Skill-Product not set]';
                        return;
                    }
                }
                $sql = "SELECT LOWER(id) FROM `sit_software` WHERE name LIKE '%{$prodword}%' ";
                $result = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
                }
                $numresults = mysql_num_rows($result);
                $row = mysql_fetch_row($result);
                //No match found
                if ($numresults == 0) {
                    //$software = 54;
                    $GLOBALS['plugin_reason'] = 'Software [Skill-Product not set]';
                    return;
                }
                //Multiple matches found, take the first one
                //TODO: Improve this as it is not that accurate
                if ($numresults > 0) {
                    $software = $row[0];
                }
                $servicelevel = $CONFIG['default_service_level'];
                $siteid = contact_siteid($contactid);
                //Find the software contract for this contact
                $sql = "SELECT id FROM `sit_maintenance` WHERE site='{$siteid}' AND product='{$product}' ";
                $result = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
                }
                $row = mysql_fetch_row($result);
                $contrid = $row[0];
                /*TODO: This was not working correctly, but can be fixed i am sure...
                               * The idea is to change the priority according to the product or skill
                              echo $contrid;
                              echo "<br>";
                              if ($software == 54||36||38)
                              {
                                  $priority = 1;
                              }
                              else
                              {
                                $priority = 2;
                              }
                		//Allthese are created as priority medium - Need still to fix the above
                		//$priority = 2;*/
                $incidentid = '';
                $incidentid = create_incident($origsubject, $contactid, $servicelevel, $contrid, $product, $software, $priority = 2, $owner = 0, $status = 1, $productversion = '', $productservicepacks = '', $opened = '', $lastupdated = '');
                debug_log("Incident ID created : " . $incidentid);
                debug_log("CC address(es) found : " . $ccemail);
                //If we have some cc addresses, then we can update them into the case
                if ($ccemail) {
                    $sql = "UPDATE `{$dbIncidents}` ";
                    $sql .= "SET ccemail='{$ccemail}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    if (!$result) {
                        debug_log("Update to the incident cc email succesfull!!");
                    }
                }
                if ($incidentid > 0) {
                    // Insert the first SLA update, this indicates the start of an incident
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$sit[2]}', '1', 'show', 'opened','The incident is open and awaiting action.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    // Insert the first Review update, this indicates the review period of an incident has started
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reviewmet', '{$now}', '{$sit[2]}', '1', 'hide', 'opened','')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_CREATED', array('incidentid' => $incidentid, 'sendemail' => $send_email));
                    debug_log("Succesfully created incident: " . $incidentid);
                    //Insert the initial response as we see the first email as the initial response
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, customervisibility, sla, bodytext) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'slamet', '{$now}', '{$owner}', '1', 'show', 'initialresponse','The Initial Response has been made by the automated tracker email.')";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                }
                //In case we have no incident ID it means the function failed - FALSE returned by function
                if ($incidentid == FALSE) {
                    debug_log("Incident auto create failed: " . $subject);
                    return;
                }
                $send_email = 1;
                $owner = suggest_reassign_userid($incidentid, $exceptuserid = 0);
                //Update the Db with the suggested owner
                if ($owner > 0) {
                    $sql = "UPDATE `sit_incidents` SET owner='{$owner}', lastupdated='{$now}' WHERE id='{$incidentid}'";
                    mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    trigger('TRIGGER_INCIDENT_ASSIGNED', array('userid' => $owner, 'incidentid' => $incidentid));
                    // add update
                    $sql = "INSERT INTO `sit_updates` (incidentid, userid, type, timestamp, currentowner, currentstatus, nextaction) ";
                    $sql .= "VALUES ('{$incidentid}', '{$sit[2]}', 'reassigning', '{$now}', '{$owner}', '1', '{$nextaction}')";
                    $result = mysql_query($sql);
                    if (mysql_error()) {
                        trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
                    }
                    debug_log("Incident re-assigned to: " . $owner);
                }
                return $incidentid;
            case 3:
                $GLOBALS['plugin_reason'] = 'INCORRECTLY formatted';
                debug_log("There was no reference found for the correct skill in: " . $subject);
                return;
        }
    }
}
コード例 #3
0
ファイル: incidents.php プロジェクト: sitracker/sitracker_old
         echo "selected='selected' ";
     }
     echo "value='{$_SERVER['PHP_SELF']}?user={$user}&amp;type={$type}&amp;queue=4'>{$strAllClosed}</option>\n";
 }
 echo "</select>\n";
 echo "</form>";
 if ($queue == 4 and $CONFIG['hide_closed_incidents_older_than'] != -1 and $_GET['show'] != 'all') {
     echo "<p class='info'>" . sprintf($strHidingIncidentsOlderThan, $CONFIG['hide_closed_incidents_older_than']);
     echo " - <a href='{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}&show=all'>" . $strShowAll . "</a></p>";
 } elseif ($queue == 4 and $CONFIG['hide_closed_incidents_older_than'] != -1) {
     echo "<p class='info'>{$strShowingAllClosedIncidents} - ";
     echo "<a href='{$_SERVER['PHP_SELF']}?user={$user}&amp;type={$type}&amp;queue=4'>";
     echo sprintf($strOnlyShowNewerThan, $CONFIG['hide_closed_incidents_older_than']) . "</a></p>";
 }
 if (!empty($softwareid)) {
     echo "<p align='center'>" . sprintf($strFilterActiveOnlyShowingIncidentsForX, software_name($softwareid)) . "</p>";
 }
 if ($user == 'all') {
     echo "<p align='center'>" . sprintf($strThereAreXIncidentsInThisList, $rowcount) . "</p>";
 } else {
     echo "<br />";
 }
 // Print message if no incidents were listed
 if (mysql_num_rows($result) >= 1) {
     // Incidents Table
     include APPLICATION_INCPATH . 'incidents_table.inc.php';
 } else {
     echo "<p class='info'>{$strNoIncidents}</p>";
 }
 if ($user == 'all') {
     echo "<p align='center'>" . sprintf($strNumOfIncidents, $rowcount) . "</p>";
コード例 #4
0
$site = mysql_fetch_object($siteresult);
$site_name = $site->name;
if (!empty($site->notes)) {
    $site_notes = icon('site', 16) . " <strong>{$strSiteNotes}</strong><br />" . nl2br($site->notes);
} else {
    $site_notes = '';
}
unset($site);
if (!empty($incident->contactnotes)) {
    $contact_notes = icon('contact', 16) . " <strong>{$strContactNotes}</strong><br />" . nl2br($incident->contactnotes);
} else {
    $contact_notes = '';
}
$product_name = product_name($incident->product);
if ($incident->softwareid > 0) {
    $software_name = software_name($incident->softwareid);
}
$servicelevel_id = maintenance_servicelevel($incident->maintenanceid);
$servicelevel_tag = $incident->servicelevel;
if ($servicelevel_tag == '') {
    $servicelevel_tag = servicelevel_id2tag(maintenance_servicelevel($incident->maintenanceid));
}
$servicelevel_name = servicelevel_name($servicelevelid);
if ($incident->closed == 0) {
    $closed = time();
} else {
    $closed = $incident->closed;
}
$opened_for = format_seconds($closed - $incident->opened);
$priority = $incident->priority;
// Lookup the service level times
コード例 #5
0
 $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) {
             $rhtml .= "<a href=\"javascript:wt_winpopup('incident_reassign.php?id={$assign->id}&amp;reason={$reason}&amp;backupid={$backupid}&amp;asktemp=temporary&amp;popup=yes','mini');\" title='{$strReassignTo} {$backupname}'>{$strAssignToBackup}</a> | ";
         }
         $rhtml .= "<a href=\"javascript:wt_winpopup('incident_reassign.php?id={$assign->id}&amp;reason={$reason}&amp;asktemp=temporary&amp;popup=yes','mini');\" title='{$strReassign}'>{$strAssignToOther}</a> | <a href='set_user_status.php?mode=deleteassign&amp;incidentid={$assign->incidentid}&amp;originalowner={$assign->originalowner}' title='{$strIgnoreThisAndDelete}'>{$strIgnore}</a></td>";
         $rhtml .= "</tr>\n";
     } elseif ($assign->owner != $assign->originalowner and $useraccepting == 'yes') {
         $show = TRUE;
コード例 #6
0
 }
 $escalationpath = db_read_column('name', $dbEscalationPaths, $escalationpath);
 if ($oldccemail != $ccemail) {
     $header .= "CC Email: " . $oldccemail . " -&gt; <b>" . $ccemail . "</b>\n";
 }
 if ($oldescalationpath != $escalationpath) {
     $header .= "Escalation: " . $oldescalationpath . " -&gt; <b>" . $escalationpath . "</b>\n";
 }
 if ($oldexternalengineer != $externalengineer) {
     $header .= "External Engineer: " . $oldexternalengineer . " -&gt; <b>" . $externalengineer . "</b>\n";
 }
 if ($oldexternalemail != $externalemail) {
     $header .= "External email: " . $oldexternalemail . " -&gt; <b>" . $externalemail . "</b>\n";
 }
 if ($oldsoftware != $software) {
     $header .= "Skill: " . software_name($oldsoftware) . " -&gt; <b>" . software_name($software) . "</b>\n";
 }
 if ($oldproductversion != $productversion) {
     $header .= "Version: " . $oldproductversion . " -&gt; <b>" . $productversion . "</b>\n";
 }
 if ($oldproductservicepacks != $productservicepacks) {
     $header .= "Service Packs Applied: " . $oldproductservicepacks . " -&gt; <b>" . $productservicepacks . "</b>\n";
 }
 if (!empty($header)) {
     $header .= "<hr>";
 }
 // get current incident status
 $sql = "SELECT status FROM `{$dbIncidents}` WHERE id={$id}";
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
コード例 #7
0
 } elseif (empty($incidents['externalid']) and $incidents['escalationpath'] >= 1) {
     $epathurl = $epath[$escalationpath]['home_url'];
     $externalid = "<a href=\"{$epathurl}\" title=\"{$epath[$escalationpath]['url_title']}\">{$epath[$escalationpath]['name']}</a>";
 } elseif (empty($incidents['escalationpath']) and !empty($incidents['externalid'])) {
     $externalid = format_external_id($incidents['externalid']);
 }
 echo "<tr class='{$class}'>";
 echo "<td align='center'>";
 echo "<a href='incident_details.php?id={$incidents['id']}' class='direct'>{$incidents['id']}</a>";
 if ($externalid != '') {
     echo "<br />{$externalid}";
 }
 echo "</td>";
 echo "<td>";
 if (!empty($incidents['softwareid'])) {
     echo software_name($incidents['softwareid']) . "<br />";
 }
 if (count(open_activities_for_incident($incidents['id'])) > 0) {
     echo icon('timer', 16, $strOpenActivities) . ' ';
 }
 if (drafts_waiting_on_incident($incidents['id'])) {
     echo icon('note2', 16, $strDraftsExist) . ' ';
 }
 echo "<a href=\"javascript:incident_details_window('{$incidents['id']}','incident{$incidents['id']}')\" class='info'>";
 if (trim($incidents['title']) != '') {
     echo $incidents['title'];
 } else {
     echo $strUntitled;
 }
 if (!empty($update_body) and $update_body != '...') {
     echo "<span>{$update_body}</span>";
コード例 #8
0
echo "<a href=\"{$_SERVER['PHP_SELF']}?id={$id}&amp;mode={$mode}&amp;status=open\">{$strShowOpenIncidents}</a> | ";
echo "<a href=\"{$_SERVER['PHP_SELF']}?id={$id}&amp;mode={$mode}&amp;status=closed\">{$strShowClosedIncidents}</a> | ";
echo "<a href=\"{$_SERVER['PHP_SELF']}?id={$id}&amp;mode={$mode}\">{$strAll}</a>";
echo "</p>";
$countproducts = array_sum($productlist);
if ($mode == 'site') {
    $countcontacts = array_sum($contactlist);
}
if ($countproducts >= 1 or $contactcontacts >= 1) {
    foreach ($productlist as $product => $quantity) {
        $productpercentage = number_format($quantity * 100 / $countproducts, 1);
        $productlegends[] = urlencode(product_name($product) . " ({$productpercentage}%)");
    }
    foreach ($softwarelist as $software => $quantity) {
        $softwarepercentage = number_format($quantity * 100 / $countproducts, 1);
        $softwarelegends[] = urlencode(software_name($software) . " ({$softwarepercentage}%)");
    }
    if ($mode == 'site') {
        foreach ($contactlist as $contact => $quantity) {
            $contactpercentage = number_format($quantity * 100 / $countcontacts, 1);
            $contactlegends[] = urlencode("{$contact} ({$contactpercentage}%)");
        }
    }
    if (extension_loaded('gd')) {
        // Incidents by product chart
        $data = implode('|', $productlist);
        $keys = array_keys($productlist);
        $legends = implode('|', $productlegends);
        $title = urlencode("{$strIncidents}: {$strByProduct}");
        //$data="1,2,3";
        echo "<div style='text-align:center;'>";
コード例 #9
0
 $isql .= "FROM `{$dbContacts}` AS c, `{$dbSites}` AS s, `{$dbIncidents}` AS i ";
 $isql .= "WHERE c.siteid = s.id AND s.id={$site->id} AND i.opened >" . strtotime($startdate) . " AND i.closed < " . strtotime($enddate) . " AND i.contact = c.id ";
 $iresult = mysql_query($isql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_WARNING);
 }
 if (mysql_num_rows($iresult) > 0) {
     $csv .= "<tr><td colspan='{$colspan}'>";
     $csv .= "<table width='100%'><th>{$strID}</th><th>{$strTitle}</th><th>{$strContact}</th><th>{$strSkill}</th><th>{$strStatus}</th>";
     $csv .= "<th>{$strEngineer}</th><th>{$strOpened}</th><th>{$strClosed}</th><th>{$strDuration}</th><th>{$strSLA}</th></tr>";
     $shade1 = 'shade1';
     while ($obj = mysql_fetch_object($iresult)) {
         $csv .= "<tr class='{$shade1}'>";
         $csv .= "<td>{$obj->id}</td><td>{$obj->title}</td>";
         $csv .= "<td>{$obj->forenames} {$obj->surname}</td>";
         $csv .= "<td>" . software_name($obj->softwareid) . "</td>";
         $csv .= "<td>" . incidentstatus_name($obj->status) . "</td>";
         $csv .= "<td>" . user_realname($obj->owner) . "</td>";
         $csv .= "<td>" . format_date_friendly($obj->opened) . "</td>";
         $csv .= "<td>";
         if ($obj->closed > 0) {
             $csv .= format_date_friendly($obj->closed);
         } else {
             $csv .= $strCurrentlyOpen;
         }
         $csv .= "</td>";
         $csv .= "<td>";
         if ($obj->closed > 0) {
             $csv .= format_workday_minutes($obj->closed - $obj->opened);
         }
         $csv .= "</td>";