Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9080

CiviEvent created_date column error when using template

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.0.7
    • Fix Version/s: 4.1.0
    • Component/s: CiviEvent
    • Labels:
      None

      Description

      First of all when creating an event from a template, the created_date parameter is being used from the template. Although that might not be a major issue (or maybe even desired), the bigger issue is that the event cannot be created...results in error:

      Database Error Code: Incorrect datetime value: '2011' for column 'created_date' at row 1, 1292

      I tracked down where the date is being stripped to just the year in package/DB/DataObject.php line 1040 > $rightq .= ' ' . intval($this->$k) . ' ';

      The issue is that the created_date is being passed in as a formatted date field (e.g. 2011-1-1 10:00:00) which is then changed to 2011 by the intval function. When creating a new event without the template the date is passed in as date('YmdHis') e.g. 201111100000.

      The solution I came up with is to ignored the check for an empty created_date field in the create function of Event/BAO/Event.php (line 143). Unless I am missing something, the check for the id parameter should be enough to determine if the created_date field should be set to the current date (i.e. creating a new event).

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              tklawsuc Tom Klawsuc
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: