Forumlar / Cotonti / Bugs / Archive / EXTRA Fields BUG

Updating same field

Macik
#1 2009-07-09 21:53
Location: admin.php?m=users&s=extrafields

When user try to type in FIELDNAME name already exists in database we get an Error while updating:
Fatal error : SQL error : Duplicate column name 'user_name'

(In case I try to specify Extra field named `NAME`).
There are no check at update routine I guess.

So, next time I fix it name to `firstname` and successfully update the value - I get an error at USERS page (users.php):

Fatal error : SQL error : Unknown column 'user_name' in 'order clause'

It seems the names of fields in databese `sed_users` are changed! :-O
-------------------------------------------------------------------------------------------
In russian:

Т.к. с английским не супер, пишу тоже самое на русском:

Суть проблемы: при попытке указать в качества Экстра поля имя имеющееся в базе данных sed_users получаем ошибку (например при вводе поля NAME):
Fatal error : SQL error : Duplicate column name 'user_name'
Как я понял это проимходит из-за того, что при апдейте нет проверки на корректность имени поля.

Дальше больше, вернувшись назад к странице настройки экстра полей я изменил имя поля на другое (firstname) и успешно обносил данные кнопкой "Обновить". Все вроде ОК.
Однако при попытке обращения к странице списка пользователей я получаю ошибку:
Fatal error : SQL error : Unknown column 'user_name' in 'order clause'

Полез в базу смотреть что не так, оказалось при последнем апдейте были изменены! имена полей таблицы sed_users, в частности поле user_name было переименовано в user_FIRSTNAME и соответственно все попытки системы обратиться к этой таблице заканчиваются ошибкой.
Полный аут. :)
https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
Trustmaster
#2 2009-07-09 23:47
I have created ticket #327. The first thing I want to do is to prevent existing fields from being duplicated.
May the Source be with you!
Kilandor
#3 2009-07-10 00:55
Also on top of that, you should add support so old field (created before we had extra fields) could be added, so they can be changed and supported by this feature. So that it doesn't cause the fields being emptied or anything.

Likely a simple checkbox can handle this, so it adds the field, but doesn't create it in the table.
Trustmaster
#4 2009-07-10 02:59
All done now in trunk. Changes will be included in beta2.
May the Source be with you!
KillerSneak
#5 2009-07-27 21:30
Same problem here when i try to update / make a new extra user field

Fatal error : SQL error : Table 'donotarg_test.users' doesn't exist

table should be

donotarg_test.sed_users .. Why doesn't the extra userfileds tab see the .sed_users ??
Trustmaster
#6 2009-07-27 21:54
Your config.php is missing $db_x variable. Please compare to config-sample.php.
May the Source be with you!
KillerSneak
#7 2009-07-28 19:26
# Trustmaster : Your config.php is missing $db_x variable. Please compare to config-sample.php.
Okey ill look into that and report back, but it can't be missing as it's based on the 0.0.6 and the rest of the site works fine?

Added 8 minutes later:

Thanks, fixed it now

Bu konu KillerSneak tarafından düzenlendi(2009-07-28 19:35, 14 yıllar önce)