Skip to content

Commit

Permalink
update or delete bugs
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@173 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Feb 10, 2001
1 parent 7d35cf4 commit c368570
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manage_project_category_add.php3
Expand Up @@ -16,7 +16,7 @@
}

### check for empty case or duplicate
if ( !empty( $f_category )&&( is_not_duplicate_category( $f_category ) ) ) {
if ( !empty( $f_category )&&( !is_duplicate_category( $f_category ) ) ) {
### insert category
$query = "INSERT
INTO $g_mantis_project_category_table
Expand Down
48 changes: 48 additions & 0 deletions manage_project_category_delete.php3
Expand Up @@ -20,6 +20,54 @@
FROM $g_mantis_project_category_table
WHERE project_id='$f_project_id' AND category='$f_category'";
$result = db_query( $query );

$query = "SELECT id, bug_text_id
FROM $g_mantis_bug_table
WHERE project_id='$f_project_id' AND category='$f_category'";
$result = db_query( $query );
$bug_count = db_num_rows( $result );

for ($i=0;$i<$bug_count;$i++) {
$row = db_fetch_array( $result );
$t_bug_id = $row["id"];
$t_bug_text_id = $row["bug_text_id"];

### Delete the bug text
$query2 = "DELETE
FROM $g_mantis_bug_text_table
WHERE id='$t_bug_text_id'";
$result2 = db_query( $query2 );

### select bugnotes to delete
$query3 = "SELECT id, bugnote_text_id
FROM $g_mantis_bugnote_table
WHERE bug_id='$t_bug_id'";
$result3 = db_query( $query3 );
$bugnote_count = db_num_rows( $result3 );

for ($j=0;$j<$bugnote_count;$j++) {
$row2 = db_fetch_array( $result3 );
$t_bugnote_id = $row2["id"];
$t_bugnote_text_id = $row2["bugnote_text_id"];

### Delete the bugnotes
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE id='$t_bugnote_id'";
$result = db_query( $query );

### Delete the bugnote texts
$query4 = "DELETE
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result4 = db_query( $query4 );
}
}

$query = "DELETE
FROM $g_mantis_bug_table
WHERE project_id='$f_project_id' AND category='$f_category'";
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
22 changes: 21 additions & 1 deletion manage_project_category_update.php3
Expand Up @@ -16,12 +16,32 @@
}

### check for duplicate
if ( is_not_duplicate_category( $f_category ) ) {
if ( !is_duplicate_category( $f_category ) ) {
### update category
$query = "UPDATE $g_mantis_project_category_table
SET category='$f_category'
WHERE category='$f_orig_category' AND project_id='$f_project_id'";
$result = db_query( $query );

$query = "SELECT id, date_submitted, last_updated
FROM $g_mantis_bug_table
WHERE category='$f_orig_category'";
$result = db_query( $query );
$bug_count = db_num_rows( $result );

### update version in each corresponding bug
for ($i=0;$i<$bug_count;$i++) {
$row = db_fetch_array( $result );
$t_bug_id = $row["id"];
$t_date_submitted = $row["date_submitted"];
$t_last_updated = $row["last_updated"];

$query2 = "UPDATE $g_mantis_bug_table
SET category='$f_category', date_submitted='$t_date_submitted',
last_updated='$t_last_updated'
WHERE id='$t_bug_id'";
$result2 = db_query( $query2 );
}
}
?>
<? print_html_top() ?>
Expand Down
2 changes: 1 addition & 1 deletion manage_project_version_add.php3
Expand Up @@ -16,7 +16,7 @@
}

### check for empty case or duplicate
if ( !empty( $f_version )&&( is_not_duplicate_version( $f_version ) ) ) {
if ( !empty( $f_version )&&( !is_duplicate_version( $f_version ) ) ) {
### insert version
$query = "INSERT
INTO $g_mantis_project_version_table
Expand Down
47 changes: 47 additions & 0 deletions manage_project_version_delete.php3
Expand Up @@ -21,6 +21,53 @@
WHERE project_id='$f_project_id' AND version='$f_version'";
$result = db_query( $query );

$query = "SELECT id, bug_text_id
FROM $g_mantis_bug_table
WHERE project_id='$f_project_id' AND version='$f_version'";
$result = db_query( $query );
$bug_count = db_num_rows( $result );

for ($i=0;$i<$bug_count;$i++) {
$row = db_fetch_array( $result );
$t_bug_id = $row["id"];
$t_bug_text_id = $row["bug_text_id"];

### Delete the bug text
$query2 = "DELETE
FROM $g_mantis_bug_text_table
WHERE id='$t_bug_text_id'";
$result2 = db_query( $query2 );

### select bugnotes to delete
$query3 = "SELECT id, bugnote_text_id
FROM $g_mantis_bugnote_table
WHERE bug_id='$t_bug_id'";
$result3 = db_query( $query3 );
$bugnote_count = db_num_rows( $result3 );

for ($j=0;$j<$bugnote_count;$j++) {
$row2 = db_fetch_array( $result3 );
$t_bugnote_id = $row2["id"];
$t_bugnote_text_id = $row2["bugnote_text_id"];

### Delete the bugnotes
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE id='$t_bugnote_id'";
$result = db_query( $query );

### Delete the bugnote texts
$query4 = "DELETE
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result4 = db_query( $query4 );
}
}

$query = "DELETE
FROM $g_mantis_bug_table
WHERE project_id='$f_project_id' AND version='$f_version'";
$result = db_query( $query );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
22 changes: 21 additions & 1 deletion manage_project_version_update.php3
Expand Up @@ -16,12 +16,32 @@
}

### check for duplicate
if ( is_not_duplicate_version( $f_version ) ) {
if ( !is_duplicate_version( $f_version ) ) {
### update version
$query = "UPDATE $g_mantis_project_version_table
SET version='$f_version'
WHERE version='$f_orig_version' AND project_id='$f_project_id'";
$result = db_query( $query );

$query = "SELECT id, date_submitted, last_updated
FROM $g_mantis_bug_table
WHERE version='$f_version'";
$result = db_query( $query );
$bug_count = db_num_rows( $result );

### update version
for ($i=0;$i<$bug_count;$i++) {
$row = db_fetch_array( $result );
$t_bug_id = $row["id"];
$t_date_submitted = $row["date_submitted"];
$t_last_updated = $row["last_updated"];

$query2 = "UPDATE $g_mantis_bug_table
SET version='$f_version', date_submitted='$t_date_submitted',
last_updated='$t_last_updated'
WHERE id='$t_bug_id'";
$result2 = db_query( $query2 );
}
}
?>
<? print_html_top() ?>
Expand Down

0 comments on commit c368570

Please sign in to comment.