Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23527

ezdatetime with no default value causes class edit to fail

    XMLWordPrintable

    Details

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m