Overdue Customfield

Name JIRA Overdue Customfield
Version 0.4
Product Versions JIRA 3.7+
Author(s) Philip Herbst
Homepage Overdue Customfield
Price FREE!
License  
JavaDocs  
IssueTracking  
Download JAR overduefield-0.1.jar
overduefield-0.4.jar
overduefield-0.5-bleeding-edge.jar
Download Source source-0.4.zip

Description/Features

This is a Customfield that highlights overdue Issues in the Issue Navigator and displays the count of days the Issue is overdue. Issues overdue by less than 1 week are highlighted with red text.Issues overdue by 1 week or more are highlighted with bold red text.

Installation

Note: These instructions were not written by the plug-in author but by a novice Jira user; so they're more elementary than an experienced Jira user might write.

  1. Copy the jar into JIRA's WEB-INF/lib:
    • overduefield-0.1.jar
  2. Restart JIRA
  3. Create a custom field of type OverDue Field
    1. Assign to desired issue types and projects, or leave defaults so it's usable on all.
    2. Don't associate field test to screens (not applicable).
  4. Browse to a project
  5. Open the Issue Navigator by clicking on a predefined query (e.g. Project Summary->In Progress)
  6. Click on Configure your Issue Navigator
    1. Select your new Overdue column from the Add New Column: drop-down list and click the Add button.
    2. Position your Overdue column where you want.
      • Don't worry that your column description displays on the Configure screen; it won't show in the real Issue Navigator display.
  7. Done.

Note that you do not need to reindex your database for the values to show.

Usage

An overdue value will be displayed in the Issue Navigator for any issues that:

  • are Unresolved and
  • are past their Due Date. So they must have a Due Date value.

Configurable Duedate "Lag"

Jira stores the duedate without the datetime, that means that a Issue that has a duedate 31/Oct/06 is due the same day(starting at midnight).
There is now a parameter thats specifies the amount of hours which the duedate is "delayed".

Just change in atlassian-plugin.xml following line to fit your needs. In this example an issue with the duedate 31/Oct/06 is marked as due from 1/Nov/06 on

<param name="hoursToAddToDuedate" value="24"/>

Examples

Todo

Version History

Version Author Notes
0.1 Philip Herbst Initial release
0.2
sae Estimation field release
0.4 Philip Herbst configurable Duedate "lag", jumped versions
0.5 Daniel Sand .jar build form the latest source.zip

Screenshots

Screenshots
(view as slideshow)
     
     
 

Source

public class OverdueField extends CalculatedCFType implements SortableCustomField
{
    private static final Category log = Category.getInstance(OverdueField.class);

    private final long HOUR = 1000 * 60 * 60;

    private final long DAY = 24 * HOUR;

    public String getStringFromSingularObject(Object arg0)
    {
        return null;
    }

    public Object getSingularObjectFromString(String arg0) throws FieldValidationException
    {
        return null;
    }

    private Boolean getRoundParam()
    {
        return new Boolean((String) getDescriptor().getParams().get("round"));
    }

    private int getHoursToAddToDuedateParam()
    {
        String hoursToAddToDuedateParam = (String) getDescriptor().getParams().get("hoursToAddToDuedate");
        int hoursToAddToDuedate = 0;
        try
        {
            if (hoursToAddToDuedateParam != null)
                hoursToAddToDuedate = Integer.parseInt(hoursToAddToDuedateParam);
        } catch (NumberFormatException e)
        {
            log.error("Invalid hoursToAddToDuedate Param");
            return 0;
        }
        return hoursToAddToDuedate;
    }

    public Object getValueFromIssue(CustomField field, Issue issue)
    {
        long nowMillis = System.currentTimeMillis();
        long millis = 0L;
        Number duedateDiff = null;
        Timestamp nowTimestamp = new Timestamp(nowMillis);
        Timestamp duedate = issue.getDueDate();
        try
        {
            if (duedate != null && issue.getResolutionObject() == null)
                millis = nowTimestamp.getTime() - (duedate.getTime() + getHoursToAddToDuedateParam() * HOUR);
            else
                millis = Integer.MIN_VALUE;

            if (getRoundParam().booleanValue() && (millis > 1 * DAY))
                millis -= millis % (1 * DAY);
            duedateDiff = new Long(millis / 1000L);
        } catch (Exception e)
        {
            log.error(e);
        }
        return duedateDiff;
    }
}

