View Issue Details

IDProjectCategoryView StatusLast Update
0007754mantisbtcustom fieldspublic2009-06-26 12:05
Reporterdyawlak Assigned Tojreese  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Summary0007754: Empty Custom Date Fields
Description

I have create a custom date field 'Required By' which can be left blank

However, any blank date creates an error :

SYSTEM WARNING: date() expects parameter 2 to be long, string given

Is it possible to trap blank dates and print null instead?

Many thanks

Steps To Reproduce

Create custom date field

create custom_functions_inc.php in root and add

$t_columns[] = 'custom_Required By';

before the return; command

Additional Information

Error is displayed on all screens where field exists.

TagsNo tags attached.

Relationships

duplicate of 0010184 closedjreese APPLICATION ERROR 0001303 when optional custom date field is left blank 

Activities

dyawlak

dyawlak

2007-02-20 07:20

reporter   ~0014070

Resolved the issue by changing the code in the function "string_custom_field_value" of custom_field_api.php to read
case CUSTOM_FIELD_TYPE_DATE:
if ($t_custom_field_value != null) {
if ($t_custom_field_value != " ") {
return date( config_get( 'short_date_format'), $t_custom_field_value) ;
}
}
break ;

loraxxarol

loraxxarol

2007-04-03 12:08

reporter   ~0014304

Found that having empty custom date values also caused problems when displaying issue history. When updating at a point in workflow when the custom date field is required on update, the resultant bug view would show, just above the "Issue History" section:

SYSTEM WARNING: date() expects parameter 2 to be long, string given

Found the issue stemmed from the same issue, but the history_api.php file calls string_custom_field_value_for_email() instead of string_custom_field_value().

Resolved this issue by changing function string_custom_field_value_for_email in custom_field_api.php in the exact same fashion as dyawlak's change:

case CUSTOM_FIELD_TYPE_DATE:
    if ($p_value != null) {
        if ($p_value != " ") {
        return date( config_get( 'short_date_format' ), $p_value) ;
        }
    }
break ;
dyawlak

dyawlak

2008-06-19 05:47

reporter   ~0018139

This issue is still present 1.1.2

cbasset

cbasset

2009-06-01 04:33

reporter   ~0022020

Reproduced in 1.1.6

jreese

jreese

2009-06-01 11:53

reporter   ~0022023

I believe this is a duplicate of the recently-resolved 0010184.