Hi
I think that this type of field works inperfect. When the entity has no records field in form has empty value.
After saving first record (with empty value in auto-inc field) next record will be calculated as '1'
In this case there will be hole in auto-increment column.
I think that system should sets '1' for first record in entity.
Auto-increment field
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Auto-increment field
Just make this field required if you don't need empty value.
Re: Auto-increment field
I think that the system should propose a value by default. Even if I make this field required, value is not filled.
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Auto-increment field
But for first record you can enter default value.
Re: Auto-increment field
Yes but it should be set by default.
Re: Auto-increment field
I fixed this for myself
In file
to
In file
in line 49 replace\includes\classes\fieldstypes\fieldtype_auto_increment.php
Code: Select all
$check_query = db_query("select (max(field_{$field['id']}+0)+1) as max_value from app_entity_{$field['entities_id']}");
Code: Select all
$check_query = db_query("select (COALESCE(max(field_{$field['id']}+0),0)+1) as max_value from app_entity_{$field['entities_id']}");