<?php

// helpdesk.php - PHProjekt Version 5.0
// copyright  ©  2000-2005 Albrecht Guenther  ag@phprojekt.com
// www.phprojekt.com
// Author: Albrecht Guenther, $Author: paolo $
// $Id: helpdesk.php,v 1.24 2005/06/17 20:33:02 paolo Exp $

$module = 'helpdesk';
$contextmenu = 1;

$path_pre = '../';
$include_path = $path_pre.'lib/lib.inc.php';
include_once($include_path);

$_SESSION['common']['module'] = 'helpdesk';

// check whether there is a general rts mail in the config. if not, assign give the email of the user
if (!PHPR_RTS_MAIL) $rts_mail = $user_email;
else                $rts_mail = PHPR_RTS_MAIL;


// access: = = n/a, 1 = internal, 2 = open. only solved requests with access = 2 are in the knowledge base
$access = array( '0' => __('n/a'), '1' => __('internal'), '2' => __('open') );

// database cols according to user role
$recipient_column = '9';  // to whom the ticket is assigned to
$author_column    = '21'; // who has checked in this ticket


// helpdesk states
// field status:  0 = optional, 1 = mandatory, 2 = remove from workflow
$helpdesk_states = array(
    array('mandatory' => 0, 'key' => 'unconfirmed', 'label' => __('unconfirmed')),
    array('mandatory' => 0, 'key' => 'new', 'label' => __('new')),
    array('mandatory' => 1, 'key' => 'assigned', 'label' => __('assigned')),
    array('mandatory' => 0, 'key' => 'reopened', 'label' => __('reopened')),
    array('mandatory' => 0, 'key' => 'solved', 'label' => __('solved')), /* this state is a must state -> after reaching this state customers will be notified */
    array('mandatory' => 0, 'key' => 'verified', 'label' => __('verified')),
    array('mandatory' => 1, 'key' => 'closed', 'label' => __('closed'))
);


$status_arr = array();
$hd_i = 1;
foreach($helpdesk_states as $hd_state) {
    $status_arr[$hd_i] = array ($hd_state['key'], array($recipient_column, $author_column), $hd_state['mandatory'], $hd_state['label']);
    $hd_i++;
}

require_once($path_pre.'lib/dbman_lib.inc.php');

if (!$mode) $mode = "view";
else        $mode = xss($mode);

$ID = (int) $ID;

$fields = build_array('helpdesk', $ID, $mode);

$output = '';
echo set_page_header();

include_once($path_pre.'lib/navigation.inc.php');
echo '<div class="outer_content">';
echo "<div class='content'>";
include_once('./helpdesk_'.$mode.'.php');
echo '</div>';
echo '</div>';
echo "\n</body>\n</html>\n";

?>
