Add attachment on status change

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
rdllc
Posts: 2
Joined: 18 Aug 2005, 12:11

Add attachment on status change

Post by rdllc »

This modification allows a file to be attached when the bug status is changed (bug_change_status_page.php).

Modifications to 1.0.0rc1.

bug_change_status_page.php

locate
<form method="post" action="bug_update.php" >
and replace with:
<form method="post" action="bug_update.php" <?php if ( file_allow_bug_upload() ) { echo 'enctype="multipart/form-data"'; } //mod to upload ?> >

locate line 255 <textarea name="bugnote_text" cols="80" rows="10" wrap="virtual"></textarea>
2 lines after that add:

<tr <?php echo helper_alternate_class() //mod to upload ?>>
<td class="category">
<?php echo lang_get( 'upload_file' ) ?>
<?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
</td>
<td>
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
<input name="file" type="file" size="60" />
</td>
</tr>

bug_update.php
locate line 171 # Add a bugnote if there is one
3 lines after that add:

// mod to Handle the file upload
$f_file = gpc_get_file( 'file', null ); #@@@ (thraxisp) Note that this always returns a structure
if ( !is_blank( $f_file['tmp_name'] ) && ( 0 < $f_file['size'] ) ) {
$f_file_error = ( isset( $f_file['error'] ) ) ? $f_file['error'] : 0;
file_add( $f_bug_id, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'bug', $f_file_error );
}

That is the end of the modification.
Post Reply