Page 1 of 2

Default value for due date not work

Posted: 25 Jun 2020, 16:54
by pollevr
Hi all,

I don't understand why not work the setting of default value for due date.

I tried many ways:
- via configuration option as below
configuration option
configuration option
configuration_option.jpg (35.27 KiB) Viewed 12819 times
- via configuration_default_inc.php, as below
$g_due_date_default = 'today';

I also set up:
$g_due_date_update_threshold = REPORTER;
$g_due_date_view_threshold = REPORTER;

When I report a bug, in db table the stored value is 1 and the page show null, as below
view page
view page
view_page_bug.jpg (34.52 KiB) Viewed 12819 times

Thanks to who will be able to help me.

Bye,
Cristian

Re: Default value for due date not work

Posted: 25 Jun 2020, 18:42
by cas
See here for an explanation:
https://www.php.net/manual/en/function.strtotime.php

So you can add the following line to \core\config_inc.php:

Code: Select all

$g_due_date_default = '+5 days';
This will give a due-date of today ( June 25th) + 5 days, giving June 30th

Re: Default value for due date not work

Posted: 26 Jun 2020, 17:46
by pollevr
Hi Cas,

thanks for your anwser, but my problem is that the value will not stored in db.

Of course, my MantisBT version is 2.24.1 and as I wrote, I tried many values, i.e.:

$g_due_date_default = 'today';

in /config_defaults_inc.php and in /config/config_inc.php.

I tried also with a new file /core/config_inc.php as you wrote, but with the same result.

Why the default value not stored?


Thank you again.
Cristian

Re: Default value for due date not work

Posted: 26 Jun 2020, 18:45
by cas
I will check it on my server to see if it is a bug or not.
Will let you know tomorrow :mrgreen:

Re: Default value for due date not work

Posted: 27 Jun 2020, 10:27
by cas
Works perfectly on my instance.
Please verify the following settings also:

Code: Select all

$g_due_date_update_threshold = NOBODY;
$g_due_date_view_threshold = NOBODY;
please change to (in config/config_inc.php):

Code: Select all

$g_due_date_update_threshold = REPORTER;
$g_due_date_view_threshold = VIEWER;

Re: Default value for due date not work

Posted: 27 Jun 2020, 12:05
by pollevr
Hi cas,

I did:

[/config_defaults_inc.php]

Code: Select all

$g_due_date_update_threshold = NOBODY;
$g_due_date_view_threshold = NOBODY;
[/core/config_inc.php]

Code: Select all

$g_due_date_update_threshold = REPORTER;
$g_due_date_view_threshold = VIEWER;
but now I no longer see the field in frontend (I no longer see due date field):
due date missing
due date missing
page_view_due_date_miss.jpg (56.9 KiB) Viewed 12517 times
and I didn't solve my problem because in db the value is still 1:
value stored in db
value stored in db
stored_value_db.jpg (9.99 KiB) Viewed 12517 times
Maybe the system doesn't read the /core/config_inc.php file?
Please help me understand what I did wrong, give me some ideas.

Thank you,
Cristian

Re: Default value for due date not work

Posted: 27 Jun 2020, 12:10
by cas
Cristian,
never change values in config_deafults_inc.php, only in config/config_inc.php
These are my values:
$g_due_date_update_threshold = REPORTER;
$g_due_date_view_threshold = VIEWER;
$g_due_date_default = '+21 days';
Not sure what happened in the past but did you also created a new issue to see how it goes?

Re: Default value for due date not work

Posted: 27 Jun 2020, 14:28
by atrol
pollevr wrote: 27 Jun 2020, 12:05 Maybe the system doesn't read the /core/config_inc.php file?
It doesn't .
As cas pointed out, the system reads config/config_inc.php

Re: Default value for due date not work

Posted: 27 Jun 2020, 14:32
by pollevr
Hi cas,
cas wrote: 27 Jun 2020, 12:10 Not sure what happened in the past but did you also created a new issue to see how it goes?
Yes, I created the same issue and I deleted it as duplicate.


I tried as you wrote, so in my config/config_inc.php:

Code: Select all

$g_due_date_update_threshold = REPORTER;
$g_due_date_view_threshold = VIEWER;
$g_due_date_default = 'today';
but the value stored in db is always "1":
stored value in db
stored value in db
stored_value_1_db.jpg (10.94 KiB) Viewed 12507 times
Why in db the value is "1"?


However now I see the field in the page view, but without value:
view page due date without value
view page due date without value
view_page_due_date_bug.jpg (42.01 KiB) Viewed 12507 times

If I put manually the value I can see the right value:
view page due date with manually value
view page due date with manually value
view_page_due_date_bug_manually_value.jpg (20.02 KiB) Viewed 12507 times

Any other idea for insert the value automatically?


Thanks,
Cristian

Re: Default value for due date not work

Posted: 27 Jun 2020, 14:44
by cas
No more clues.
I have tested this on a vanilla installation of 2.24.1 and it works like a charm 8O

Re: Default value for due date not work

Posted: 27 Jun 2020, 14:51
by atrol
As a first step I recommend to
- restore original config_defaults_inc.php
- try with English language settings

Have you changed $g_datetime_picker_format or $g_normal_date_format ?

Re: Default value for due date not work

Posted: 27 Jun 2020, 16:53
by pollevr
Hi atrol,
atrol wrote: 27 Jun 2020, 14:51 - restore original config_defaults_inc.php
done
atrol wrote: 27 Jun 2020, 14:51 - try with English language settings
done:
view page en
view page en
view_page_bug_en.jpg (16.42 KiB) Viewed 12481 times

atrol wrote: 27 Jun 2020, 14:51 Have you changed $g_datetime_picker_format or $g_normal_date_format
Yes, but now I restored the initial values.

Unfortunatly, the result not changed:
db value
db value
stored_value_db.jpg (11.22 KiB) Viewed 12481 times

I don't understand...

Re: Default value for due date not work

Posted: 27 Jun 2020, 17:23
by atrol
Did you remove the due_date_default setting from database ?
I suspect it's stell there what you have done on your very first sreenshot, so this value is taken and not the one from config_defaults_inc.php

Is the field "Due Date" populated with a value after clicking "Report Issue" ?
Do you see the calendar icon right beside the field ?

If not, check browser console for errors or warnings you might get.

Re: Default value for due date not work

Posted: 27 Jun 2020, 18:15
by pollevr
Hi atrol and cas,

I understood that was the problem:

I had entered a value in configuration option for bug_report_page_fields:

Code: Select all

array (
  1 => 'category_id',
  2 => 'summary',
  3 => 'description',
)
which did not allow to set the default due date correctly.

Thanks for your support!

Re: Default value for due date not work

Posted: 03 Mar 2022, 22:32
by bmason
Is this considered fixed? I am seeing a similar issue with version 2.25.2. Here's the situation:

I recently set up a new MantisBT system using version 2.22.2 and set the following in config_inc.php:
$g_due_date_update_threshold = 10;
$g_due_date_view_threshold = 10;
$g_due_date_default = '+14 days';

This had the effect of setting the default due date 14 days out, which is what we wanted.

Then I upgraded the system from 2.22.2 to 2.25.2 to fix a different problem we were having with setting a default for a custom Date field. Basically I replaced all the files in the mantis folder with the new ones, and copied over the files from the old /config folder to the new one.

We're using same database and same customized config files, but the due date default no longer works - the due date is always blank when we open the report issues screen.

Running on a Windows platform with PHP 7.3.9 and MySQL 8.0.18.