Example #1
0
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
 }
 if (mysql_num_rows($result) > 0) {
     while ($productinforow = mysql_fetch_object($result)) {
         $var = "pinfo{$productinforow->id}";
         $pinfo = cleanvar($_POST[$var]);
         $pisql = "INSERT INTO `{$dbIncidentProductInfo}` (incidentid, productinfoid, information) ";
         $pisql .= "VALUES ('{$incidentid}', '{$productinforow->id}', '{$pinfo}')";
         mysql_query($pisql);
         if (mysql_error()) {
             trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
         }
     }
 }
 $updatetext = "{$_SESSION['syslang']['strPriority']}: [b]" . priority_name($priority, TRUE) . "[/b]";
 if (!empty($prioritychangedmessage)) {
     $updatetext .= $prioritychangedmessage;
 }
 $updatetext .= "\n\n" . $bodytext;
 if ($probdesc != '') {
     $updatetext .= "<b>{$_SESSION['syslang']['strProblemDescription']}</b>\n" . $probdesc . "\n\n";
 }
 if ($workarounds != '') {
     $updatetext .= "<b>{$_SESSION['syslang']['strWorkAroundsAttempted']}</b>\n" . $workarounds . "\n\n";
 }
 if ($probreproduction != '') {
     $updatetext .= "<b>{$_SESSION['syslang']['strProblemReproduction']}</b>\n" . $probreproduction . "\n\n";
 }
 if ($custimpact != '') {
     $updatetext .= "<b>{$_SESSION['syslang']['strCustomerImpact']}</b>\n" . $custimpact . "\n\n";
if (mysql_num_rows($tresult) >= 1) {
    echo "<table align='center'>";
    while ($tag = mysql_fetch_object($tresult)) {
        echo "<thead><tr><th colspan='9'>{$tag->tag}</th></tr></thead>";
        $sql = "SELECT * FROM `{$dbServiceLevels}` WHERE tag='{$tag->tag}' ORDER BY priority";
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        echo "<tr><th colspan='2'>{$strPriority}</th><th>{$strInitialResponse}</th>";
        echo "<th>{$strProblemDefinition}</th><th>{$strActionPlan}</th><th>{$strResolutionReprioritisation}</th>";
        echo "<th>{$strReview}</th><th>{$strTimed}</th><th>{$strOperation}</th></tr>";
        while ($sla = mysql_fetch_object($result)) {
            echo "<tr>";
            echo "<td align='right'>" . priority_icon($sla->priority) . "</td>";
            echo "<td>" . priority_name($sla->priority) . "</td>";
            echo "<td>" . format_workday_minutes($sla->initial_response_mins) . "</td>";
            echo "<td>" . format_workday_minutes($sla->prob_determ_mins) . "</td>";
            echo "<td>" . format_workday_minutes($sla->action_plan_mins) . "</td>";
            // 480 mins in a working day
            echo "<td>" . format_workday_minutes($sla->resolution_days * 480) . "</td>";
            echo "<td>" . sprintf($strXDays, $sla->review_days) . "</td>";
            if ($sla->timed == 'yes') {
                echo "<td>{$strYes}</td>";
            } else {
                echo "<td>{$strNo}</td>";
            }
            echo "<td><a href='service_level_edit.php?tag={$sla->tag}&amp;priority={$sla->priority}'>{$strEdit}</a></td>";
            echo "</tr>\n";
        }
    }
Example #3
0
function serviceleveltag_drop_down($name, $tag, $collapse = FALSE)
{
    global $dbServiceLevels;
    if ($collapse) {
        $sql = "SELECT DISTINCT tag FROM `{$dbServiceLevels}`";
    } else {
        $sql = "SELECT tag, priority FROM `{$dbServiceLevels}`";
    }
    $result = mysql_query($sql);
    $html = "<select name='{$name}'>\n";
    if ($tag == '') {
        $html .= "<option selected='selected' value=''></option>\n";
    }
    while ($servicelevels = mysql_fetch_object($result)) {
        $html .= "<option ";
        $html .= "value='{$servicelevels->tag}' ";
        if ($servicelevels->tag == $tag) {
            $html .= "selected='selected'";
        }
        $html .= ">";
        if ($collapse) {
            $html .= $servicelevels->tag;
        } else {
            $html .= "{$servicelevels->tag} " . priority_name($servicelevels->priority);
        }
        $html .= "</option>\n";
    }
    $html .= "</select>";
    return $html;
}
Example #4
0
         }
         break;
     default:
         $timeofnextaction = 0;
         break;
 }
 // Put text into body of update for field changes (reverse order)
 // delim first
 $bodytext = "<hr>" . $bodytext;
 $oldstatus = incident_status($id);
 $oldtimeofnextaction = incident_timeofnextaction($id);
 if ($newstatus != $oldstatus) {
     $bodytext = "Status: " . mysql_real_escape_string(incidentstatus_name($oldstatus)) . " -&gt; <b>" . mysql_real_escape_string(incidentstatus_name($newstatus)) . "</b>\n\n" . $bodytext;
 }
 if ($newpriority != incident_priority($id)) {
     $bodytext = "New Priority: <b>" . mysql_real_escape_string(priority_name($newpriority)) . "</b>\n\n" . $bodytext;
 }
 if ($timeofnextaction > $oldtimeofnextaction + 60) {
     $timetext = "Next Action Time: ";
     if ($oldtimeofnextaction - $now < 1) {
         $timetext .= "None";
     } else {
         $timetext .= date("D jS M Y @ g:i A", $oldtimeofnextaction);
     }
     $timetext .= " -&gt; <b>";
     if ($timeofnextaction < 1) {
         $timetext .= "None";
     } else {
         $timetext .= date("D jS M Y @ g:i A", $timeofnextaction);
     }
     $timetext .= "</b>\n\n";
                echo $results["id"];
                ?>
')"><?php 
                echo $results["title"];
                ?>
</a></td>
                <td align='center' width='100'><?php 
                echo $results['forenames'] . ' ' . $results['surname'];
                ?>
</td>
                <td align='center' width='100'><?php 
                echo site_name($results['siteid']);
                ?>
</td>
                <td align='center' width='50'><?php 
                echo $results['servicelevel'] . "<br />" . priority_name($results["priority"]);
                ?>
</td>
                <td align='center' width='100'><?php 
                echo user_realname($results['owner'], TRUE);
                ?>
</td>
                <td align='center' width='150'><?php 
                echo ldate($CONFIG['dateformat_datetime'], $results["opened"]);
                ?>
</td>
                <td align='center' width='150'><?php 
                echo ldate($CONFIG['dateformat_datetime'], $results["lastupdated"]);
                ?>
</td>
                <td align='center' width='50'><?php 
function dashboard_tasks($dashletid)
{
    global $sit, $CONFIG, $iconset, $dbTasks;
    $user = $sit[2];
    if ($CONFIG['tasks_enabled'] == TRUE) {
        $sql = "SELECT * FROM `{$dbTasks}` WHERE owner='{$user}' AND (completion < 100 OR completion='' OR completion IS NULL) AND ";
        $sql .= "(distribution = 'public' OR distribution = 'private') ";
        if (!empty($sort)) {
            if ($sort == 'id') {
                $sql .= "ORDER BY id ";
            } elseif ($sort == 'name') {
                $sql .= "ORDER BY name ";
            } elseif ($sort == 'priority') {
                $sql .= "ORDER BY priority ";
            } elseif ($sort == 'completion') {
                $sql .= "ORDER BY completion ";
            } elseif ($sort == 'startdate') {
                $sql .= "ORDER BY startdate ";
            } elseif ($sort == 'duedate') {
                $sql .= "ORDER BY duedate ";
            } elseif ($sort == 'distribution') {
                $sql .= "ORDER BY distribution ";
            } else {
                $sql = "ORDER BY id ";
            }
            if ($order == 'a' or $order == 'ASC' or $order = '') {
                $sql .= "ASC";
            } else {
                $sql .= "DESC";
            }
        } else {
            $sql .= "ORDER BY IF(duedate,duedate,99999999) ASC, duedate ASC, startdate DESC, priority DESC, completion ASC";
        }
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        if (mysql_num_rows($result) >= 1) {
            $content .= "<table align='center' width='100%'>";
            $content .= "<tr>";
            $content .= colheader('id', $GLOBALS['strID']);
            $content .= colheader('name', $GLOBALS['strTask']);
            $content .= colheader('priority', $GLOBALS['strPriority']);
            $content .= colheader('completion', $GLOBALS['strCompletion']);
            $content .= "</tr>\n";
            $shade = 'shade1';
            while ($task = mysql_fetch_object($result)) {
                $duedate = mysql2date($task->duedate);
                $startdate = mysql2date($task->startdate);
                if (empty($task->name)) {
                    $task->name = $GLOBALS['strUntitled'];
                }
                $content .= "<tr class='{$shade}'>";
                $content .= "<td>{$task->id}</td>";
                $content .= "<td><a href='view_task.php?id={$task->id}' class='info'>" . truncate_string($task->name, 23);
                if (!empty($task->description)) {
                    $content .= "<span>" . nl2br($task->description) . "</span>";
                }
                $content .= "</a></td>";
                $content .= "<td>" . priority_icon($task->priority) . priority_name($task->priority) . "</td>";
                $content .= "<td>" . percent_bar($task->completion) . "</td>";
                $content .= "</tr>\n";
                if ($shade == 'shade1') {
                    $shade = 'shade2';
                } else {
                    $shade = 'shade1';
                }
            }
            $content .= "</table>\n";
        } else {
            $content .= "<p align='center'>{$GLOBALS['strNoRecords']}</p>";
        }
    } else {
        $content .= "<p class='warning'>{$GLOBALS['strDisabled']}</p>";
    }
    echo dashlet('tasks', $dashletid, icon('task', 16), sprintf($GLOBALS['strXsTasks'], user_realname($user, TRUE)), 'tasks.php', $content);
}
Example #7
0
     if (empty($task->name)) {
         $task->name = $strUntitled;
     }
     if (!empty($incidentTitle)) {
         $task->name = $incidentTitle;
     }
     if ($show == 'incidents') {
         echo "<a href=\"javascript:incident_details_window('{$incidentidL}','incident{$incidentidL}')\" class='info'>";
     } else {
         echo "<a href='view_task.php?id={$task->id}' class='info'>";
     }
     echo truncate_string($task->name, 100);
     echo "</a>";
     echo "</td>";
     if ($show != 'incidents') {
         echo "<td>" . priority_icon($task->priority) . priority_name($task->priority) . "</td>";
         echo "<td>" . percent_bar($task->completion) . "</td>";
     }
 }
 if ($mode != 'incident') {
     echo "<td";
     if ($startdate > 0 and $startdate <= $now and $task->completion <= 0) {
         echo " class='urgent'";
     } elseif ($startdate > 0 and $startdate <= $now and $task->completion >= 1 and $task->completion < 100) {
         echo " class='idle'";
     }
     echo ">";
     if ($startdate > 0) {
         echo ldate($CONFIG['dateformat_date'], $startdate);
     }
     echo "</td>";
        echo "({$strTemp}: " . user_realname($incident->towner, TRUE) . ")";
    }
    echo "<br />";
}
if ($software_name != '' or $incident->productversion != '' or $incident->productservicepacks != '') {
    echo $software_name;
    if ($incident->productversion != '' or $incident->productservicepacks != '') {
        echo " (" . $incident->productversion;
        if ($incident->productservicepacks != '') {
            echo $incident->productservicepacks;
        }
        echo ")";
    }
    echo "<br />\n";
}
echo priority_icon($incident->priority) . " " . priority_name($incident->priority);
if ($product_name != '') {
    echo " <a href='contract_details.php?id={$incident->maintenanceid}' title='{$strContactDetails}' target='top.opener'>";
    echo "{$product_name}";
    echo "</a>";
} elseif ($incident->maintenanceid > 0) {
    echo "<a href='contract_details.php?id={$incident->maintenanceid}' title='{$strContactDetails}' target='top.opener'>";
    echo "{$strContract} {$incident->maintenanceid}";
    echo "</a>";
} else {
    echo "<strong>{$strSiteSupport}</strong>";
}
echo " / ";
echo "{$servicelevel_tag}<br />\n ";
switch (does_contact_have_billable_contract($incident->contactid)) {
    case CONTACT_HAS_BILLABLE_CONTRACT:
         }
         break;
     default:
         $timeofnextaction = 0;
         break;
 }
 // Put text into body of update for field changes (reverse order)
 // delim first
 $bodytext = "<hr>" . $bodytext;
 $oldstatus = incident_status($id);
 $oldtimeofnextaction = incident_timeofnextaction($id);
 if ($newstatus != $oldstatus) {
     $bodytext = "Status: " . incidentstatus_name($oldstatus) . " -&gt; <b>" . incidentstatus_name($newstatus) . "</b>\n\n" . $bodytext;
 }
 if ($newpriority != incident_priority($id)) {
     $bodytext = "New Priority: <b>" . priority_name($newpriority) . "</b>\n\n" . $bodytext;
 }
 if ($timeofnextaction > $oldtimeofnextaction + 60) {
     $timetext = "Next Action Time: ";
     if ($oldtimeofnextaction - $now < 1) {
         $timetext .= "None";
     } else {
         $timetext .= date("D jS M Y @ g:i A", $oldtimeofnextaction);
     }
     $timetext .= " -&gt; <b>";
     if ($timeofnextaction < 1) {
         $timetext .= "None";
     } else {
         $timetext .= date("D jS M Y @ g:i A", $timeofnextaction);
     }
     $timetext .= "</b>\n\n";
// Author: Ivan Lucas <ivanlucas[at]users.sourceforge.net>
$permission = 53;
// Edit Service Levels
require 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
// This page requires authentication
require APPLICATION_LIBPATH . 'auth.inc.php';
$title = $strEditServiceLevel;
// External variables
$tag = cleanvar($_REQUEST['tag']);
$priority = cleanvar($_REQUEST['priority']);
$action = $_REQUEST['action'];
if (empty($action) or $action == "showform") {
    include APPLICATION_INCPATH . 'htmlheader.inc.php';
    echo "<h2>" . icon('sla', 32) . " {$title}</h2>";
    echo "<p align='center'>{$tag} " . priority_name($priority) . "</p>";
    $sql = "SELECT * FROM `{$dbServiceLevels}` WHERE tag='{$tag}' AND priority='{$priority}'";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    $sla = mysql_fetch_object($result);
    echo "<form name='edit_servicelevel' action='{$_SERVER['PHP_SELF']}' method='post'>";
    echo "<table class='vertical'>";
    echo "<tr><th>{$strInitialResponse} " . icon('initialresponse', 16) . "</th>";
    echo "<td><input type='text' size='5' name='initial_response_mins' maxlength='5' value='{$sla->initial_response_mins}' /> {$strMinutes}</td></tr>";
    echo "<tr><th>{$strProblemDefinition} " . icon('probdef', 16) . "</th>";
    echo "<td><input type='text' size='5' name='prob_determ_mins' maxlength='5' value='{$sla->prob_determ_mins}' /> {$strMinutes}</td></tr>";
    echo "<tr><th>{$strActionPlan} " . icon('actionplan', 16) . "</th>";
    echo "<td><input type='text' size='5' name='action_plan_mins' maxlength='5' value='{$sla->action_plan_mins}' /> {$strMinutes}</td></tr>";
    echo "<tr><th>{$strResolutionReprioritisation} " . icon('solution', 16) . "</th>";
Example #11
0
 $sql .= "WHERE id='{$id}' LIMIT 1";
 mysql_query($sql);
 if (mysql_error()) {
     trigger_error(mysql_error(), E_USER_ERROR);
 }
 // if (mysql_affected_rows() < 1) trigger_error("Task update failed",E_USER_ERROR);
 // Add a note to say what changed (if required)
 $bodytext = '';
 if ($name != $old_name) {
     $bodytext .= "{$SYSLANG['strName']}: {$old_name} -&gt; [b]{$name}[/b]\n";
 }
 if ($description != $old_description) {
     $bodytext .= "{$SYSLANG['strDescription']}: {$old_description} -&gt; [b]{$description}[/b]\n";
 }
 if ($priority != $old_priority) {
     $bodytext .= "{$SYSLANG['strPriority']}: " . priority_name($old_priority) . " -&gt; [b]" . priority_name($priority) . "[/b]\n";
 }
 $old_startdate = substr($old_startdate, 0, 10);
 if ($startdate != $old_startdate and ($startdate != '' and $old_startdate != '0000-00-00')) {
     $bodytext .= "{$SYSLANG['strStartDate']}: {$old_startdate} -&gt; [b]{$startdate}[/b]\n";
 }
 $old_duedate = substr($old_duedate, 0, 10);
 if ($duedate != $old_duedate and ($duedate != '0000-00-00' and $old_duedate != '0000-00-00')) {
     $bodytext .= "{$SYSLANG['strDueDate']}: {$old_duedate} -&gt; [b]{$duedate}[/b]\n";
 }
 if ($completion != $old_completion) {
     $bodytext .= "{$SYSLANG['strCompletion']}: {$old_completion}% -&gt; [b]{$completion}%[/b]\n";
 }
 if ($enddate != $old_enddate and ($enddate != '0000-00-00 00:00:00' and $old_enddate != '0000-00-00 00:00:00')) {
     $bodytext .= "{$SYSLANG['strDueDate']}: {$old_enddate} -&gt; [b]{$enddate}[/b]\n";
 }
 $count_obj = mysql_fetch_object($slresult);
 if ($count_obj->count != 4) {
     // Service Level / Priority
     if (!empty($incidents['maintenanceid'])) {
         echo $servicelevel->tag . "<br />";
     } elseif (!empty($incidents['servicelevel'])) {
         echo $incidents['servicelevel'] . "<br />";
     } else {
         echo "{$strUnknownServiceLevel}<br />";
     }
 }
 $blinktime = time() - $servicelevel->initial_response_mins * 60;
 if ($incidents['priority'] == 4 and $incidents['lastupdated'] <= $blinktime) {
     echo "<strong class='critical'>" . priority_name($incidents["priority"]) . "</strong>";
 } else {
     echo priority_name($incidents['priority']);
 }
 echo "</td>\n";
 echo "<td align='center'>";
 if ($incidents['status'] == 5 and $incidents['towner'] == $sit[2]) {
     echo "<strong>{$strAwaitingYourResponse}</strong>";
 } else {
     echo incidentstatus_name($incidents["status"]);
 }
 if ($incidents['status'] == 2) {
     echo "<br />" . closingstatus_name($incidents['closingstatus']);
 }
 echo "</td>\n";
 echo "<td align='center'>";
 echo "{$updated}";
 echo " {$strby} {$update_user}";