From 59b66a2fad8b25a75d0fe38eb8c4a92380fa0cc4 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Thu, 13 Aug 2015 17:51:59 +0200 Subject: [PATCH] Set bug attachment ownership when copying them file_copy_attachments() did not set user_id when inserting the new attachment, resulting in that field being set to 0. The user_id is now set to the original issue's. Fixes #20018 --- core/file_api.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/core/file_api.php b/core/file_api.php index be16a5d94e..a4c0bea8f3 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -1054,19 +1054,22 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) { } } - $t_query = 'INSERT INTO {bug_file} - ( bug_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content ) - VALUES ( ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ', - ' . db_param() . ');'; - db_query( $t_query, array( $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], $t_new_diskfile_name, $t_new_file_name, $t_file_path, $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], $t_bug_file['content'] ) ); + $t_query = 'INSERT INTO {bug_file} ( + bug_id, title, description, diskfile, filename, folder, + filesize, file_type, date_added, user_id, content + ) + VALUES ( ' + . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' + . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' + . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' + . db_param() . ', ' . db_param() . + ')'; + db_query( $t_query, array( + $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], + $t_new_diskfile_name, $t_new_file_name, $t_file_path, + $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], + $t_bug_file['user_id'], $t_bug_file['content'] + ) ); } }