Skip to content

Commit 4a05109

Browse files
committedDec 2, 2011
Fix #13644 Deleting an issue with assigned sponsorship throws error
1 parent af03f78 commit 4a05109

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
@@ -1136,7 +1136,7 @@ function bug_delete( $p_bug_id ) {
11361136
bugnote_delete_all( $p_bug_id );
11371137

11381138
# Delete all sponsorships
1139-
sponsorship_delete( sponsorship_get_all_ids( $p_bug_id ) );
1139+
sponsorship_delete_all( $p_bug_id );
11401140

11411141
# MASC RELATIONSHIP
11421142
# 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
@@ -352,6 +352,23 @@ function sponsorship_set( $p_sponsorship ) {
352352
return $t_sponsorship_id;
353353
}
354354

355+
/**
356+
* delete all sponsorships of a bug
357+
* @param int $p_bug_id
358+
* @return null
359+
*/
360+
function sponsorship_delete_all( $p_bug_id ) {
361+
$c_bug_id = db_prepare_int( $p_bug_id );
362+
363+
$t_sponsorship_table = db_get_table( 'sponsorship' );
364+
365+
$query = "DELETE FROM $t_sponsorship_table
366+
WHERE bug_id=" . db_param();
367+
db_query_bound( $query, $c_bug_id );
368+
369+
sponsorship_clear_cache( );
370+
}
371+
355372
/**
356373
* delete a sponsorship given its id
357374
* id can be an array of ids or just an id.

0 commit comments

Comments
 (0)