$table_advanced->style = array(); $table_advanced->data = array(); $table_advanced->colspan[1][1] = 2; // Table for advanced controls if ($editor) { $table_advanced->data[0][0] = print_label(__('Editor'), '', '', true, $editor); } else { $table_advanced->data[0][0] = " "; } if ($has_im && $create_incident) { $groups = get_user_groups($config['id_user'], "IW"); $table_advanced->data[0][1] = print_select($groups, "id_group_creator", $id_grupo_incident, '', '', 0, true, false, false, __('Creator group'), $blocked_incident); } elseif ($create_incident) { $table_advanced->data[0][1] = print_label(__('Creator group'), '', '', true, dame_nombre_grupo($id_grupo_incident)); } elseif ($id_group_creator) { $table_advanced->data[0][1] = print_label(__('Creator group'), '', '', true, dame_nombre_grupo($id_group_creator)); } if ($has_im) { $table_advanced->data[0][2] = print_checkbox_extended('sla_disabled', 1, $sla_disabled, $blocked_incident, '', '', true, __('SLA disabled')); $table_advanced->data[1][0] = print_checkbox("email_notify_form", 1, $email_notify, true, __('Notify changes by email '), $blocked_incident); } else { $table_advanced->data[0][2] = print_input_hidden('sla_disabled', 0, true); $table_advanced->data[1][0] = print_input_hidden('email_notify', 1, true); } $parent_name = $id_parent ? __('Ticket') . ' #' . $id_parent : __('None'); if ($has_im) { $table_advanced->data[3][0] = print_input_text('search_parent', $parent_name, '', 10, 100, true, __('Parent ticket'), $blocked_incident); $table_advanced->data[3][0] .= print_input_hidden('id_parent', $id_parent, true); if (!$blocked_incident) { $table_advanced->data[3][0] .= print_image("images/cross.png", true, array("onclick" => "clean_parent_field()", "style" => "cursor: pointer")); }
// 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)) { // Only admins (manage incident) or owners can modify incidents, including their notes // But note authors was able to delete this own notes $id_nota = $_GET["id_nota"];
$id_project_group = $project["id_project_group"]; $cc = $project["cc"]; } // Show result of previous operations echo $result_output; // Create project form if ($create_project) { $email_notify = 0; $iduser_temp = $_SESSION['id_usuario']; $titulo = ""; $prioridad = 0; $id_grupo = 0; $grupo = dame_nombre_grupo (1); $owner = $config["id_user"]; $estado = 0; $actualizacion = date ("Y/m/d H:i:s"); $inicio = $actualizacion; $id_creator = $iduser_temp; $create_mode = 1; $id_project_group = 0; } if ($id_project) echo '<form method="post" id="form-new_project">'; else echo '<form method="post" id="form-new_project" action="index.php?sec=projects&sec2=operation/projects/project_overview">'; // Main project table
function show_workunit_user($id_workunit, $full = 0, $show_multiple = true) { global $config; $sql = "SELECT * FROM tworkunit WHERE id = {$id_workunit}"; if ($res = mysql_query($sql)) { $row = mysql_fetch_array($res); } else { return; } $timestamp = $row["timestamp"]; $duration = $row["duration"]; $id_user = $row["id_user"]; $avatar = get_db_value("avatar", "tusuario", "id_usuario", $id_user); $nota = $row["description"]; $have_cost = $row["have_cost"]; $profile = $row["id_profile"]; $public = $row["public"]; $locked = $row["locked"]; $work_home = $row["work_home"]; $id_task = get_db_value("id_task", "tworkunit_task", "id_workunit", $row["id"]); if (!$id_task) { $id_incident = get_db_value("id_incident", "tworkunit_incident", "id_workunit", $row["id"]); } $id_project = get_db_value("id_project", "ttask", "id", $id_task); $id_profile = get_db_value("id_profile", "tworkunit", "id", $id_workunit); $task_title = get_db_value("name", "ttask", "id", $id_task); if (!$id_task) { $incident_title = get_db_value("titulo", "tincidencia", "id_incidencia", $id_incident); } $project_title = get_db_value("name", "tproject", "id", $id_project); // ACL Check for visibility if (!$public && $id_user != $config["id_user"]) { if ($id_task) { $task_access = get_project_access($config["id_user"], false, $id_task, false, true); if (!$task_access["manage"]) { return; } } elseif (!give_acl($config["id_user"], 0, "TM")) { return; } } echo "<form method='post' action='index.php?sec=projects&sec2=operation/projects/task_workunit'>"; // Show data echo "<div class='notetitle'>"; // titulo echo "<table class='blank' border=0 width='100%' cellspacing=0 cellpadding=0 style='margin-left: 0px;margin-top: 0px; background: transparent;'>"; echo "<tr><td rowspan=4 width='7%'>"; print_user_avatar($id_user, true); echo "<td width='60%'><b>"; if ($id_task) { echo __('Task') . " </b> : "; echo "<a href='index.php?sec=projects&sec2=operation/projects/task_detail&id_task={$id_task}&operation=view'>{$task_title}</A>"; } else { echo __('Ticket') . " </b> : "; echo "<a href='index.php?sec=incidents&sec2=operation/incidents/incident&id={$id_incident}'>{$incident_title}</A>"; } echo "</td>"; echo "<td width='13%'>"; echo "<b>" . __('Duration') . "</b>"; echo "</td>"; echo "<td width='20%'>"; echo " : " . format_numeric($duration); echo "</td>"; echo "<td>"; // Public WU ? echo "<span style='margin-bottom:0px; padding-right:10px;'>"; if ($public == 1) { echo "<img src='images/group.png' title='" . __('Public Workunit') . "' />"; } else { echo "<img src='images/delete.png' title='" . __('Non public Workunit') . "' />"; } echo "</span>"; echo "</td></tr>"; echo "<tr>"; echo "<td><b>"; if ($id_task) { echo __('Project') . " </b> : "; echo "<a href='index.php?sec=projects&sec2=operation/projects/task&id_project={$id_project}'>{$project_title}</A>"; } else { echo __('Group') . "</b> : "; echo dame_nombre_grupo(get_db_sql("SELECT id_grupo FROM tincidencia WHERE id_incidencia = {$id_incident}")); } echo "</td>"; echo "<td><b>"; if ($have_cost != 0) { $profile_cost = get_db_value("cost", "trole", "id", $profile); $cost = format_numeric($duration * $profile_cost); $cost = $cost . " €"; } else { $cost = __('N/A'); } echo __('Cost'); echo "</b>"; echo "</td>"; echo "<td>"; echo " : " . $cost; echo "</td>"; if ($show_multiple) { echo "<td>"; echo print_checkbox_extended('op_multiple[]', $id_workunit, false, false, '', '', true); echo "</td>"; } echo "</tr>"; echo "<tr>"; echo "<td><b>"; echo __('Work from home'); echo "</b>"; if ($work_home == 0) { $wfh = __('No'); } else { $wfh = __('Yes'); } echo " : " . $wfh; echo "</td>"; echo "<td><b>"; echo __('Profile'); echo "</b></td><td>"; echo " : " . get_db_value("name", "trole", "id", $profile); echo "<tr>"; echo "<td>"; echo "<a href='index.php?sec=users&sec2=operation/users/user_edit&id={$id_user}'>"; echo "<b>" . $id_user . "</b>"; echo "</a>"; echo " " . __('said on') . ' ' . $timestamp; echo "</td></tr>"; echo "</table>"; echo "</div>"; echo "</form>"; // Body //echo "<div class='notebody'>"; echo "<div class='notebody' id='wu_{$id_workunit}'>"; echo "<table width='100%' class='blank'>"; echo "<tr><td valign='top'>"; if (strlen($nota) > 1024 and $full == 0) { echo topi_richtext(clean_output_breaks(substr($nota, 0, 1024))); echo "<br><br>"; echo "<a href='index.php?sec=users&sec2=operation/users/user_workunit_report&id_workunit=" . $id_workunit . "&title={$task_title}'>"; echo __('Read more...'); echo "</a>"; } else { echo topi_richtext(clean_output_breaks($nota)); } echo "<td valign='top'>"; echo "<table width='100%' class='blank'>"; if ($_GET["sec2"] == "operation/users/user_workunit_report") { $myurl = "index.php?sec=users&sec2=operation/users/user_workunit_report&id={$id_user}"; } else { if ($id_project > 0) { $myurl = "index.php?sec=projects&sec2=operation/users/user_spare_workunit&id_project={$id_project}&id_task={$id_task}"; } else { $myurl = "index.php?sec=users&sec2=operation/users/user_workunit_report&id={$id_user}"; } } if (project_manager_check($id_project) == 1 or $id_user == $config["id_user"] or give_acl($config["id_user"], 0, "TM")) { echo "<tr><td align='right'>"; echo "<br>"; echo "<a class='delete-workunit' id='delete-{$id_workunit}' href='{$myurl}&id_workunit={$id_workunit}&operation=delete' onclick='if (!confirm(\"" . __('Are you sure?') . "\")) return false;'><img src='images/cross.png' title='" . __('Delete workunit') . "'/></a>"; } // Edit workunit if ((project_manager_check($id_project) == 1 or give_acl($config["id_user"], 0, "TM") or $id_user == $config["id_user"]) and ($locked == "" or give_acl($config["id_user"], 0, "UM"))) { echo "<tr><td align='right'>"; echo "<br>"; echo "<a class='edit-workunit' id='edit-{$id_workunit}' href='index.php?sec=projects&sec2=operation/users/user_spare_workunit&id_project={$id_project}&id_task={$id_task}&id_workunit={$id_workunit}&id_profile={$id_profile}'><img border=0 src='images/page_white_text.png' title='" . __('Edit workunit') . "'></a>"; echo "</td>"; } // Lock workunit if ((project_manager_check($id_project) == 1 or give_acl($config["id_user"], 0, "TM") or $id_user == $config["id_user"]) and $locked == "") { echo "<tr><td align='right'>"; echo "<br>"; echo "<a class='lock_workunit' id='lock-{$id_workunit}' href='{$myurl}&id_workunit={$id_workunit}&operation=lock'><img src='images/lock.png' title='" . __('Lock workunit') . "'></a>"; echo "</td>"; } else { echo "<tr><td align='right'>"; echo "<br><img src='images/rosette.png' title='" . __('Locked by') . " {$locked}'"; echo print_user_avatar($locked, true); echo "</td>"; } echo "</tr></table>"; echo "</tr></table>"; echo "</div>"; }
/** * 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']); } }
function print_groups_table($groups) { enterprise_include("include/functions_groups.php"); $return = enterprise_hook('print_groups_table_extra', array($groups)); if ($return === ENTERPRISE_NOT_HOOK) { echo "<div class='divresult'>"; echo '<table width="99%" class="listing" id="table1">'; echo '<thead>'; echo '<tr>'; echo '<th class="header c0" scope="col">' . __('Users') . '</th>'; echo '<th class="header c1" scope="col">' . __('Icon') . '</th>'; echo '<th class="header c2" scope="col">' . __('Name') . '</th>'; echo '<th class="header c3" scope="col">' . __('Parent') . '</th>'; echo '<th class="header c4" scope="col">' . __('Delete') . '</th>'; echo '</tr>'; echo '</thead>'; $count = 0; if ($groups === false) { $groups = array(); } if (!empty($groups)) { foreach ($groups as $group) { $data = array(); $num_users = get_db_value("COUNT(id_usuario)", "tusuario_perfil", "id_grupo", $group["id_grupo"]); if ($num_users > 0) { $users_icon = '<a href="javascript:"><img src="images/group.png" title="' . __('Show and hide the user list') . '" /></a>'; } else { $users_icon = ''; } $icon = ''; if ($group['icon'] != '') { $icon = '<img src="images/groups_small/' . $group['icon'] . '" />'; } if ($group["id_grupo"] != 1) { $group_name = '<a href="index.php?sec=users&sec2=godmode/grupos/configurar_grupo&id=' . $group['id_grupo'] . '">' . $group['nombre'] . '</a>'; } else { $group_name = $group["nombre"]; } $parent = dame_nombre_grupo($group["parent"]); //Group "all" is special not delete and no update if ($group["id_grupo"] != 1) { $delete_button = '<a href="index.php?sec=users& sec2=godmode/grupos/lista_grupos& id_grupo=' . $group["id_grupo"] . '& delete_group=1&id=' . $group["id_grupo"] . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"> <img src="images/cross.png"></a>'; } else { $delete_button = ""; } echo '<tr id="table1-' . $count . '" style="border:1px solid #505050;" class="datos2">'; echo '<td id="table1-' . $count . '-0" style="text-align:center; width:40px;" class="datos2">' . $users_icon . '</td>'; echo '<td id="table1-' . $count . '-1" style="width:40px;" class="datos2">' . $icon . '</td>'; echo '<td id="table1-' . $count . '-2" style=" font-weight: bold;" class="datos2">' . $group_name . '</td>'; echo '<td id="table1-' . $count . '-3" style="" class="datos2">' . $parent . '</td>'; echo '<td id="table1-' . $count . '-4" style=" text-align:center; width:40px;" class="datos2">' . $delete_button . '</td>'; echo '</tr>'; echo '<tr id="table1-' . $count . '-users" style="display:none;">'; echo '<td colspan="5" style="text-align:center; background-color:#e6e6e6;">'; echo '<table width="99%" cellpadding="0" cellspacing="0" border="0px" id="table_users_' . $count . '">'; echo '<tr style="text-align:center;">'; if ($num_users > 0) { $users_sql = "SELECT * FROM tusuario_perfil WHERE id_grupo =" . $group["id_grupo"] . " ORDER BY id_usuario"; $count_users = 0; $new = true; while ($user = get_db_all_row_by_steps_sql($new, $result_users, $users_sql)) { $new = false; if ($count_users >= 4) { $count_users = 0; echo '</tr>'; echo '<tr style="text-align:center;">'; } $user_name = "<a href=\"index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user="******"\"><strong>" . $user['id_usuario'] . "</strong></a>"; $user_real_name = get_db_value("nombre_real", "tusuario", "id_usuario", $user['id_usuario']); $delete_icon = '<a href="index.php?sec=users&sec2=godmode/grupos/lista_grupos&delete_user=1&id_user_delete=' . $user['id_usuario'] . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>'; $user_name = "{$user_name} ({$user_real_name}) " . $delete_icon; echo '<td style="background-color:#e6e6e6;"">' . $user_name . '</td>'; $count_users++; } } else { echo '<td style="background-color:#e6e6e6;"">' . __('There are no users') . '</td>'; } echo '</tr>'; echo '</table>'; echo '</td>'; echo '</tr>'; echo "<script type=\"text/javascript\">\n\t\t\t\t\t \$(document).ready (function () {\n\t\t\t\t\t\t \$(\"#table1-{$count}-0\").click(function() {\n\t\t\t\t\t\t\t \$(\"#table1-{$count}-users\").toggle();\n\t\t\t\t\t\t });\n\t\t\t\t\t });\n\t\t\t\t\t </script>"; $count++; } } echo '</table>'; if (empty($groups)) { echo ui_print_error_message(__("No groups"), '', true, 'h3', true); } echo '</div>'; } }
if ($color == 1) { $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo "<tr>"; // Name echo "<td class='{$tdcolor}' valign='top'><b><a href='index.php?sec=download&\n\t\t\t\t\tsec2=operation/download/manage_cat&update=" . $row["id"] . "'>" . $row["name"] . "</a></b></td>"; echo "<td class='{$tdcolor}'><img src='" . $config["base_url"] . "/images/download_category/" . $row["icon"] . "'></td>"; // Group echo "<td class='{$tdcolor}' valign='top'>"; $groups = get_db_all_rows_sql("SELECT id_group FROM tdownload_category_group WHERE id_category = " . $row["id"]); foreach ($groups as $key => $id_group) { echo dame_nombre_grupo($id_group[0]); echo "<br>"; } // Items echo "<td class='" . $tdcolor . "f9' valign=top align='center'>"; echo get_db_sql("SELECT COUNT(id) FROM tdownload WHERE id_category = " . $row["id"]); // Delete echo "<td class='" . $tdcolor . "f9' align='center' valign='top'>"; echo "<a href='index.php?sec=download&\n\t\t\t\t\t\tsec2=operation/download/manage_cat&\n\t\t\t\t\t\tdelete_cat=" . $row["id"] . "' \n\t\t\t\t\t\tonClick='if (!confirm(\\' " . __('Are you sure?') . "\\')) \n\t\t\t\t\t\treturn false;'>\n\t\t\t\t\t\t<img border='0' src='images/cross.png'></a>"; } echo "</table>"; } echo '<div style="width:99%; text-align: right;">'; echo "<form method=post action='index.php?sec=download&sec2=operation/download/manage_cat&create=1'>"; print_submit_button(__('Create'), 'crt_btn', false, 'class="sub create"'); echo "</form></div>";
$color = 1; } echo "<tr>"; // Name echo "<td class='$tdcolor' valign='top'><b><a href='index.php?sec=download& sec2=operation/download/manage_cat&update=".$row["id"]."'>".$row["name"]."</a></b></td>"; echo "<td class='$tdcolor'><img src='".$config["base_url"]."/images/download_category/".$row["icon"]."'></td>"; // Group echo "<td class='$tdcolor' valign='top'>"; $groups = get_db_all_rows_sql( "SELECT id_group FROM tdownload_category_group WHERE id_category = ".$row["id"]); if (is_array($groups) || is_object($groups)){ foreach($groups as $key => $id_group){ echo dame_nombre_grupo($id_group['id_group']); echo "<br>"; } } // Items echo "<td class='".$tdcolor."f9'>"; echo get_db_sql ("SELECT COUNT(id) FROM tdownload WHERE id_category = ".$row["id"]); // Delete echo "<td class='".$tdcolor."f9'>"; echo "<a href='index.php?sec=download& sec2=operation/download/manage_cat& delete_cat=".$row["id"]."' onClick='if (!confirm(\' ".__('Are you sure?')."\')) return false;'>
echo '</textarea></td></tr> </table> <input type="submit" class="sub create" name="send_mes" value="' . __('Send message') . '"></form>'; } if (isset($_GET["nuevo_g"])) { echo '<h2>' . __('New message') . '<a href="help/' . $help_code . '/chap2.php#251" target="_help" class="help"> <span>' . __('Help') . '</span></a></h2>'; echo ' <form name="new_mes" method="post" action="index.php?sec=messages&sec2=operation/messages/message&nuevo_mensaje_g=1"> <table class="databox_color"> <tr><td class="datos">' . __('From') . ':</td><td class="datos"><b>' . $iduser . '</b></td></tr> <tr><td class="datos2">' . __('To') . ':</td><td class="datos2">'; echo '<select name="g_destino" class="w130">'; $sql_1 = "SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '{$iduser}'"; $result_1 = mysql_query($sql_1); while ($row_1 = mysql_fetch_array($result_1)) { echo "<option value=" . $row_1["id_grupo"] . ">" . dame_nombre_grupo($row_1["id_grupo"]); } echo '</select>'; echo '</td></tr> <tr><td class="datos">' . __('Subject') . ':</td><td class="datos"><input name="subject" size=60></td></tr> <tr><td class="datos2">' . __('Message') . ':</td> <td class="datos"><textarea name="mensaje" rows="12" cols=60></textarea></td></tr> </table> <input type="submit" class="sub create" name="send_mes" value="' . __('Send message') . '"></form>'; } } else { // Get list of messages for this user if (isset($_GET["borrar"])) { $id_mensaje = $_GET["id_mensaje"]; $sql5 = 'DELETE FROM tmensajes WHERE id_usuario_destino="' . $iduser . '" AND id_mensaje="' . $id_mensaje . '"'; $resultado5 = mysql_query($sql5);