1<?php
2# ---------------------------------------------------------------------
3# rth is a requirement, test, and bugtracking system
4# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
5# This program is distributed under the terms and conditions of the GPL
6# See the README and LICENSE files for details
7#----------------------------------------------------------------------
8# ------------------------------------
9# Bug Update Action Page
10#
11# $RCSfile: bug_update_action.php,v $  $Revision   $
12# ------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17
18$s_bug_details			= session_get_properties( "bug" );
19$bug_id					= $s_bug_details['bug_id'];
20$redirect_on_success	= 'bug_detail_page.php';
21$redirect_on_error		= 'bug_detail_page.php';
22$redirect_on_closed		= 'bug_close_page.php';
23$action					= $_POST['action'];
24
25$s_project_properties   = session_get_project_properties();
26
27$project_name           = $s_project_properties['project_name'];
28$project_id				= $s_project_properties['project_id'];
29
30//print_r($_POST);
31switch( $action ) {
32
33	case 'update_assign_to':
34
35		$field = BUG_ASSIGNED_TO;
36		$value = $_POST['update_assign_to'];
37		bug_update_field( $bug_id, $field, $value );
38		break;
39
40	case 'update_assign_to_developer':
41
42		$field = BUG_ASSIGNED_TO_DEVELOPER;
43		$value = $_POST['assign_to_developer'];
44		bug_update_field( $bug_id, $field, $value );
45		break;
46
47	case 'update_status':
48
49		$field = BUG_STATUS;
50		$value = $_POST['update_status'];
51		bug_update_field( $bug_id, $field, $value );
52
53		if( $value == 'Closed' ) {
54			html_redirect( $redirect_on_closed ."?bug_id=$bug_id" );
55		}
56		break;
57
58	case 'add_bugnote':
59
60		session_validate_form_set($_POST, $redirect_on_error);
61		bug_add_bugnote( $bug_id, $_POST['bugnote_required'] );
62		break;
63
64	case 'add_relationship':
65
66		session_validate_form_set($_POST, $redirect_on_error);
67		$added_relationship	= bug_add_relationship(	$bug_id,
68													$_POST['related_bug_id_required'],
69													$_POST['relationship_type'] );
70
71		if( !$added_relationship ) {
72			error_report_show($redirect_on_error, COULD_NOT_CREATE_RELATIONSHIP);
73		}
74		break;
75
76}
77
78# Attach current user to this bug
79//bug_monitor_attach_user($bug_id);
80
81html_print_operation_successful( 'update_bug_page', $redirect_on_success );
82
83# ------------------------------------
84# $Log: bug_update_action.php,v $
85# Revision 1.2  2006/02/27 17:24:55  gth2
86# added email functionality to bug tracker - gth
87#
88# Revision 1.1.1.1  2005/11/30 23:00:56  gth2
89# importing initial version - gth
90#
91# ------------------------------------
92?>