Velocity template

This could be easily customized, e.g. color

#if ($value)
    #if ($value.intValue() > 0 && !$issue.resolution)
        $!dateutils.formatDurationPretty($value.intValue())
    #end

    #if ($issue)
        #if (!$issue.resolution && $value.intValue() > 0)
        <style>
        <!--
            #issuerow${issue.id} *
            {
                color: #cc0000;
            }
        -->
        </style>
        #end
        #if (!$issue.resolution && $value.intValue() > (86400 * 7))
        <style>
        <!--
            #issuerow${issue.id} *
            {
                font-weight: bold;
            }
        -->
        </style>
        #end
    #end
#end
Full Size

Labels

 
  1. Mar 29, 2006

    Kevin James says:

    Hmmm, installed this plugin and was able to add a custom Overdue field.&nbsp; Ad...

    Hmmm, installed this plugin and was able to add a custom Overdue field.  Added this to my column to my navigator, but that Overdue column remains blank.  I did reindex and had a list of issues with due dates in the navigator. 

     Is there something else I need to configure?

    1. Jul 13, 2006

      Ian Renshaw says:

      You need to add the field "Due Date" as type "Date Picker" for this plugin to wo...

      You need to add the field "Due Date" as type "Date Picker" for this plugin to work.

  2. Mar 29, 2006

    Philip Herbst says:

    Note that the field just diplays something if # no resolution is set # now > due...

    Note that the field just diplays something if

    1. no resolution is set
    2. now > duedate of issue
      I dont think you need to reindex because the field is _calculated_ and not indexed. Will test soon with the latest version if theres a bug
  3. Aug 27, 2006

    Dawn Hunter says:

    How can you "add the field "Due Date" as type "Date Picker" for this plugin to w...

    How can you "add the field "Due Date" as type "Date Picker" for this plugin to work," if the Due Date field already exists (as it does in all systems)? Must I add ANOTHER Due Date field?

    Also -- I could have sworn there was a special mention here of how to make this work with 3.6.2. Has that been updated or removed? I only get the blank Navigator column, and I'm unsure how to change an already populated field (Due Date) to Date Picker (shouldn't it already be?).

     Please advise - this would be a nice customization.

     Thanks!     - Dawn

    1. Aug 27, 2006

      Philip Herbst says:

      Hi, you just have to add the customfield, you dont have to configure anything be...

      Hi,

      you just have to add the customfield, you dont have to configure anything beside that. The field is calculated, so it has no own values. Basically it calculates the difference between NOW and the DUEDATE. When the duedate is in the future the field keeps blank in the issue navigator. It just diplays something when

      1. NO RESOLUTION IS SET
      2. AND A DUE DATE FOR A ISSUE IS SET WHICH IS IN THE PAST

      I have tested the plugin with JIRA 3.6.3 and so it should work for 3.6.2 without any modification.

      You could customize the plugin so that it displays something in the other cases(e.g. when the duedate is in the future). Feel free to post your ideas!

      Cheers,

      Phil 

  4. Aug 30, 2006

    sae says:

    I change this plugin to work with estimation time field. ("estimation time" fiel...

    I change this plugin to work with estimation time field. ("estimation time" field is jira default one).

    http://confluence.atlassian.com/download/attachments/162670/overduefield-0.2.jar

    1. Oct 25, 2006

      Natasa Bulatovic says:

      Hi, The estimation time field in my understanding = how much of total work needs...

      Hi,

      The estimation time field in my understanding = how much of total work needs to be done for an issue

      JIRA updates remaining estimate automatically after work-log is created and populated properly.  

      Here is the situation (example):

      DueDate of issue = 19.Feb.07

      Remaining estimate = 1 min

      Timespent= 1 week, 3 days, 5 hours

      Overdue = 5 days, 1 hour, 35 minutes

      it is probably wrong to mix overdue (which is related to date) and workload (more/less work actually performed) into one overdue field. These are substantially different infomation.

  5. Sep 12, 2006

    stefano ciccarelli says:

    Hi, I was wondering if this plugin works with subtasks, too. Thank you, Stefano

    Hi,

    I was wondering if this plugin works with subtasks, too.

    Thank you,

    Stefano

    1. Sep 12, 2006

      Philip Herbst says:

      Hi, Yes, it works. It doesnt care about the Issue Type and if its a subtask. Che...

      Hi,

      Yes, it works. It doesnt care about the Issue Type and if its a subtask.

      Cheers,

      Phil 

      1. Sep 26, 2006

        Dharmendra Varma says:

        Hello Philip, &nbsp;This was great plugin and appreciate your efforts.&nbsp; I a...

        Hello Philip,

         This was great plugin and appreciate your efforts.  I am facing an issue with this plugin.  I dont see all the issues which are overdue in red color.  I see few in red and other in black only.  Can you guide me as to what may be the reason for it?

        Dharmendra

  6. Sep 13, 2006

    James Anderson says:

    The plugin marks things as overdue when they are due that day. &nbsp;Like if i e...

    The plugin marks things as overdue when they are due that day.

     Like if i enter a task, mark it as due sept. 18th, the plugin will mark the task as overdue on sept 18th instead of the next day when it is actually overdue.

     So if you enter a task thats due the same day, it is overdue immediately.

     Cheers,

    James

  7. Sep 26, 2006

    Neal Applebaum says:

    James I see your point. To be fair, my customization (see

    James - I see your point. To be fair, my customization (see http://jira.atlassian.com/browse/JRA-9749) assumes the same thing - that it is due at 12:01 AM that day, not close of business, or 11:59 PM. If it is due today, it is displayed in RED.

  8. Sep 26, 2006

    Philip Herbst says:

    Hi, you can change the behaviour of the plugin by simply adjusting the velocity...

    Hi,

    you can change the behaviour of the plugin by simply adjusting the velocity template col-overduefield.vm .

    This calculated field holds the seconds which the issue is overdue starting at 12 AM that day, as Neal pointed out. This is due to the fact that the due date timestamp only holds a date but not day time.
    Edit following line

    #if (!$issue.resolution && $value.intValue() > 0)
    <style>
     <!--
     #issuerow${issue.id} *
     {
             color: #cc0000;
     }
      -->
    </style>

    to

    #if (!$issue.resolution && $value.intValue() > 60*60*12)

    The issue is now overdue 12 hours later.

    Hope that helps

    1. Oct 31, 2006

      Bettina Zucker says:

      Hello Phil, I got the same critique by my users: for them, if it is due today an...

      Hello Phil,

      I got the same critique by my users: for them, if it is due today and not yet done, it is still not overdue.
      My problem is that my Jira(3.6.2)+Overdue-Plugin does not start counting the overdue hours at noon.
      It starts from the midnight before the due day!  So I must admit my users are in any case right.

      With your tip I managed to make the issues colored in red later, but the value appearing in overdue is still counted from 00:00:00 of the due day.  This is not accepted by my users!

      I suppose the only good solution is to correct the java code. Do you have any hints?

      Cheers

      Bettina 

      1. Oct 31, 2006

        Neal Applebaum says:

        I think Phil already answered that. His example was for noon by changing #if (...

        I think Phil already answered that. His example was for noon by changing

        #if (!$issue.resolution && $value.intValue() > 0)
        

        to

        #if (!$issue.resolution && $value.intValue() > 60*60*12)
        

        So all you would do is make it like this:

        #if (!$issue.resolution && $value.intValue() > 60*60*24)
        

        for midnight or

        #if (!$issue.resolution && $value.intValue() > 60*60*17)
        

        for 5pm.

      2. Oct 31, 2006

        Philip Herbst says:

        Hi Bettina, I see your point. I worked a little on the plugin and introduced a ...

        Hi Bettina,

        I see your point. I worked a little on the plugin and introduced a Parameter that allows you to "add" a certain amount of hours to the duedate.
        In atlassian-plugin.xml you can adjust the following value (24 Hours are now default)

        <param name="hoursToAddToDuedate" value="24"/>

        This means that an Issue with a duedate 31/Oct/06 is marked as due from 1/Nov/06 on.

        I also addressed the sorting issue. I read your comment regarding sorting and searching. I dont think you need to index the value because can already can search for overdue issues out of the box(better because you dont need to reindex to use the plugin). I just added a dummy value for issues with no duedate or a resolution -> Integer.MIN_VALUE. This ensures that they are a the bottom respectively at the top of the list. Issues which are overdue in the future have a negative value, so sorting should work properly. Those values (less than 0) are not shown in the UI

        Hope this helps,

        phil

        1. Oct 31, 2006

          Philip Herbst says:

          Download overduefield0.4.jar
        2. Oct 31, 2006

          Philip Herbst says:

          Ok, its getting late sorry for my typos ;) To clarify: with the default param ...

          Ok, its getting late sorry for my typos

          To clarify: with the default param

          <param name="hoursToAddToDuedate" value="24"/>

          an issue with a duedate 31/Oct/06 is marked as due from 1/Nov/06 12 AM, because the duedate is stored without daytime (stored as 31/Oct/06 12 AM)

  9. Oct 26, 2006

    Bettina Zucker says:

    Hi Phil, I've added ordering to your plugin, so that you can order the navigator...

    Hi Phil,

    I've added ordering to your plugin, so that you can order the navigator column "Overdue" by time past.

    Since it is very simple to make this change, I'll want to share it here.

    You just have to use a Double for the variable duedateDiff instead of a Long.
    Then you can use the jira standard Number Range Searcher to index the field.
    You can even search by using this searcher.
    For instance you can search all overdue by just putting 1 second into the first field of the search.
    In general it is difficult to search because you need the number of seconds.

    Cheers

    Bettina Zucker

    P.S.: 

    Since I changed a little bit more than just the Long -> Double, I'll put here my code,
    where (...) stands for whatever your organisation name is:

    package (...).jira.plugin.overduefields; import com.atlassian.jira.issue.Issue;
    import com.atlassian.jira.issue.customfields.SortableCustomField;
    import com.atlassian.jira.issue.customfields.impl.CalculatedCFType;
    import com.atlassian.jira.issue.customfields.impl.FieldValidationException;
    import com.atlassian.jira.issue.fields.CustomField;
    import org.apache.log4j.Category;
    import java.sql.Timestamp;
    import java.util.*;
    
    public class OverdueField extends CalculatedCFType implements SortableCustomField{
    	private static final Category log = Category.getInstance(OverdueField.class);
    
    	public String getStringFromSingularObject(Object singularObject)
        {
            assertObjectImplementsType(Double.class, singularObject);
            log.info("getStringFromSingularObject: singularObject = " + singularObject);
            log.info("getStringFromSingularObject: string = " + singularObject.toString());
            return singularObject.toString();
        }
    
        public Object getSingularObjectFromString(String string) throws FieldValidationException
        {
        	if (string==null || string.equals("")) return null;
            log.info("getSingularObjectFromString: string = " + string);
            return new Double(string);
        }
    
    	public Object getValueFromIssue(CustomField field, Issue issue) {
    		long nowMillis = System.currentTimeMillis();
    		long millis = 0L;
    		Number duedateDiff = null;
    		Timestamp nowTimestamp = new Timestamp(nowMillis);
    		Timestamp duedate = issue.getDueDate();
    		try {
    			if (duedate!=null && issue.getResolutionObject()==null)
    				millis = nowTimestamp.getTime() - duedate.getTime();
    			else millis = 0L;
    
    			if (millis>86400000) millis -= millis % 86400000;
    			duedateDiff = new Double(millis / 1000L);
    		} catch (Exception e) {
    			log.error(e);
    		}
    		return duedateDiff;
    	}
    }
    

     And here is the atlassian-plugin.xml:

    <atlassian-plugin key="(...).jira.plugin.overduefields" name="Overdue Fields">
    
    	<plugin-info>
    		<description>Overdue Fields Plugin</description>
    		<version>2.0</version>
    		<application-version min="3.4" max="3.6"/>
    		<vendor name="(...)" url="http://www.(...)"/>
    	</plugin-info>
    
    	<customfield-type key="overduefield"
    		name="Resolution Overdue Field"
    		class="(...).jira.plugin.overduefields.OverdueField">
    		<description>Field that highlights overdue Issues in Issue Navigator</description>
    		<resource type="velocity" name="view" location="templates/col-overduefield.vm" />
    		<resource type="velocity" name="column-view" location="templates/col-overduefield.vm" />
    		<resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-basictext.vm"/>
    	</customfield-type>
     	<customfield-searcher key="numberrange" name="Number range searcher"
    		i18n-name-key="admin.customfield.searcher.numberrange.name"
    		class="com.atlassian.jira.issue.customfields.searchers.NumberRangeSearcher">
    		<description key="admin.customfield.searcher.numberrange.desc">Allow searching for a number that is in a given range</description>
    		<resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-number-range.vm"/>
    		<resource type="velocity" name="view" location="templates/plugins/fields/view-searcher/view-searcher-number-range.vm"/>
    		<valid-customfield-type package="(...).jira.plugin.overduefields" key="overduefield"/>
    	</customfield-searcher>
    </atlassian-plugin>
    
  10. Nov 12, 2006

    Colin Goudie says:

    Can anyone give me any pointers as to why I'm not seeing the overdue rows show u...

    Can anyone give me any pointers as to why I'm not seeing the overdue rows show up as red? I can see the date due column and can see that the entry is in the past but the entry does not show up red.

     Thanks

    1. Nov 13, 2006

      Neal Applebaum says:

      Colin, maybe it has to do with your date format(s)?

      Colin, maybe it has to do with your date format(s)?

  11. Nov 13, 2006

    Philip Herbst says:

    Hi&nbsp; Have you added the customfield to your issue navigator? Like the last ...

    Hi 

    Have you added the customfield to your issue navigator? Like the last column in the screenshot

    1. Nov 13, 2006

      Colin Goudie says:

      Thanks Philip, Silly me didn't add the Overdue column.

      Thanks Philip,

      Silly me didn't add the Overdue column.

  12. Nov 29, 2006

    Jan Deichsel says:

    Hello\! Is it possible to automatically set preset a date to the Due Date field,...

    Hello!
    Is it possible to automatically set pre-set a date to the Due Date field, depending on the priority? That would help our business case very much.

     Thanks a lot in advance!

  13. Mar 11, 2007

    Markus Khouri says:

    A project manager I am working with wanted this functionality, i.e. amount of ti...

    A project manager I am working with wanted this functionality, i.e. amount of time overdue, but also wanted the "underdue amount of time".  The term under due meant that he wanted to know in how many days an issue would be due.  To meet this requirement, I modified "\WEB-INF\classes\templates\col-overduefield.vm" as follows:

    #if ($value)
        #if ($value.intValue() > 0 && !$issue.resolution)
            $!dateutils.formatDurationPretty($value.intValue())
        #end
       
        ## -2147483 seems to be the value when the "due date" is not set
        #if (($value.intValue() < 0) && (!$issue.resolution) && ($value.intValue() != -2147483))
            ## multiple by -1 to get positive number
            ## 86400 is the number of seconds in a day
            ## subtract mod 86400 to round to full day
            #set( $underdueValue = (-1*$value.intValue()) - ((-1*$value.intValue())%86400) )
           
            ## make it look nice
            $!dateutils.formatDurationPretty($underdueValue.intValue())
        #end
       
        #if ($issue)
       
            ## if late, change text color to RED
            #if (!$issue.resolution && $value.intValue() > 0)
            <style>
            <!--
                #issuerow${issue.id} *
                {
                    color: #FF0000;
                }
            -->
            </style>
            #end        ## if more than 7 days late, change to BOLD
            ## 86400 is the number of seconds in a day
            #if (!$issue.resolution && $value.intValue() > (86400 * 7))
            <style>
            <!--
                #issuerow${issue.id} *
                {
                    font-weight: bold;
                }
            -->
            </style>
            #end
           
            ## if due in the future, change text color to BLUE
            ## -2147483 seems to be the value when the "due date" is not set
            #if ((!$issue.resolution) && ($value.intValue() < 0) && ($value.intValue() != -2147483))
            <style>
            <!--
                #issuerow${issue.id} *
                {
                    color: #0000FF;
                }
            -->
            </style>
            #end
        #end
    #end

    The problem is, now a bug has appeared, as can be seen in the following screenshot where there is a gap is the sorting which contains the issues which do not have a due date.  My expectation was that issues which do not have a due date would be at the bottom of the ordered list:













    It just so happens that "-2147483" is the number that is returned when there is no due date, which is about 24.9 days, or between 3 weeks 3 day and 3 weeks 4 days.  Note also that Integer.MIN_VALUE = -2,147,483,648, which, when divided by 1000 as is done in OverdueField.getValueFromIssue(), results in -2147483.

    So.... I am thinking that a potential cause/solution is that instead of setting the value to Integer.MIN_VALUE, it should be set to Long.MIN_VALUE. 

    Now, I am not 100% sure if this would do the trick....  if the source code were provided, it would be helpful.  Please note I am using version "overduefield-0.4.jar" of this extension.

    1. Mar 12, 2007

      Philip Herbst says:

      Hi, I've attached the source source.zip of the plugin with some modifications t...

      Hi,

      I've attached the source of the plugin with some modifications that should work for you. 2 things to mention:

      1. I've introduced the negative value in order change the sorting behaviour (you can change the return value to null but that will have an impact on the sort order)
      2. The version of velocity Jira comes with has no support for long comparisons

      I've changed the return value for no-duedate issues from Integer.MIN_VALUE/1000 to Integer.MIN_VALUE which was actually a bug.

      Feel free to modify the code. Hope that helps,

      Philip

      1. Mar 13, 2007

        Markus Khouri says:

        Thank you.&nbsp; I will figure out how to compile the code and test it out.&nbsp...

        Thank you.  I will figure out how to compile the code and test it out.  Once again, thanks.

        -markus

  14. Mar 28, 2007

    Efi Bagourdi says:

    Does anybody know if this plugin is compatible with jira 3.8?

    Does anybody know if this plugin is compatible with jira 3.8?

    1. Mar 28, 2007

      Philip Herbst says:

      Hi, tested it with 3.8 and it works. Cheers, Phil

      Hi,

      tested it with 3.8 and it works.

      Cheers,

      Phil

  15. Apr 15, 2007

    Mohammed Haque says:

    Hi Phil, The plugin doens't work for on JIRA 3.8.&nbsp; I downloaded the ver 0.4...

    Hi Phil,

    The plugin doens't work for on JIRA 3.8.  I downloaded the ver 0.4 and did everything as instructed here.  I created the new field of type "OverDue" and then also configured the issue navigator as well.  I do not see the overdue calcualtion and no high-lighting either.  Please let  me know if I am missing anything.

     Thanks,

     Mohammed

  16. Oct 18, 2007

    Daniel Sand says:

    Ola, just builded a 0.5 .jar. overduefield0.5bleedingedge.jar tested under JI...

    Ola,

    just builded a 0.5 .jar.

    overduefield-0.5-bleeding-edge.jar

    tested under JIRA 3.7.4

    so long
    Daniel

    P.S.: thx Markus for the help :]

  17. Oct 31, 2007

    gareth Collins says:

    Hey, &nbsp;I have installed this plugin and it is great i can see all the calls ...

    Hey,

     I have installed this plug-in and it is great i can see all the calls are in a nice blue and all the overdue calls are red, i was wondering if there is a tweak that i can make to flag up tasks that are due that day (eg 0 minutes) to being a different colour.  Im using this software as a helpdesk and this would really aid me in being able to see what calls are due that day instead of looking down the due date field and seeing that way as im bound to miss something and have users moaning at me (like thats ever going to stop)

     Thanks in advance

    Gareth Collins

  18. Dec 13, 2007

    Paul Csapo says:

    Hello Phil, does this plugin work in Jira 3.12? We tried to install it but canno...

    Hello Phil, does this plugin work in Jira 3.12?
    We tried to install it but cannot see any Custom Field types called "OverDue".

    regards,
    Paul