Details
-
Bug
-
Resolution: Fixed
-
High
-
5.3.3, 5.4-dev
Description
eZ will return a MySQL query error when editing a class and adding an ezdatetime attribute without default value.
The method eZDateTimeType::batchInitializeObjectAttributeData return the data below if no default value if define.
array( 'data_int' => null, 'sort_key_int' => null )
This value generates invalid SQL query in eZContentClassAttribute::initializeObjectAttributes :
INSERT INTO ezcontentobject_attribute( contentobject_id, version, contentclassattribute_id, data_type_string,
language_code, language_id, data_int, sort_key_int )
SELECT a.contentobject_id, a.version, 350, 'ezdatetime', a.language_code, MAX(a.language_id), ,
FROM ezcontentobject_attribute a, ezcontentobject o
WHERE o.id = a.contentobject_id AND
o.contentclass_id=26
GROUP BY contentobject_id,
version,
language_code
Steps to Reproduce
- Edit any class with a datetime attribute with no default value
- Add a second datetime attribute
- Try to save the class
Note: the bug will only happen if the class has at least one created object