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

Drupal views 3 contextual filter on YYYY/MM/DD for custom data datetime field no longer works

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.2
    • Fix Version/s: 4.5
    • Labels:
      None

      Description

      Drupal views 3 contextual filter on YYYY/MM/DD for custom data field of type datetime no longer works.

      Worked in 4.3.5, broken after I upgraded to 4.4.2.

      The setting of the field type (datetime) and offset (0) when calling function views_date_sql_extract() was removed sometime after version 4.3.5. Without setting those drupal views 3 uses its default field type of 'int' and an offset based on your timezone. This results in a SQL query which will return no results for the specified YYYY/MM/DD.

      Here is an example from the file views_handler_argument_civicrm_day.inc

      This is the current code from 4.4.2 which results in a sql query which returns no results:
      $this->formula = views_date_sql_extract('DAY', "**table**.$this->real_field");
      This is the same code line from 4.3.5 which works:
      $this->formula = views_date_sql_extract('DAY', "**table**.$this->real_field",'datetime',0);

      Calls to views_date_sql_extract() are found in the following files.

      views_handler_argument_civicrm_day.inc
      views_handler_argument_civicrm_month.inc
      views_handler_argument_civicrm_week.inc
      views_handler_argument_civicrm_year.inc

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              glnielsen Glenn Nielsen
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: