View Issue Details

IDProjectCategoryView StatusLast Update
0010367mantisbtcustomizationpublic2014-09-23 18:05
Reportercas Assigned Torombert  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.1.7 
Target Version1.2.7Fixed in Version1.2.7 
Summary0010367: Moving attachments while cloning issue
Description

In our workflow, we allow no changes to a CLOSED issue, it would require cloning.
This feature is available but attachments stay behind. We needed the option to move the attachments to the cloned issue.

Attached documents describes what is needed to enable this.
Could be easily added as standard functionality.

TagsNo tags attached.
Attached Files
move_attachments.txt (2,990 bytes)   
*************
Adjustments needed in config_inc.php

// define level needed to be allowed to move attachments
$g_move_attachments_threshold = DEVELOPER;

*************************
Adjustements needed to customs_strings_inc.php

add the following lined just before the closing tag:
# 4 move attachments
$s_move_attachments ='Move attachments';
$s_move_attachments_tip ='Check to move attachments from parent to clone';


**************************************
Adjustments needed in bug_report_page.php and bug_report_advanced_page.php

Add the following section:
<!--CN-clone-attachments -->
<?php 
if ( file_bug_attachment_count( $f_master_bug_id ) > 0 ) {
	if ( access_has_project_level( config_get( 'move_attachments_threshold' ) ) ) { 
?>
<tr <?php echo helper_alternate_class() ?>>
	<td class="category">
		<?php echo lang_get( 'move_attachments' ) ?>
	</td>
	<td>
		<input tabindex="11" type="checkbox" name="move_attachments"  />  (<?php echo lang_get( 'move_attachments_tip' ) ?>)
	</td>
</tr>
<?php 
	}
}
?>
<!-- CN-clone-attachments -->

just before these statements:
<?php
	}
?>

<!-- Report Stay (report more bugs) -->

*****************************
Adjustment needed to bug_report_page.php

add the following lines :

// CN-CLONE-Attacchment
	$f_move_attachments		= gpc_get_bool( 'move_attachments' );
// CN-CLONE-Attacchment

just before:
	# if a profile was selected then let's use that information
	if ( 0 != $t_bug_data->profile_id ) {

add the following section :

// CN-CLONE-Attachment
	if ($f_move_attachments ) {
		// need to replace the bugid in the mantis_bug_file_table
		$t_bug_file_table	= config_get( 'mantis_bug_file_table' ); 
		$query= "update $t_bug_file_table set bug_id=";
		$query .= $t_bug_id;
		$query .= " where bug_id=";
		$query .= $f_master_bug_id ;
		$result = db_query( $query );
		if ($result){
			// need to add history on parent AND on clone
			history_log_event_special( $t_bug_id, FILE_ADDED, 'Moved files from parent to clone' );
			history_log_event_special( $f_master_bug_id, FILE_DELETED, 'Moved files to clone' );
			// create note on parent AND on clone
			$t_host = $_SERVER['HTTP_HOST'];
			$t_path = dirname( $_SERVER['PHP_SELF'] );
			if ( '/' == $t_path || '\\' == $t_path ) {
				$t_path = '';
			}
			$g_path	= 'http://' . $t_host . $t_path.'/';

			$private = false ;
			$bugnote_text = 'Files have been moved to issue :';
			$bugnote_text .= '<br>' ;
			$bugnote_text .= $g_path;
			$bugnote_text .= "/view.php?id=";
			$bugnote_text .= $t_bug_id ;
			bugnote_add( $f_master_bug_id, $bugnote_text, $private );

			$bugnote_text = 'Files have been moved from issue :';
			$bugnote_text .= '<br>' ;
			$bugnote_text .= $g_path;
			$bugnote_text .= "/view.php?id=";
			$bugnote_text .= $f_master_bug_id ;
			bugnote_add( $t_bug_id, $bugnote_text, $private );
		}
	}
// CN-CLONE-Attachment

just before :
	email_new_bug( $t_bug_id );
move_attachments.txt (2,990 bytes)   

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0013166 closedrombert Clone task: allow copying of attachments 

Activities

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036421

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x 263d760c

2011-07-24 08:27

rombert


Details Diff
Bug cloning: allow copying of notes and attachments from parent bug

Fixes 0013167 : Clone task: allow copying of notes
Fixes 0010367 : Moving attachments while cloning issue
Affected Issues
0010367, 0013167
mod - bug_report.php Diff File
mod - bug_report_page.php Diff File
mod - lang/strings_english.txt Diff File

MantisBT: master e39645d7

2011-07-24 08:27

rombert


Details Diff
Bug cloning: allow copying of notes and attachments from parent bug

Fixes 0013167 : Clone task: allow copying of notes
Fixes 0010367 : Moving attachments while cloning issue
Affected Issues
0010367, 0013167
mod - bug_report.php Diff File
mod - bug_report_page.php Diff File
mod - lang/strings_english.txt Diff File