Future Date

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
Guest

Future Date

Post by Guest »

I would like to have a custom field that is displayed when a user enters a bug for the first time called "Target Closure Date". I would like it to default to today+x days. I know how to add a custom field but what is the easiest way to default the field to x number of days in advance of today?
Guest

Got it....

Post by Guest »

Never mind.. It was a 2 line code change.
sunq
Posts: 14
Joined: 12 Apr 2005, 06:19

I would like to know this too

Post by sunq »

Hi how did you solve it?
/A
Guest

Solution

Post by Guest »

Like this....

In bug_report_page.php instead of blindly calling print_custom_field_input you put the following code:

If ($t_def['name'] == your_custom_field_name) {
print_date_selection_set("custom_field_" . $t_def['id'], config_get('short_date_format'), mktime(0,0,0,date("m"),date("d")+14,date("Y")), false, true) ;
} else{
// standard call to print_date_selection_set
print_custom_field_input( $t_def, $f_master_bug_id );
}

If you have more than 1 field to customize then I suggest you use a switch/case control structure.[/code]
Post Reply