snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

User with no manager errors on update

Open madd15 opened this issue 12 years ago • 13 comments

When editing a user with no manager i receive an error when saving the change to the user.

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'manager_id' at row 1 (SQL: update users set updated_at = 2014-05-29 02:22:01, manager_id = where id = 2)

madd15 avatar May 29 '14 02:05 madd15

Can you check if you're running MySQL in strict mode?

snipe avatar May 29 '14 02:05 snipe

I checked and got the line below;

STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION

madd15 avatar May 29 '14 22:05 madd15

Okay, so it looks like you're running in strict mode. I should be able to have a patch for you before the weekend. Otherwise you can turn strict mode off.

snipe avatar May 29 '14 22:05 snipe

I have turned strict mode off and this does not occur anymore.

madd15 avatar Jun 04 '14 22:06 madd15

Hi @madd15 - apologies for the delay in resolving this. I'll still be working on a patch for this for folks who need to run in strict mode, but I'm glad you were able to get past it for now.

snipe avatar Jun 04 '14 22:06 snipe

When create a user with no manager i receive an error when saving the change to the user. Illuminate \ Database \ QueryException SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'location_id' at row 1 (SQL: insert into users (first_name, last_name, jobtitle, manager_id, location_id, phone, email, password, activated, permissions, updated_at, created_at) values

tranlehien2002 avatar Oct 06 '14 03:10 tranlehien2002

@tranlehien2002 Please check if you're running mysql in strict mode, as discussed above

snipe avatar Oct 06 '14 03:10 snipe

I can not turn off SQL_MODE on MariaDB.

tranlehien2002 avatar Oct 06 '14 04:10 tranlehien2002

https://mariadb.com/kb/en/mariadb/documentation/variables-and-modes/sql_mode/

snipe avatar Oct 06 '14 04:10 snipe

I set @@SQL_MODE=''; but when I restart MySQL Service then SQL_MODE = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION

tranlehien2002 avatar Oct 06 '14 04:10 tranlehien2002

Changing it that way only lasts until the next time you restart, same as MySQL. You'll need to change it in my.cnf: https://www.farbeyondcode.com/Solution-for-MariaDB-Field--xxx--doesn-t-have-a-default-value-5-2720.html

snipe avatar Oct 06 '14 04:10 snipe

Thanks @snipe I change it in my.ini I have turned strict mode off and this does not occur anymore.

tranlehien2002 avatar Oct 06 '14 04:10 tranlehien2002

Great, glad you got it sorted. :)

snipe avatar Oct 06 '14 04:10 snipe