// breakdown.inc.php - Displays the incidents for a particular day and condition (i.e. closed, opened etc)
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2000-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// Author: Paul Heaney <paulheaney[at]users.sourceforge.net>
// Included by ../statistics.php
// Prevent script from being run directly (ie. it must always be included
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
    exit;
}
$sql = get_sql_statement($startdate, $enddate, $query, FALSE);
$result = mysql_query($sql);
if (mysql_error()) {
    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
}
$start_str = date("Y-m-d", $startdate);
$end_str = date("Y-m-d", $enddate);
switch ($query) {
    case 0:
        $type = 'opened';
        break;
    case 1:
        $type = 'closed';
        break;
    case 2:
        $type = 'updated';
Esempio n. 2
0
/**
    * Show Open, Closed, Updated today, this week, this month etc.
    * @author Paul Heaney
*/
function count_incidents($startdate, $enddate)
{
    // Counts the number of incidents opened between a start date and an end date
    // Returns an associative array
    // 0
    $sql = get_sql_statement($startdate, $enddate, 0);
    $result = mysql_query($sql);
    list($count['opened']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 1
    $sql = get_sql_statement($startdate, $enddate, 1);
    $result = mysql_query($sql);
    list($count['closed']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 2
    $sql = get_sql_statement($startdate, $enddate, 2);
    $result = mysql_query($sql);
    list($count['updated']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 3
    $sql = get_sql_statement($startdate, $enddate, 3);
    $result = mysql_query($sql);
    list($count['handled']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 4
    $sql = get_sql_statement($startdate, $enddate, 4);
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    list($count['updates'], $count['users']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 5
    $sql = get_sql_statement($startdate, $enddate, 5);
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    list($count['skills'], $count['owners']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 6
    $sql = get_sql_statement($startdate, $enddate, 6);
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    list($count['emailtx']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 7
    $sql = get_sql_statement($startdate, $enddate, 7);
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    list($count['emailrx']) = mysql_fetch_row($result);
    mysql_free_result($result);
    // 8
    $sql = get_sql_statement($startdate, $enddate, 8);
    $result = mysql_query($sql);
    list($count['higherpriority']) = mysql_fetch_row($result);
    mysql_free_result($result);
    return $count;
}