예제 #1
0
$trackings = get_db_all_rows_field_filter ('tincident_track', 'id_incident', $id, 'timestamp DESC, id_it DESC');

if ($trackings !== false) {
	unset($table);
	$table = new StdClass;
	$table->width = "100%";
	$table->class = 'listing';
	$table->data = array ();
	$table->head = array ();
	$table->head[0] = __('Description');
	$table->head[1] = __('User');
	$table->head[2] = __('Date');
	$table->style[2] = "width: 150px";

	foreach ($trackings as $tracking) {
		$data = array ();
		
		$data[0] = $tracking['description'];
		$data[1] = dame_nombre_real ($tracking['id_user']);
		$data[2] = $tracking['timestamp'];
	
		array_push ($table->data, $data);
	}
	echo "<center>";
	print_table ($table);
	echo "</center>";
} else {
	echo __('No data available');
}
?>
예제 #2
0
    $disabled_creator = false;
    if (!$config["change_creator_owner"] || $blocked_incident) {
        $disabled_creator = true;
    }
    $params_assigned['input_id'] = 'text-id_user';
    $params_assigned['input_name'] = 'id_user';
    $params_assigned['input_value'] = $assigned_user_for_this_incident;
    $params_assigned['title'] = __('Owner');
    $params_assigned['help_message'] = __("User assigned here is user that will be responsible to manage tickets. If you are opening a ticket and want to be resolved by someone different than yourself, please assign to other user");
    $params_assigned['return'] = true;
    $params_assigned['return_help'] = true;
    $params_assigned['disabled'] = $disabled_creator;
    $table->data[2][1] = user_print_autocomplete_input($params_assigned);
} else {
    $table->data[2][1] = print_input_hidden('id_user', $assigned_user_for_this_incident, true, __('Owner'));
    $table->data[2][1] .= print_label(__('Owner'), 'id_user', '', true, '<div id="plain-id_user">' . dame_nombre_real($assigned_user_for_this_incident) . '</div>');
}
// closed by
if (!$create_incident) {
    $params_closed['input_id'] = 'text-closed_by';
    $params_closed['input_name'] = 'closed_by';
    $params_closed['input_value'] = $closed_by;
    $params_closed['title'] = __('Closed by');
    $params_closed['help_message'] = __("User assigned here is user that will be responsible to close the ticket.");
    $params_closed['return'] = true;
    $params_closed['return_help'] = true;
    $params_closed['disabled'] = $blocked_incident;
    //Only print closed by option when incident status is closed
    if ($incident["estado"] == STATUS_CLOSED) {
        $table->data[2][2] = "<div id='closed_by_wrapper'>";
    } else {
예제 #3
0
if (isset($_GET["id"])) {
    $id_inc = $_GET["id"];
    $iduser_temp = $_SESSION['id_usuario'];
    // Obtain group of this incident
    $sql1 = 'SELECT * FROM tincidencia WHERE id_incidencia = ' . $id_inc;
    $result = mysql_query($sql1);
    $row = mysql_fetch_array($result);
    // Get values
    $titulo = $row["titulo"];
    $texto = $row["descripcion"];
    $inicio = $row["inicio"];
    $actualizacion = $row["actualizacion"];
    $estado = $row["estado"];
    $prioridad = $row["prioridad"];
    $usuario = $row["id_usuario"];
    $nombre_real = dame_nombre_real($usuario);
    $id_grupo = $row["id_grupo"];
    $id_creator = $row["id_creator"];
    $grupo = dame_nombre_grupo($id_grupo);
    $result_msg = "";
    $id_user = $_SESSION['id_usuario'];
    if (give_acl($iduser_temp, $id_grupo, "IR") != 1) {
        // Doesn't have access to this page
        audit_db($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access to ticket " . $id_inc . " '" . $titulo . "'");
        include "general/noaccess.php";
        exit;
    }
    // Delete note
    if (isset($_GET["id_nota"])) {
        $note_user = give_note_author($_GET["id_nota"]);
        if (give_acl($iduser_temp, $id_grupo, "IM") || $note_user == $iduser_temp || ($usuario = $iduser_temp)) {
예제 #4
0
	$params_assigned['title'] = __('Owner');
	$params_assigned['help_message'] = __("The user assigned here will be responsible for managing tickets. If you are opening a ticket and want it to be solved by someone other than yourself, assign this value to another user.");
	$params_assigned['return'] = true;
	$params_assigned['return_help'] = true;
	$params_assigned['disabled'] = $disabled_creator;
	$params_assigned['attributes'] = 'style="width:210px;"';
	$table->data[2][1] = user_print_autocomplete_input($params_assigned);
	
	if (!$disabled_creator) {
		//add button to display info user for owner
		$table->data[2][1] .= "&nbsp;&nbsp;<a href='javascript: incident_show_user_search(\"\", 1);'>" . print_image('images/add.png', true, array('title' => __('Add'))) . "</a>";
	}
} else {
	$table->data[2][1] = print_input_hidden ('id_user', $assigned_user_for_this_incident, true, __('Owner'));
	$table->data[2][1] .= print_label (__('Owner'), 'id_user', '', true,
	'<div id="plain-id_user">'.dame_nombre_real ($assigned_user_for_this_incident).'</div>');
}

// closed by
if (!$create_incident){
	$params_closed['input_id'] = 'text-closed_by';
	$params_closed['input_name'] = 'closed_by';
	$params_closed['input_value'] = $closed_by;
	$params_closed['title'] = __('Closed by');
	$params_closed['help_message'] = __("User assigned here is user that will be responsible to close the ticket.");
	$params_closed['return'] = true;
	$params_closed['return_help'] = true;
	$params_closed['disabled'] = $blocked_incident;
	$params_closed['attributes'] = 'style="width:210px;"';
	//Only print closed by option when incident status is closed
	if ($incident["estado"] == STATUS_CLOSED) {
 $ticket_editor .= print_select(get_priorities(true), 'priority_editor', $priority, "", '', '', true, false, false, __('Priority'), false, '');
 $ticket_editor .= "</td>";
 $ticket_editor .= "<td>";
 //If IW creator enabled flag is enabled, the user can change the creator
 if ($has_im || $has_iw && $config['iw_creator_enabled']) {
     $src_code = print_image('images/group.png', true, false, true);
     $params_assigned['input_id'] = 'text-owner_editor';
     $params_assigned['input_name'] = 'owner_editor';
     $params_assigned['input_value'] = $owner;
     $params_assigned['title'] = __('Owner');
     $params_assigned['help_message'] = __("User assigned here is user that will be responsible to manage tickets. If you are opening a ticket and want to be resolved by someone different than yourself, please assign to other user");
     $params_assigned['return'] = true;
     $params_assigned['return_help'] = true;
     $ticket_editor .= user_print_autocomplete_input($params_assigned);
 } else {
     $ticket_editor .= print_label(__('Owner'), 'id_user', '', true, '<div id="plain-id_user">' . dame_nombre_real($owner) . '</div>');
 }
 $ticket_editor .= "</td>";
 $ticket_editor .= "</tr>";
 $ticket_editor .= "<tr>";
 $ticket_editor .= "<td>";
 if ($has_im) {
     $ticket_editor .= combo_incident_resolution($resolution, false, true, false, "");
 } else {
     $ticket_editor .= print_label(__('Resolution'), '', '', true, render_resolution($resolution));
 }
 $ticket_editor .= "</td>";
 $ticket_editor .= "<td>";
 $ticket_editor .= combo_incident_status($status, false, 0, true, false, "");
 $ticket_editor .= "</td>";
 $ticket_editor .= "<td>";
예제 #6
0
파일: wo.php 프로젝트: articaST/integriaims

		if ($creator != $config["id_user"]){
			$table->data[2][0] = print_label (__("Submitter"), '', 'input', true);
			$table->data[2][0] .= dame_nombre_real($creator);
			$table->data[2][0] .= print_input_hidden ("creator", $creator, true);
		} else {
			$table->data[2][0] = print_input_text_extended ('creator', $creator, 'text-user2', '', 15, 30, false, '',
				'', true, '', __('Submitter'))

			. print_help_tip (__("Type at least two characters to search"), true);
		}
		
		if ($creator != $config["id_user"] && !$section_permission['write']){
			$table->data[2][1] = print_label (__("Assigned user"), '', 'input', true);
			$table->data[2][1] .= dame_nombre_real($assigned_user);		
			$table->data[2][1] .= print_input_hidden ("assigned_user", $assigned_user, true);
		} else {
			$params['input_id'] = 'text-user';
			$params['input_name'] = 'assigned_user';
			$params['input_size'] = 30;
			$params['input_maxlength'] = 100;
			$params['input_value'] = $assigned_user;
			$params['title'] = 'Assigned user';
			$params['return'] = true;
			$params['return_help'] = true;
				
			$table->data[2][1] = user_print_autocomplete_input($params);
		}
		
예제 #7
0
		include ("general/noaccess.php");
		exit;
	}
}

// --------------------
// Workunit report
// --------------------

$ahora = date("Y-m-d H:i:s");
if ($timestamp_h == "")
	$timestamp_h == $ahora ;
echo "<h2>";

echo __('Workunit personal report for user');
echo " '". dame_nombre_real($id_user). "'.";


echo "</h2>";

echo "<h4>";
echo __("Between dates");
if ($timestamp_l != "" AND $timestamp_h != "")
	echo " : ".$timestamp_l. " ".__("to")." ".$timestamp_h;

if ($id_task != 0)
    echo __("Task"). " : ".get_db_sql("SELECT name FROM ttask WHERE id = $id_task");

$now_year = date("Y");
$now_month = date("m");
예제 #8
0
/**
 * Check an SLA inactivity value on an incident and send email (to incident owner) if needed.
 *
 * @param array Incident to check
 */
function check_sla_inactivity($incident)
{
    global $compare_timestamp;
    global $config;
    $id_sla = check_incident_sla_max_inactivity($incident['id_incidencia']);
    if (!$id_sla) {
        return false;
    }
    $sla = get_db_row("tsla", "id", $id_sla);
    /* Check if it was already notified in a specified time interval */
    $sql = sprintf('SELECT COUNT(id) FROM tevent
		WHERE type = "SLA_MAX_INACTIVITY_NOTIFY"
		AND id_item = %d
		AND timestamp > "%s"', $incident['id_incidencia'], $compare_timestamp);
    $notified = get_db_sql($sql);
    if ($notified > 0) {
        return true;
    }
    /* We need to notify via email to the owner user */
    $user = get_user($incident['id_usuario']);
    $MACROS["_sitename_"] = $config["sitename"];
    $MACROS["_username_"] = $incident['id_usuario'];
    $MACROS["_fullname_"] = dame_nombre_real($incident['id_usuario']);
    $MACROS["_group_"] = dame_nombre_grupo($incident['id_grupo']);
    $MACROS["_incident_id_"] = $incident["id_incidencia"];
    $MACROS["_incident_title_"] = $incident['titulo'];
    $MACROS["_data1_"] = give_human_time($sla['max_inactivity'] * 3600);
    $access_dir = empty($config['access_public']) ? $config["base_url"] : $config['public_url'];
    $MACROS["_access_url_"] = $access_dir . "/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=" . $incident['id_incidencia'];
    $text = template_process($config["homedir"] . "/include/mailtemplates/incident_sla_max_inactivity_time.tpl", $MACROS);
    $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_sla_max_inactivity_time_subject.tpl", $MACROS);
    if ($sla['enforced'] == 1) {
        integria_sendmail($user['direccion'], $subject, $text);
        insert_event('SLA_MAX_INACTIVITY_NOTIFY', $incident['id_incidencia']);
    } else {
        insert_event('SLA_MAX_INACTIVITY_NOTIFY', $incident['id_incidencia']);
    }
}
예제 #9
0
function mail_project($mode, $id_user, $id_workunit, $id_task, $additional_msg = "")
{
    global $config;
    $workunit = get_db_row("tworkunit", "id", $id_workunit);
    $task = get_db_row("ttask", "id", $id_task);
    $project = get_db_row("tproject", "id", $task["id_project"]);
    $id_project = $task["id_project"];
    $id_manager = $project["id_owner"];
    $cc_project = $project["cc"];
    $cc_task = $task["cc"];
    $MACROS["_time_used_"] = $workunit["duration"];
    $access_dir = empty($config['access_public']) ? $config["base_url"] : $config['public_url'];
    $MACROS["_access_url_"] = $access_dir . "/index.php?sec=projects&sec2=operation/projects/task_workunit&id_project={$id_project}&id_task={$id_task}";
    if ($workunit["have_cost"] == 1) {
        $MACROS["_havecost_"] = __('Yes');
    } else {
        $MACROS["_havecost_"] = __('No');
    }
    if ($workunit["public"] == 1) {
        $MACROS["_public_"] = __('Yes');
    } else {
        $MACROS["_public_"] = __('No');
    }
    $MACROS["_sitename_"] = $config["sitename"];
    $MACROS["_taskname_"] = $task["name"];
    $MACROS["_projectname_"] = $project["name"];
    $MACROS["_fullname_"] = dame_nombre_real($project["id_owner"]);
    $MACROS["_update_timestamp_"] = $workunit["timestamp"];
    $MACROS["_owner_"] = $project["id_owner"];
    $MACROS["_wu_text_"] = $workunit["description"];
    $MACROS["_wu_user_"] = dame_nombre_real($id_user);
    $MACROS["_additional_message_"] = $additional_msg;
    $description = $workunit["description"];
    switch ($mode) {
        case 0:
            // Workunit add
            $text = template_process($config["homedir"] . "/include/mailtemplates/project_wu_create.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/project_subject_wucreate.tpl", $MACROS);
            break;
        case 1:
            // Workunit updated
            $text = template_process($config["homedir"] . "/include/mailtemplates/project_wu_update.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/project_subject_wuupdate.tpl", $MACROS);
            break;
    }
    if (!user_is_disabled($id_manager)) {
        // Send an email to project manager
        integria_sendmail(get_user_email($id_manager), $subject, $text);
    }
    if ($cc_project != "") {
        integria_sendmail($cc_project, $subject, $text);
    }
    if ($cc_task != "") {
        integria_sendmail($cc_task, $subject, $text);
    }
}
예제 #10
0
function mail_incident($id_inc, $id_usuario, $nota, $timeused, $mode, $public = 1)
{
    global $config;
    include_once $config["homedir"] . '/include/functions_user.php';
    clean_cache_db();
    $row = get_db_row("tincidencia", "id_incidencia", $id_inc);
    $group_name = get_db_sql("SELECT nombre FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $email_from = get_db_sql("SELECT email_from FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $titulo = $row["titulo"];
    $description = wordwrap(ascii_output($row["descripcion"]), 70, "\n");
    $prioridad = get_priority_name($row["prioridad"]);
    $nota = wordwrap($nota, 75, "\n");
    $estado = render_status($row["estado"]);
    $resolution = render_resolution($row["resolution"]);
    $create_timestamp = $row["inicio"];
    $update_timestamp = $row["actualizacion"];
    $usuario = $row["id_usuario"];
    $creator = $row["id_creator"];
    $email_copy = $row["email_copy"];
    // Send email for owner and creator of this incident
    $email_creator = get_user_email($creator);
    $company_creator = get_user_company($creator, true);
    if (empty($company_creator)) {
        $company_creator = "";
    } else {
        $company_creator = " (" . reset($company_creator) . ")";
    }
    $email_owner = get_user_email($usuario);
    $company_owner = get_user_company($usuario, true);
    if (empty($company_owner)) {
        $company_owner = "";
    } else {
        $company_owner = " (" . reset($company_owner) . ")";
    }
    //check if user is disabled
    $owner_disabled = user_is_disabled($usuario);
    $creator_disabled = user_is_disabled($creator);
    $ticket_score = '';
    if ($row["estado"] == 7 and $row['score'] == 0) {
        $ticket_score = $config["base_url"] . "/index.php?sec=incidents&sec2=operation/incidents/incident_detail&id={$id_inc}";
        //$ticket_score =  '<a href="'.$config["base_url"].'"/index.php?sec=incidents&sec2=operation/incidents/incident_detail&id="'.$id_inc.'">'."Click hear to scoring".'</a>';
    }
    $MACROS["_sitename_"] = $config["sitename"];
    $MACROS["_fullname_"] = dame_nombre_real($usuario);
    $MACROS["_username_"] = $usuario;
    $MACROS["_incident_id_"] = $id_inc;
    $MACROS["_incident_title_"] = $titulo;
    $MACROS["_creation_timestamp_"] = $create_timestamp;
    $MACROS["_update_timestamp_"] = $update_timestamp;
    $MACROS["_group_"] = $group_name;
    $MACROS["_author_"] = dame_nombre_real($creator) . $company_creator;
    $MACROS["_owner_"] = dame_nombre_real($usuario) . $company_owner;
    $MACROS["_priority_"] = $prioridad;
    $MACROS["_status_"] = $estado;
    $MACROS["_resolution_"] = $resolution;
    $MACROS["_time_used_"] = $timeused;
    $MACROS["_incident_main_text_"] = $description;
    $access_dir = empty($config['access_public']) ? $config["base_url"] : $config['public_url'];
    $MACROS["_access_url_"] = $access_dir . "/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id={$id_inc}";
    $MACROS["_incident_epilog_"] = $row["epilog"];
    $MACROS["_incident_closed_by_"] = $row["closed_by"];
    // Resolve code for its name
    switch ($mode) {
        case 10:
            // Add Workunit
            //$subject = "[".$config["sitename"]."] Incident #$id_inc ($titulo) has a new workunit from [$id_usuario]";
            $company_wu = get_user_company($id_usuario, true);
            if (empty($company_wu)) {
                $company_wu = "";
            } else {
                $company_wu = " (" . reset($company_wu) . ")";
            }
            $MACROS["_wu_user_"] = dame_nombre_real($id_usuario) . $company_wu;
            $MACROS["_wu_text_"] = $nota;
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update_wu.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_new_wu.tpl", $MACROS);
            break;
        case 0:
            // Incident update
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_update.tpl", $MACROS);
            break;
        case 1:
            // Incident creation
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_create.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_create.tpl", $MACROS);
            break;
        case 2:
            // New attach
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_attach.tpl", $MACROS);
            break;
        case 3:
            // Incident deleted
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_delete.tpl", $MACROS);
            break;
        case 5:
            // Incident closed
            $MACROS["_ticket_score_"] = $ticket_score;
            $text = template_process($config["homedir"] . "/include/mailtemplates/incident_close.tpl", $MACROS);
            $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_close.tpl", $MACROS);
            break;
    }
    // Create the TicketID for have a secure reference to incident hidden
    // in the message. Will be used for POP automatic processing to add workunits
    // to the incident automatically.
    $msg_code = "TicketID#{$id_inc}";
    $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row["id_usuario"]), 0, 5);
    $msg_code .= "/" . $row["id_usuario"];
    if ((!$config['email_ticket_on_creation_and_closing'] || $mode == 5 || $mode == 1) && !$owner_disabled) {
        integria_sendmail($email_owner, $subject, $text, false, $msg_code, $email_from, 0, "", "X-Integria: no_process");
    }
    // Send a copy to each address in "email_copy"
    //if ($email_copy != ""){
    if ($email_copy != "" && !$config['email_ticket_on_creation_and_closing']) {
        $emails = explode(",", $email_copy);
        foreach ($emails as $em) {
            integria_sendmail($em, $subject, $text, false, "", $email_from, 0, "", "X-Integria: no_process");
        }
    }
    // Incident owner
    if ($email_owner != $email_creator and !$config['email_ticket_on_creation_and_closing'] and !$creator_disabled) {
        $msg_code = "TicketID#{$id_inc}";
        $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row["id_creator"]), 0, 5);
        $msg_code .= "/" . $row["id_creator"];
        integria_sendmail($email_creator, $subject, $text, false, $msg_code, $email_from, "", 0, "", "X-Integria: no_process");
    }
    //if ($public == 1){
    if ($public == 1 and !$config['email_ticket_on_creation_and_closing']) {
        // Send email for all users with workunits for this incident
        $sql1 = "SELECT DISTINCT(tusuario.direccion), tusuario.id_usuario FROM tusuario, tworkunit, tworkunit_incident WHERE tworkunit_incident.id_incident = {$id_inc} AND tworkunit_incident.id_workunit = tworkunit.id AND tworkunit.id_user = tusuario.id_usuario AND tusuario.disabled=0";
        if ($result = mysql_query($sql1)) {
            while ($row = mysql_fetch_array($result)) {
                if ($row[0] != $email_owner and $row[0] != $email_creator) {
                    $msg_code = "TicketID#{$id_inc}";
                    $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row[1]), 0, 5);
                    $msg_code .= "/" . $row[1];
                    integria_sendmail($row[0], $subject, $text, false, $msg_code, $email_from, "", 0, "", "X-Integria: no_process");
                }
            }
        }
        // Send email to incident reporters associated to this incident
        if ($config['incident_reporter'] == 1) {
            $contacts = get_incident_contact_reporters($id_inc, true);
            if ($contats) {
                foreach ($contacts as $contact) {
                    $contact_email = get_db_sql("SELECT email FROM tcompany_contact WHERE fullname = '{$contact}'");
                    integria_sendmail($contact_email, $subject, $text, false, $msg_code, $email_from, "", 0, "", "X-Integria: no_process");
                }
            }
        }
    }
}
예제 #11
0
                $descripcion = __('File added');
                break;
            case 16:
                $descripcion = __('Task completion progress updated');
                break;
            case 17:
                $descripcion = __('Task finished');
                break;
            case 18:
                $descripcion = __('Task member updated');
                break;
            case 19:
                $descripcion = __('Task moved');
                break;
            case 20:
                $descripcion = __('Task deleted');
                break;
            default:
                $descripcion = __('Unknown');
        }
        echo $descripcion;
        echo '<td>';
        $nombre_real = dame_nombre_real($user);
        echo " {$nombre_real}";
        echo '<td class="f9">';
        echo $timestamp;
    }
    echo "</table>";
} else {
    echo __('No data available');
}
예제 #12
0
function mail_incident($id_inc, $id_usuario, $nota, $timeused, $mode, $public = 1)
{
    global $config;
    include_once $config["homedir"] . '/include/functions_user.php';
    include_once $config["homedir"] . '/include/functions_db.php';
    include_once $config["homedir"] . '/include/functions_db.mysql.php';
    clean_cache_db();
    $row = get_db_row("tincidencia", "id_incidencia", $id_inc);
    $group_name = get_db_sql("SELECT nombre FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $email_group = get_db_sql("SELECT email_group FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $forced_email = get_db_sql("SELECT forced_email FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $user_defect_group = get_db_sql("SELECT id_user_default FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $email_from = get_db_sql("SELECT email_from FROM tgrupo WHERE id_grupo = " . $row["id_grupo"]);
    $type_ticket = get_db_sql("SELECT name FROM tincident_type WHERE id = " . $row["id_incident_type"]);
    $titulo = $row["titulo"];
    $description = $row["descripcion"];
    $prioridad = get_priority_name($row["prioridad"]);
    $estado = render_status($row["estado"]);
    $resolution = render_resolution($row["resolution"]);
    $create_timestamp = $row["inicio"];
    $update_timestamp = $row["actualizacion"];
    $usuario = $row["id_usuario"];
    $creator = $row["id_creator"];
    $email_copy = $row["email_copy"];
    // Send email for owner and creator of this incident
    $email_creator = get_user_email($creator);
    $company_creator = get_user_company($creator, true);
    if (empty($company_creator)) {
        $company_creator = "";
    } else {
        $company_creator = " (" . reset($company_creator) . ")";
    }
    $email_owner = get_user_email($usuario);
    $company_owner = get_user_company($usuario, true);
    if (empty($company_owner)) {
        $company_owner = "";
    } else {
        $company_owner = " (" . reset($company_owner) . ")";
    }
    //check if user is disabled
    $owner_disabled = user_is_disabled($usuario);
    $creator_disabled = user_is_disabled($creator);
    $ticket_score = '';
    if ($row["estado"] == 7 and $row['score'] == 0) {
        $ticket_score = $config["base_url"] . "/index.php?sec=incidents&sec2=operation/incidents/incident_detail&id={$id_inc}";
        //$ticket_score =  '<a href="'.$config["base_url"].'"/index.php?sec=incidents&sec2=operation/incidents/incident_detail&id="'.$id_inc.'">'."Click hear to scoring".'</a>';
    }
    //name for fields
    $sql_name_custom = 'select ttf.label from tincident_field_data tfd, tincident_type_field ttf 
						where tfd.id_incident_field = ttf.id and tfd.id_incident=' . $id_inc . ';';
    $name_custom = get_db_all_rows_sql($sql_name_custom);
    if ($name_custom === false) {
        $name_custom = array();
    }
    foreach ($name_custom as $p) {
        //value according to the name of the custom fields
        $sql_value_custom = "select tfd.data from tincident_field_data tfd, tincident_type_field ttf \n\t\t\t\t\t\t\t where tfd.id_incident_field = ttf.id and tfd.id_incident=" . $id_inc . " and ttf.label='" . $p['label'] . "';";
        $value_custom = get_db_sql($sql_value_custom);
        $MACROS['_' . $p['label'] . '_'] = $value_custom;
    }
    $MACROS["_sitename_"] = $config["sitename"];
    $MACROS["_fullname_"] = dame_nombre_real($usuario);
    $MACROS["_username_"] = $usuario;
    $MACROS["_incident_id_"] = $id_inc;
    $MACROS["_incident_title_"] = $titulo;
    $MACROS["_creation_timestamp_"] = $create_timestamp;
    $MACROS["_update_timestamp_"] = $update_timestamp;
    $MACROS["_group_"] = $group_name;
    $MACROS["_author_"] = dame_nombre_real($creator) . $company_creator;
    $MACROS["_owner_"] = dame_nombre_real($usuario) . $company_owner;
    $MACROS["_priority_"] = $prioridad;
    $MACROS["_status_"] = $estado;
    $MACROS["_resolution_"] = $resolution;
    $MACROS["_time_used_"] = $timeused;
    $MACROS["_incident_main_text_"] = $description;
    $access_dir = empty($config['access_public']) ? $config["base_url"] : $config['public_url'];
    $MACROS["_access_url_"] = $access_dir . "/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id={$id_inc}";
    $MACROS["_incident_epilog_"] = $row["epilog"];
    $MACROS["_incident_closed_by_"] = $row["closed_by"];
    $MACROS["_type_tickets_"] = $type_ticket;
    // Resolve code for its name
    switch ($mode) {
        case 10:
            // Add Workunit
            //$subject = "[".$config["sitename"]."] Incident #$id_inc ($titulo) has a new workunit from [$id_usuario]";
            $company_wu = get_user_company($id_usuario, true);
            if (empty($company_wu)) {
                $company_wu = "";
            } else {
                $company_wu = " (" . reset($company_wu) . ")";
            }
            $MACROS["_wu_user_"] = dame_nombre_real($id_usuario) . $company_wu;
            $MACROS["_wu_text_"] = $nota;
            // Do not pass to safe_output. $nota is already HTML Safe in this point
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 7 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 6 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update_wu.tpl", $MACROS);
            } else {
                $text = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_new_wu.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            break;
        case 0:
            // Incident update
            $attachments = "";
            $images = "";
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 9 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 8 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text .= template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            } else {
                $text .= template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_update.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            $attached_files = get_db_all_rows_sql("SELECT * FROM tattachment WHERE id_incidencia=" . $id_inc);
            if ($attached_files === false) {
                $attached_files = array();
            }
            $i = 0;
            $j = 0;
            foreach ($attached_files as $file) {
                $file_name = $file['id_attachment'] . '_' . $file['filename'];
                $access_public = get_db_value("value", "tconfig", "token", "access_public");
                $access_protocol = get_db_value("value", "tconfig", "token", "access_protocol");
                if ($access_protocol) {
                    $protocol = "https://";
                } else {
                    $protocol = "http://";
                }
                $ext = strtolower(substr($file['filename'], -3, 3));
                if ($ext == "jpg" || $ext == "png" || $ext == "gif") {
                    $path_file = $protocol . $access_public . '/' . $config['baseurl'] . '/attachment/' . $file_name;
                    if ($j == 0) {
                        $images = $path_file;
                    } else {
                        $images .= ',' . $path_file;
                    }
                    $j++;
                } else {
                    $path_file = $config['homedir'] . "attachment/" . $file_name;
                    if ($i == 0) {
                        $attachments = $path_file;
                    } else {
                        $attachments .= ',' . $path_file;
                    }
                    $i++;
                }
            }
            break;
        case 1:
            // Incident creation
            $attachments = "";
            $images = "";
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 0 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 1 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text .= template_process($config["homedir"] . "/include/mailtemplates/incident_create.tpl", $MACROS);
            } else {
                $text .= template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_create.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            $attached_files = get_db_all_rows_sql("SELECT * FROM tattachment WHERE id_incidencia=" . $id_inc);
            if ($attached_files === false) {
                $attached_files = array();
            }
            $i = 0;
            $j = 0;
            foreach ($attached_files as $file) {
                $file_name = $file['id_attachment'] . '_' . $file['filename'];
                $access_public = get_db_value("value", "tconfig", "token", "access_public");
                $access_protocol = get_db_value("value", "tconfig", "token", "access_protocol");
                if ($access_protocol) {
                    $protocol = "https://";
                } else {
                    $protocol = "http://";
                }
                $ext = strtolower(substr($file['filename'], -3, 3));
                if ($ext == "jpg" || $ext == "png" || $ext == "gif") {
                    $path_file = $protocol . $access_public . '/' . $config['baseurl'] . '/attachment/' . $file_name;
                    if ($j == 0) {
                        $images = $path_file;
                    } else {
                        $images .= ',' . $path_file;
                    }
                    $j++;
                } else {
                    $path_file = $config['homedir'] . "attachment/" . $file_name;
                    if ($i == 0) {
                        $attachments = $path_file;
                    } else {
                        $attachments .= ',' . $path_file;
                    }
                    $i++;
                }
            }
            break;
        case 2:
            // New attach
            $attachments = "";
            $images = "";
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 9 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 4 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            } else {
                $text = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_attach.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            $attached_files = get_db_all_rows_sql("SELECT * FROM tattachment WHERE id_incidencia=" . $id_inc);
            if ($attached_files === false) {
                $attached_files = array();
            }
            $i = 0;
            $j = 0;
            foreach ($attached_files as $file) {
                $file_name = $file['id_attachment'] . '_' . $file['filename'];
                $access_public = get_db_value("value", "tconfig", "token", "access_public");
                $access_protocol = get_db_value("value", "tconfig", "token", "access_protocol");
                if ($access_protocol) {
                    $protocol = "https://";
                } else {
                    $protocol = "http://";
                }
                $ext = strtolower(substr($file['filename'], -3, 3));
                if ($ext == "jpg" || $ext == "png" || $ext == "gif") {
                    $path_file = $protocol . $access_public . '/' . $config['baseurl'] . '/attachment/' . $file_name;
                    if ($j == 0) {
                        $images = $path_file;
                    } else {
                        $images .= ',' . $path_file;
                    }
                    $j++;
                } else {
                    $path_file = $config['homedir'] . "attachment/" . $file_name;
                    if ($i == 0) {
                        $attachments = $path_file;
                    } else {
                        $attachments .= ',' . $path_file;
                    }
                    $i++;
                }
            }
            break;
        case 3:
            // Incident deleted
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 9 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 5 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text = template_process($config["homedir"] . "/include/mailtemplates/incident_update.tpl", $MACROS);
            } else {
                $text = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_delete.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            break;
        case 5:
            // Incident closed
            $MACROS["_ticket_score_"] = $ticket_score;
            $temp_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $group_name);
            $sql_body = "SELECT name FROM temail_template WHERE template_action = 2 AND id_group =" . $temp_group . ";";
            $sql_subject = "SELECT name FROM temail_template WHERE template_action = 3 AND id_group =" . $temp_group . ";";
            $templa_body = get_db_sql($sql_body);
            $templa_subj = get_db_sql($sql_subject);
            if (!$templa_body) {
                $text = template_process($config["homedir"] . "/include/mailtemplates/incident_close.tpl", $MACROS);
            } else {
                $text = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_body . ".tpl", $MACROS);
            }
            if (!$templa_subj) {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/incident_subject_close.tpl", $MACROS);
            } else {
                $subject = template_process($config["homedir"] . "/include/mailtemplates/" . $templa_subj . ".tpl", $MACROS);
            }
            break;
    }
    // Create the TicketID for have a secure reference to incident hidden
    // in the message. Will be used for POP automatic processing to add workunits
    // to the incident automatically.
    if ($public != 7) {
        //owner
        $msg_code = "TicketID#{$id_inc}";
        $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row["id_usuario"]), 0, 5);
        $msg_code .= "/" . $row["id_usuario"];
        integria_sendmail($email_owner, $subject, $text, $attachments, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
        //creator
        if ($email_owner != $email_creator) {
            $msg_code = "TicketID#{$id_inc}";
            $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row["id_creator"]), 0, 5);
            $msg_code .= "/" . $row["id_creator"];
            integria_sendmail($email_creator, $subject, $text, $attachments, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
        }
        // Send emails to the people in the group added
        if ($forced_email != 0) {
            $email_default = get_user_email($user_defect_group);
            integria_sendmail($email_default, $subject, $text, $attachments, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
            if ($email_group) {
                $email_g = explode(',', $email_group);
                foreach ($email_g as $k) {
                    integria_sendmail($k, $subject, $text, $attachments, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
                }
            }
        }
    }
    if ($public == 7) {
        // Send a copy to each address in "email_copy"
        if ($email_copy != "") {
            $emails = explode(",", $email_copy);
            foreach ($emails as $em) {
                integria_sendmail($em, $subject, $text, $attachments, "", $email_from, 0, "", "X-Integria: no_process", $images);
            }
        }
    }
    if ($public == 1) {
        // Send email for all users with workunits for this incident
        $sql1 = "SELECT DISTINCT(tusuario.direccion), tusuario.id_usuario FROM tusuario, tworkunit, tworkunit_incident WHERE tworkunit_incident.id_incident = {$id_inc} AND tworkunit_incident.id_workunit = tworkunit.id AND tworkunit.id_user = tusuario.id_usuario AND tusuario.disabled=0";
        if ($result = mysql_query($sql1)) {
            while ($row = mysql_fetch_array($result)) {
                if ($row[0] != $email_owner and $row[0] != $email_creator) {
                    $msg_code = "TicketID#{$id_inc}";
                    $msg_code .= "/" . substr(md5($id_inc . $config["smtp_pass"] . $row[1]), 0, 5);
                    $msg_code .= "/" . $row[1];
                    integria_sendmail($row[0], $subject, $text, false, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
                }
            }
        }
        // Send email to incident reporters associated to this incident
        if ($config['incident_reporter'] == 1) {
            $contacts = get_incident_contact_reporters($id_inc, true);
            if ($contats) {
                foreach ($contacts as $contact) {
                    $contact_email = get_db_sql("SELECT email FROM tcompany_contact WHERE fullname = '{$contact}'");
                    integria_sendmail($contact_email, $subject, $text, false, $msg_code, $email_from, 0, "", "X-Integria: no_process", $images);
                }
            }
        }
    }
}
예제 #13
0
$filter['string'] = (string) get_parameter('search_string');
$filter['id_contract'] = (int) get_parameter('search_id_contract');
$filter['id_product'] = (int) get_parameter('search_id_product');
$filter['id_building'] = (int) get_parameter('search_id_building');
$filter['ip_address'] = (string) get_parameter('search_ip_address');
$filter['serial_number'] = (string) get_parameter('search_serial_number');
$filter['part_number'] = (string) get_parameter('search_part_number');
$filter['id_company'] = (int) get_parameter('search_id_company');
$inventories = filter_inventories($filter);
if ($inventories === false) {
    $inventories = array();
}
echo '<div style="width: 950px;">';
echo '<h1>' . __('Inventory report') . '</h1>';
$generated_str = '<div class="report_info" style="text-align: right; width: 95%;">';
$generated_str .= print_label(__('Generated by') . ' : ', '', '', true, dame_nombre_real($config['id_user']));
$generated_str .= '<br />';
$generated_str .= print_label(__('Date') . ' : ', '', '', true, date('Y-m-d H:i', time()));
$generated_str .= '</div>';
echo $generated_str;
$output = '<div style="margin-left: 15px; text-align: left; width: 95%;">';
/* Show search criterium */
if ($filter['string'] != '') {
    $output .= print_label(__('Containing') . ': ', '', '', true, '"' . $filter['string'] . '"') . '<br />';
}
if ($filter['id_group'] != 0) {
    $output .= print_label(__('Group') . ': ', '', '', true, get_db_value('nombre', 'tgrupo', 'id_grupo', $filter['id_group'])) . '<br />';
}
if ($filter['id_product'] != 0) {
    $output .= print_label(__('Product') . ': ', '', '', true, get_db_value('name', 'tkb_product', 'id', $filter['id_product'])) . '<br />';
}
예제 #14
0
if ($status > 0){
	$do_search = 1;
}

if ($id_group > 1){
	$do_search = 1;
}

if ($user_id != ""){
	$do_search = 1;
}

echo "<h2>" . __("Full report") . "</h2>";
echo "<h4>";
if ($user_id != "") {
	echo dame_nombre_real ($user_id);
}

if ($clean_output == 0){
	// link full screen
	if($render_resolution == 0){
		$html_report_image = print_html_report_image ("index.php?sec=users&sec2=operation/user_report/report_full&render_resolution=1&user_id=$user_id&end_date=$end_date&start_date=$start_date&incident_resolution=$resolution&search_id_group=$id_group&author=$author&editor=$editor&search_status=$status&only_projects=$only_projects", __("Full screen"), "", "", 1);
		if ($html_report_image) {
			echo "&nbsp;&nbsp;" . $html_report_image;
		}

		// link PDF report
		$report_image = print_report_image ("index.php?sec=users&sec2=operation/user_report/report_full&user_id=$user_id&end_date=$end_date&start_date=$start_date&incident_resolution=$resolution&search_id_group=$id_group&author=$author&editor=$editor&search_status=$status&only_projects=$only_projects", __("PDF report"));
		if ($report_image) {
			echo "&nbsp;&nbsp;" . $report_image;
		}