Default value for custom field of date type

Get help from other users here.

Moderators: Developer, Contributor

deboutv
Posts: 507
Joined: 15 Jan 2007, 14:31
Location: La Ciotat, FRANCE
Contact:

Re: Default value for custom field of date type

Post by deboutv »

It don't have MSSQL server, so it is difficult to find the issue :(
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/

Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux
dyawlak
Posts: 66
Joined: 07 Dec 2007, 16:42

Re: Default value for custom field of date type

Post by dyawlak »

are you able to give me any pointers - i'm not too up on PHP but have programmed in other languages.

Thanks
deboutv
Posts: 507
Joined: 15 Jan 2007, 14:31
Location: La Ciotat, FRANCE
Contact:

Re: Default value for custom field of date type

Post by deboutv »

The issue is not PHP but SQL syntax.
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/

Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux
dyawlak
Posts: 66
Joined: 07 Dec 2007, 16:42

Re: Default value for custom field of date type

Post by dyawlak »

do you know which of the scripts its in and I'll have a look?


Thanks
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Re: Default value for custom field of date type

Post by vboctor »

In Mantis 1.2, it will be possible to set the default value for a custom date field to values like: {tomorrow}, {yesterday}, {+ 3 days}, {-2 days}, {next week}.
Migrate your MantisBT to the MantisHub Cloud
Guil
Posts: 8
Joined: 29 Aug 2011, 10:33
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil »

Hello,

I tried on mantis 1.2.5 do add default value to date custom field like {+5 days} or {tomorrow} byt my default custom field remain empty...

A bug ? a wrong configuration ?

Regards
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Default value for custom field of date type

Post by atrol »

Did you enable "Display When Reporting Issues" ?
Please use Search before posting and read the Manual
Guil
Posts: 8
Joined: 29 Aug 2011, 10:33
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil »

Hello

Sorry I didn't explained well.
My custom field is showned on my report.. I can fill it and set a date using the boxes. (this is working fine)

The problem is that I want to set a default value :
I supposed that the date boxes of the custom field should be set to today+1day when I set {tomorrow} on default value of the custom field properties.
But it remained not set to today + 1day.. the boxes are unset and I need to select them.. (no date is set)

hope to be clear :-( (I made a screenshot copy)
Attachments
date_mantis_config.png
date_mantis_config.png (6.93 KiB) Viewed 11726 times
date_mantis.png
date_mantis.png (1.45 KiB) Viewed 11726 times
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Default value for custom field of date type

Post by atrol »

I understood your issue, but I was not able to reproduce it. ({tried tomorrow} and {+5 days}
I tried with IE8 and FF6.

Are you able to reproduce the issue with Mantis2Go ?
Please use Search before posting and read the Manual
Guil
Posts: 8
Joined: 29 Aug 2011, 10:33
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil »

I dind't tried with mantis2go but a real install on my server...
I don't think this is a navigator problem but more surely à php date() function

On this page : http://docs.mantisbt.org/master-1.2.x/e ... STOMFIELDS

we can read :
Custom fields of type date can be defaulted to a specific dates or to relative dates. Typically relative dates is the scenario that makes sense in most of the cases. The format for specific dates is an integer which indicates the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT), which is the format consumed by the PHP date() method. The relative scenario expects default values like {tomorrow}, {yesterday}, {+2 days}, {-3 days}, {next week}, etc. The curly brackets indicate that this is a logical value which is then evaluated using the PHP strtotime() function.
So it sound that it could be a strtotime() function, but I don't know how to test or debug..
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Default value for custom field of date type

Post by atrol »

Create a file tstrotime.php and run it in your browser

Code: Select all

<?php
echo strtotime( '+5 days');
?>
The result should be someting like: 1315067165
Please use Search before posting and read the Manual
Guil
Posts: 8
Joined: 29 Aug 2011, 10:33
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil »

I'm not at the office now but i made this test and it worked... strtotime is ok...
It is like my {+5 days} is not interprated ... is there a ddebug mode under mantis ?? :D
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Default value for custom field of date type

Post by atrol »

Again: Are you able to reproduce the issue with Mantis2Go ?
Please use Search before posting and read the Manual
Guil
Posts: 8
Joined: 29 Aug 2011, 10:33
Location: Gironde - France

Re: Default value for custom field of date type

Post by Guil »

Hello

I found what I thought to be an issue.
In fact the field is well filled in when we create it.
But if the field already exist, changing the parameters don't impact it..

after mind, this is not abnormal...

So no issue. this is working fine. Sorry fr bandwidth.
Post Reply