Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validity date on new user #24

Open
fartigue opened this issue Sep 25, 2019 · 17 comments
Open

Validity date on new user #24

fartigue opened this issue Sep 25, 2019 · 17 comments
Assignees
Labels

Comments

@fartigue
Copy link

Hello M. Tomolino,

Your plugin is great and match an important need in global environment!
However, since i installed the plugin, any new user has a date like 19/01/2038 as beginning of validity.
That is to say new user cannot login until i erase that field.

Even a desinstallation of the plugin does'nt change this behavior.

Do you have a way to hack that, or clean the plugin installation?

@tomolimo
Copy link
Owner

Hello @fartigue

Could you provide more information?
GLPI version, plugin version?
Screencopies of the issue?
PHP error logs?
MySQL error logs?

Thank you,
Regards,
Tomolimo

@fartigue
Copy link
Author

fartigue commented Sep 26, 2019 via email

@tomolimo
Copy link
Owner

Hello @fartigue

I believe this issue is due to the MariaDB server that is used.
Could you give me the content of the following table glpi_plugin_timezones_dbbackups?
This table contains the definition of the tables before the ALTER (= change datetime fields into timezone).

Thank you,
Regards,
Tomolimo

@fartigue
Copy link
Author

fartigue commented Sep 26, 2019 via email

@tomolimo
Copy link
Owner

I can't see the attached file!

@fartigue
Copy link
Author

fartigue commented Sep 26, 2019 via email

@tomolimo
Copy link
Owner

Hello @fartigue,

I don't really understand I've written such new default values....
You may clear the timezone default values. Just set them to NULL
First try on the glpi_users table, before applying this to all the tables.

Thank you
Regards,
Tomolimo

@fartigue
Copy link
Author

fartigue commented Sep 26, 2019 via email

@tomolimo
Copy link
Owner

Hello @fartigue,

I confirm that the plugin doesn't use this default value nowhere.

Thank you,
Regards,
Tomolimo

@fartigue
Copy link
Author

fartigue commented Sep 26, 2019 via email

@tomolimo
Copy link
Owner

Hello @fartigue

This is crazy: the plugin will change a field only when the type is DATETIME. It will change it to TIMESTAMP.
But it will not check for default values.

You may have a look into the needConvert() function in setup.php file

Thank you
Regards,
Tomolimo

@pablitobin
Copy link

Same problem to me. Any fix? It happens when I create a new ticket, time to resolve, time to own are filled automatically with same date 01-18-2038

@tomolimo
Copy link
Owner

tomolimo commented Mar 5, 2020

Hello @pablitobin

Could you provide more information?
GLPI version, plugin version?
Screencopies of the issue?
PHP error logs?
MySQL error logs?

Thank you,
Regards,
Tomolimo

@brncardoso
Copy link

brncardoso commented Jul 9, 2020

Hello, @tomolimo

Same problem to me. Any fix? It happens when I create a new ticket, time to resolve, time to own are filled automatically with same date "19-01-2038 00:14"

GLPI 9.4.5
PHP 7.0.33
Apache/2.4.6
MariaDB Server: 10.4.13-MariaDB

@pablitobin
Copy link

pablitobin commented Jul 9, 2020 via email

@tomolimo
Copy link
Owner

Hello,
Could it be that MariaDB will use a specific default value for TIMESTAMP fields?
I'm going to try to reproduce this behavior, but as I don't use MariaDB, I'll have to install it first :(
Thank you if you can give more details for me to try to reproduce.
Regards,
Tomolimo

@tomolimo
Copy link
Owner

Hello,
It seems to be an issue with MariaDB...
During DATETIME to TIMESAMP field conversion, there is an issue about the values of the default column.

Here is a fix that you may apply in the glpi_folder/plugins/timezone/hook.php file

line 125, replace the following code:

         if (is_null($column['COLUMN_DEFAULT']) && $column['IS_NULLABLE']=='NO') { // no default
            $defaultalter=" DEFAULT '0000-00-00 00:00:00'";
         } else if (is_null($column['COLUMN_DEFAULT']) && $column['IS_NULLABLE']=='YES') {
            $defaultalter = " DEFAULT NULL";
         } else if (!is_null($column['COLUMN_DEFAULT'])) {

by the following one:

         if ($column['COLUMN_DEFAULT'] == 'NULL' && $column['IS_NULLABLE']=='NO') { // no default
            $defaultalter=" DEFAULT '0000-00-00 00:00:00'";
         } else if ($column['COLUMN_DEFAULT'] == 'NULL' && $column['IS_NULLABLE']=='YES') {
            $defaultalter = " DEFAULT NULL";
         } else if ($column['COLUMN_DEFAULT'] != 'NULL') {

This new code has only been tested for MariaDB 10.4.13,

Beware that this will not change anything if plugin is already activated. If this is the case, the only way is to manually set default values for TIMESTAMP fields to NULL.

Keep me informed about evolution of the issue.

Thank you
Regards,
Tomolimo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants