2008-11-10 Sancho Lerena <slerena@artica.es>

* operation/incidents/incident.php
        operation/incidents/incident_detail.php: Fixed some bugs in
        incident management that makes unusable the incident sytem
        Thanks to Esben for reporting this bug that was introduced
        only few days before closing 2.0 version :(



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1233 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-11-10 17:35:27 +00:00
parent b42e8b0cd9
commit 83d6d22492
3 changed files with 51 additions and 38 deletions

View File

@ -1,5 +1,11 @@
2008-11-10 Sancho Lerena <slerena@artica.es> 2008-11-10 Sancho Lerena <slerena@artica.es>
* operation/incidents/incident.php
operation/incidents/incident_detail.php: Fixed some bugs in
incident management that makes unusable the incident sytem
Thanks to Esben for reporting this bug that was introduced
only few days before closing 2.0 version :(
* include/funcions_db.php: Reference to inexistant table * include/funcions_db.php: Reference to inexistant table
tagent_data_image has been deleted and fixed notice. tagent_data_image has been deleted and fixed notice.

View File

@ -89,7 +89,7 @@ if ((isset ($_GET["action"])) AND ($_GET["action"] == "update")) {
// INSERT incident // INSERT incident
if ((isset ($_GET["action"])) AND ($_GET["action"] == "insert")) { if ((isset ($_GET["action"])) AND ($_GET["action"] == "insert")) {
$grupo = get_parameter_post ("grupo_form"); $grupo = get_parameter_post ("grupo_form", 1);
if (give_acl ($config['id_user'], $grupo, "IM")) { if (give_acl ($config['id_user'], $grupo, "IM")) {
// Read input variables // Read input variables
$titulo = get_parameter_post ("titulo"); $titulo = get_parameter_post ("titulo");
@ -98,8 +98,7 @@ if ((isset ($_GET["action"])) AND ($_GET["action"] == "insert")) {
$prioridad = get_parameter_post ("prioridad_form"); $prioridad = get_parameter_post ("prioridad_form");
$id_creator = $config['id_user']; $id_creator = $config['id_user'];
$estado = get_parameter_post ("estado_form"); $estado = get_parameter_post ("estado_form");
$sql = sprintf ("INSERT INTO tincidencia (inicio,actualizacion,titulo,descripcion,id_usuario,origen,estado,prioridad,id_grupo,id_creator) VALUES $sql = sprintf ("INSERT INTO tincidencia (inicio, actualizacion, titulo, descripcion, id_usuario, origen, estado, prioridad, id_grupo, id_creator) VALUES (NOW(), NOW(), '%s', '%s', '%s', '%s', %d, %d, '%s', '%s')", $titulo, $descripcion, $config["id_user"], $origen, $estado, $prioridad, $grupo, $config["id_user"]);
(NOW(), NOW(), '%s', '%s', '%s', '%s', %d, %d, '%s')".$titulo,$descripcion,$config["id_user"],$origen,$estado,$prioridad,$grupo,$config["id_user"]);
$id_inc = process_sql ($sql, "insert_id"); $id_inc = process_sql ($sql, "insert_id");
if ($id_inc === false) { if ($id_inc === false) {
@ -227,6 +226,8 @@ if ($count < 1) {
// TOTAL incidents // TOTAL incidents
$url = "index.php?sec=incidencias&sec2=operation/incidents/incident"; $url = "index.php?sec=incidencias&sec2=operation/incidents/incident";
$estado = -1;
// add form filter values for group, priority, state, and search fields: user and text // add form filter values for group, priority, state, and search fields: user and text
if ($grupo != -1) if ($grupo != -1)
$url .= "&grupo=".$grupo; $url .= "&grupo=".$grupo;

View File

@ -30,6 +30,9 @@ if (! give_acl ($config["id_user"], 0, "IR")) {
exit; exit;
} }
$inicio = date('Y-m-d H:i:s');
$actualizacion = date('Y-m-d H:i:s');
// EDITION MODE // EDITION MODE
if (isset ($_GET["id"])) { if (isset ($_GET["id"])) {
$id_inc = get_parameter_get ("id"); $id_inc = get_parameter_get ("id");
@ -270,9 +273,9 @@ foreach ($return as $row) {
// Only owner could change source or user with Incident management privileges // Only owner could change source or user with Incident management privileges
if ((give_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { if ((give_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) {
print_select ($fields, "estado_form", $estado, '', '', '', false, false, false, 'w135'); print_select ($fields, "origen_form", $estado, '', '', '', false, false, false, 'w135');
} else { } else {
print_select ($fields, "estado_form", $estado, '', '', '', false, false, false, 'w135', true); print_select ($fields, "origen_form", $estado, '', '', '', false, false, false, 'w135', true);
} }
echo '</td><td class="datos2"><b>'.__('Group').'</b></td><td class="datos2">'; echo '</td><td class="datos2"><b>'.__('Group').'</b></td><td class="datos2">';
@ -325,44 +328,46 @@ if (isset ($id_inc) AND (give_acl ($config["id_user"], $id_grupo, "IM") == 1) OR
print_submit_button (__('Submit'), "accion", true, 'class="sub upd"'); print_submit_button (__('Submit'), "accion", true, 'class="sub upd"');
} }
echo "</div></form>"; echo "</div></form>";
echo '<div>';
print_submit_button (__('Add note'), "note_control", false, 'class="sub next"');
echo '</div><div>';
echo '<form id="add_note" name="nota" method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insertar_nota=1&id='.$id_inc.'">';
echo '<table cellpadding="4" cellspacing="4" class="databox" width="600px">
<tr><td class="datos2"><textarea name="nota" rows="5" cols="70" style="height: 100px;"></textarea></td>
<td valign="bottom"><input name="addnote" type="submit" class="sub wand" value="'.__('Add').'"></td></tr>
</table></form></div><div>';
// ********************************************************************
// Notes
// ********************************************************************
if (isset ($id_inc)) { if (isset ($id_inc)) {
$sql = sprintf ("SELECT tnota.* FROM tnota, tnota_inc WHERE tnota_inc.id_incidencia = '%d' AND tnota.id_nota = tnota_inc.id_nota",$id_inc); echo '<div>';
$result = get_db_all_rows_sql ($sql); print_submit_button (__('Add note'), "note_control", false, 'class="sub next"');
} else { echo '</div><div>';
$result = array (); echo '<form id="add_note" name="nota" method="POST" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insertar_nota=1&id='.$id_inc.'">';
} echo '<table cellpadding="4" cellspacing="4" class="databox" width="600px">
<tr><td class="datos2"><textarea name="nota" rows="5" cols="70" style="height: 100px;"></textarea></td>
<td valign="bottom"><input name="addnote" type="submit" class="sub wand" value="'.__('Add').'"></td></tr>
</table></form></div><div>';
if (empty ($result)) { // ********************************************************************
$result = array (); // Notes
} else { // ********************************************************************
echo "<h3>".__('Notes attached to incident').'<h3>';
}
echo '<table cellpadding="4" cellspacing="4" class="databox" width="600px">'; if (isset ($id_inc)) {
foreach ($result as $row) { $sql = sprintf ("SELECT tnota.* FROM tnota, tnota_inc WHERE tnota_inc.id_incidencia = '%d' AND tnota.id_nota = tnota_inc.id_nota",$id_inc);
echo '<tr><td><img src="images/page_white_text.png" border="0"></td>'; $result = get_db_all_rows_sql ($sql);
echo '<td>'.__('Author').': <a href="index.php?sec=usuario&sec2=operation/users/user_edit&ver='.$row["id_usuario"].'">'.dame_nombre_real ($row["id_usuario"]).'</a> ('.date ($config['date_format'],strtotime ($row["timestamp"])).')</td></tr>'; } else {
echo '<tr><td>'; $result = array ();
if ((give_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($row["id_usuario"] == $config["id_user"])) {
echo '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&id_nota='.$row["id_nota"].'"><img src="images/cross.png" border="0"></a>';
} }
echo '</td><td>'.safe_input ($row["nota"]).'</td></tr>';
}
echo '</table>';
if (empty ($result)) {
$result = array ();
} else {
echo "<h3>".__('Notes attached to incident').'<h3>';
}
echo '<table cellpadding="4" cellspacing="4" class="databox" width="600px">';
foreach ($result as $row) {
echo '<tr><td><img src="images/page_white_text.png" border="0"></td>';
echo '<td>'.__('Author').': <a href="index.php?sec=usuario&sec2=operation/users/user_edit&ver='.$row["id_usuario"].'">'.dame_nombre_real ($row["id_usuario"]).'</a> ('.date ($config['date_format'],strtotime ($row["timestamp"])).')</td></tr>';
echo '<tr><td>';
if ((give_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($row["id_usuario"] == $config["id_user"])) {
echo '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&id_nota='.$row["id_nota"].'"><img src="images/cross.png" border="0"></a>';
}
echo '</td><td>'.safe_input ($row["nota"]).'</td></tr>';
}
echo '</table>';
}
// ************************************************************ // ************************************************************
// Files attached to this incident // Files attached to this incident
@ -417,8 +422,9 @@ unset ($table);
// Upload control // Upload control
// ************************************************************ // ************************************************************
// Upload control // Upload control
if (give_acl($config["id_user"], $id_grupo, "IW")==1){ if ((give_acl($config["id_user"], $id_grupo, "IW")==1) AND (isset ($id_inc))) {
echo '<div>'; echo '<div>';
print_submit_button (__('Add attachment'), "attachment", false, 'class="sub next"'); print_submit_button (__('Add attachment'), "attachment", false, 'class="sub next"');
echo '</div>'; echo '</div>';