Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fbcd8a6

Browse files
committedDec 2, 2011
Fix #13644 Deleting an issue with assigned sponsorship throws error
1 parent 8e34668 commit fbcd8a6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

Diff for: ‎core/bug_api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ function bug_delete( $p_bug_id ) {
11181118
bugnote_delete_all( $p_bug_id );
11191119

11201120
# Delete all sponsorships
1121-
sponsorship_delete( sponsorship_get_all_ids( $p_bug_id ) );
1121+
sponsorship_delete_all( $p_bug_id );
11221122

11231123
# MASC RELATIONSHIP
11241124
# we delete relationships even if the feature is currently off.

Diff for: ‎core/sponsorship_api.php

+17
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,23 @@ function sponsorship_set( $p_sponsorship ) {
346346
return $t_sponsorship_id;
347347
}
348348

349+
/**
350+
* delete all sponsorships of a bug
351+
* @param int $p_bug_id
352+
* @return null
353+
*/
354+
function sponsorship_delete_all( $p_bug_id ) {
355+
$c_bug_id = db_prepare_int( $p_bug_id );
356+
357+
$t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' );
358+
359+
$query = "DELETE FROM $t_sponsorship_table
360+
WHERE bug_id=" . db_param();
361+
db_query_bound( $query, $c_bug_id );
362+
363+
sponsorship_clear_cache();
364+
}
365+
349366
/**
350367
* delete a sponsorship given its id
351368
* id can be an array of ids or just an id.

0 commit comments

Comments
 (0)
Please sign in to comment.