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# Results Update Verification Action Page
10#
11# $RCSfile: results_update_verification_action.php,v $  $Revision: 1.3 $
12# ---------------------------------------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17# When a bug and verification are related, the data is not normalized.
18# The bug_id exists in the Bug Table and the Verification table
19# The verification_id exists in both the verification table and the bug table
20# This is done for performance reasons but requires some extra cleanup when data is
21# updated or deleted
22
23$page               = basename(__FILE__);
24$redirect_page		= "results_view_verifications_page.php";
25$redirect_on_error	= "results_update_verification_page.php?failed=true&error=280";
26
27$s_results = session_get_properties("results");
28
29$testset_id 	= $s_results['testset_id'];
30$test_id 		= $s_results['test_id'];
31$test_run_id 	= $s_results['test_run_id'];
32$verify_id 		= $s_results['verify_id'];
33
34$comments			= util_clean_post_vars('verification_comments');
35$status				= util_clean_post_vars('verification_status');
36$current_bug_id		= util_clean_post_vars('current_bug_id');
37$new_bug_id			= util_clean_post_vars('new_bug_id');
38if( $new_bug_id == '' ) {
39	$new_bug_id = 0;
40}
41
42
43
44# Need to verify the user entered a valid id and
45# update the bug table if the user has changed this value
46if( $current_bug_id != $new_bug_id ) {
47
48	# return the user to the previous page if the new_bug_id doesn't exist in the bug table
49	if( !bug_exists($new_bug_id) && $new_bug_id != 0 ) {
50		html_redirect($redirect_on_error);
51	}
52
53
54	# see if the verify_id exists anywhere in the bug table
55	$related_bug_id = bug_get_bug_id_from_verification_id( $verify_id );
56
57	# remove the old verify_id from the bug table if it exists
58	if( !empty($related_bug_id) ) {
59
60		bug_update_field( $related_bug_id, BUG_TEST_VERIFY_ID, $value="" );
61	}
62
63	# set the new verify_id in the bug table
64	bug_update_field( $new_bug_id, BUG_TEST_VERIFY_ID, $verify_id );
65
66}
67
68# Update the verify results table
69results_update_verification( $test_run_id, $verify_id, $status, $comments, $new_bug_id );
70
71html_print_operation_successful( 'update_verification', $redirect_page );
72
73# ---------------------------------------------------------------------
74# $Log: results_update_verification_action.php,v $
75# Revision 1.3  2006/09/25 12:46:39  gth2
76# Working on linking rth and other bugtrackers - gth
77#
78# Revision 1.2  2006/01/20 02:36:05  gth2
79# enable export to excel functionaltiy - gth
80#
81# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
82# importing initial version - gth
83#
84# ---------------------------------------------------------------------
85
86?>