Page 2 of 2
Posted: 02 Mar 2005, 21:25
by vboctor
- Regarding the wrong fix that I applied for the filtering, please fix it in your patch.
- What do you think about specifying a date range in possible values fields? And getting rid of the config variable.
Regards,
Victor
http://www.futureware.biz
Posted: 03 Mar 2005, 00:03
by undergrid
I've got changes already that allow you to specifiy a year range (ie 1990 to 2010), would this suffice or would you prefer a date specification that includes day and month?
Posted: 03 Mar 2005, 01:11
by vboctor
What is the syntax that you use now for possible values? What would be the syntax to use for the full date? I would like to be able to specify a full date range. This would mean that the contents of the month and day may be affected as well. It also means that the date custom field would have to be validated to fall within the specified range.
Regards,
Victor
http://www.futureware.biz
Posted: 03 Mar 2005, 19:20
by undergrid
Right now I'm using a simple year-year format (eg 1990-2010), for a full date I was considering using strtotime to do all the hard work, just have something like:
<date> | <date>
Where <date> is a format accepted by strtotime.
Posted: 07 Mar 2005, 19:32
by undergrid
A new patch has been attached to #5056.
Posted: 14 Mar 2005, 11:48
by GenlyAi
Code: Select all
function gpc_get_custom_field( $p_var_name, $p_custom_field_type, $p_default = null ) {
switch ($p_custom_field_type ) {
case CUSTOM_FIELD_TYPE_MULTILIST:
case CUSTOM_FIELD_TYPE_CHECKBOX:
$t_values = gpc_get_string_array( $p_var_name, $p_default );
if( null != $t_values && '' != $t_values ) {
return implode( '|', $t_values );
} else {
return '';
}
case CUSTOM_FIELD_TYPE_DATE:
$t_day = gpc_get_int( $p_var_name . "_day") ;
$t_month = gpc_get_int( $p_var_name . "_month") ;
$t_year = gpc_get_int( $p_var_name . "_year") ;
if (($t_year == 0) || ($t_month == 0) || ($t_day == 0)) {
if ($p_default == null) {
return '' ;
} else {
return $p_default ;
}
} else {
return strtotime($t_year . "-" . $t_month . "-" . $t_day) ;
}
break ;
default:
return gpc_get_string( $p_var_name, $p_default);
}
}
In gpc.api there is this function.
But I've made a custom fields not modifiable from reporter, only from developer. So in the new bug this field is not present and there are an error 200 (GPC Var not present).
I've modified the source:
Code: Select all
$t_day = gpc_get_int( $p_var_name . "_day",0) ;
$t_month = gpc_get_int( $p_var_name . "_month",0) ;
$t_year = gpc_get_int( $p_var_name . "_year",0) ;
and seems to works.
Is this correct? THX
PS: sorry for my english. I hope you understand :)
Posted: 20 Mar 2005, 22:19
by undergrid
Sorry for the delay in replying, I've been somewhat busy at work.
Yes GenlyAi, your fix is correct, I've uploaded patches for both cvs head and 0.19.2 (with date custom field patch) under bug #5056.