Need help to copy functionality of due_date

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mworks
Posts: 5
Joined: 01 Apr 2014, 13:04

Need help to copy functionality of due_date

Post by mworks »

Hello everybody,

I need help to implement a custom date field with the behaviour of the due_date field, changing color from a given date on.
We have to fields in our forms, one is a given by customer and called 'Target Date' (based on due_date) another is the intended finishing date ( by developper).
This one should change color like due_date. On one hand I'm a developper and have done little patches directly in the sourcecode of mantis, on the other side I'm not a specialist for php and the architecture of mantis. So here comes my question: Has anyone realised that yet ? Are there some hints or workarrounds to generate this funcionality quick and clean :-)), something like due_date_2 ?

Thanks for any help,
Stephan
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Need help to copy functionality of due_date

Post by atrol »

mworks wrote:quick and clean
You certainly mean quick or clean ;-)

I don't have enough time to tell how a clean solution would work as this requires an extension to the custom field concept.

A quick and dirty solution is to change function print_custom_field_value in core/custom_field_api.php
Check for the name of your custom field.
If it's your special field, use the custom field value to determine if you have reached the due date.
If so, change the background color.

Some hints how to implement it:

function bug_is_overdue in core/bug_api.php

This piece of code from bug_view_inc.php

Code: Select all

			if ( $tpl_bug_overdue ) {
				echo '<td class="overdue">', $tpl_bug_due_date, '</td>';
			} else {
				echo '<td>', $tpl_bug_due_date, '</td>';
			}
Please use Search before posting and read the Manual
mworks
Posts: 5
Joined: 01 Apr 2014, 13:04

Re: Need help to copy functionality of due_date

Post by mworks »

Thank You so far. I'll try to understand the hints...
Regards,
Stephan
Post Reply